This document explains on how to update product stock in VirtueMart using RO CSVI import. To update stock for VirtueMart products only 2 fields are needed.
The fields are:
Creating the template
A template can be created by following these steps:
- Go to Components -> RO CSVI -> Templates
- Click New
- Give the template a name, say for example VirtueMart Product import
- Set Action to Import
- Set Component to VirtueMart
- Set Operation to Product
- Click Next: Select Source
- Source is set default to Load from your computer. No need for change.
- Click Next: Select options
- The default values are OK, change if needed.
- Click Next: Select fields
- Nothing needed here as we set to Use column headers as configuration in step 10.
- Click Next: Finalize
- All done here
- Click Close to return to the list of templates or Edit if you want to fine-tune the template further.
Creating the import file
In the import file both the column names need to be specified in the file, that way RO CSVI can read the column header and know what fields to update.
On the first line we add the column headers:
From the second line and further the product data can be added that needs to be updated:
product_sku,product_in_stock SKU1,10 SKU2,8 SKU3,25
The file is now ready to import.
Importing the stock file
- Go to Components -> RO CSVI -> Import
- Select the template created earlier with name VirtueMart product import
- Click Select file
- Select the file to import
- Click Preview
- You now see a preview of the file as to how RO CSVI sees the file
- Click Start import
- The import is run
- The Log details page will be shown with information regarding the import if the Enable logging is enabled in the template.
It is also possible to modify the saved product_in_stock value in database using arithmetic operators before values. If there is no arithmetic operator found before the value and product already has a stock value in database then existing value will be updated with the new value from import file.
Say if you want to add product_in_stock from import file to existing value in database.
product_sku,product_in_stock SKU1,+2 SKU2,+3
If you want to subtract stock values with the values from file
product_sku,product_in_stock SKU1,-2 SKU2,-3
To multiply the existing stock values in database
product_sku,product_in_stock SKU1,*2 SKU2,*3
To divide the existing stock values in database
product_sku,product_in_stock SKU1,/2 SKU2,/3