RO CSVI

Updating products stock in VirtueMart with RO CSVI

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:

  • product_sku
  • product_in_stock

 

Creating the template

A template can be created by following these steps:

  1. Go to Components -> RO CSVI  -> Templates
  2. Click New
  3. Give the template a name, say for example VirtueMart Product import
  4. Set Action to Import
  5. Set Component to VirtueMart
  6. Set Operation to Product
  7. Click Next: Select Source
  8. Source is set default to Load from your computer. No need for change.
  9. Click Next: Select options
  10. The default values are OK, change if needed.
  11. Click Next: Select fields
  12. Nothing needed here as we set to Use column headers as configuration in step 10.
  13. Click Next: Finalize
  14. All done here
  15. 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:

product_sku,product_in_stock

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

  1. Go to Components -> RO CSVI  -> Import
  2. Select the template created earlier with name VirtueMart product import
  3. Click Select file
  4. Select the file to import
  5. Click Preview
  6. You now see a preview of the file as to how RO CSVI sees the file
  7. Click Start import
  8. The import is run
  9. The Log details page will be shown with information regarding the import if the Enable logging is enabled in the template.

Examples

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

Video showing the process