Import Generic child variant for VirtueMart

Generic child variant for VirtueMart would help you to show products with different size settings keeping one product as a base which would be the parent product. All you need to do is create generic child variant custom field type in VirtueMart and link it among your products. Generic variant is a individual product by itself so it has its own description, images and details as how a normal product would do.

Generic child variant for VirtueMart - Example content

An example import for importing Men shoes with different sizes is explained in this document.


SH10001;;Men shoe basic size;Shoe size;product_name
SH100017;SH10001;Men shoe size 7;Shoe size;product_name
SH100018;SH10001;Men shoe size 8;Shoe size;product_name
SH100019;SH10001;Men shoe size 9;Shoe size;product_name
SH1000110;SH10001;Men shoe size 10;Shoe size;product_name

Create Generic child variant for VirtueMart custom field

So to import the above content the first thing which needs to be done is to create a custom field Shoe size in VirtueMart custom fields page as shown below.

Generic child variant for VirtueMart setting 

Note that in the example import content above custom_title has been set to the custom field name Shoe size and custom_value as product_name. There are few other options available for custom_value instead of product_name. The list of product fields available are shown in the image below. You can set the needed product field in the custom_value field as per your need.

Generic child variant for VirtueMart custom value options 

Now that all the settings are done and the import content is ready, time to import the products using VirtueMart product operation in CSVI. 

Create a template by following these steps:

  1. Go to Components -> CSVI Pro -> 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.

Generic child variant for VirtueMart product create template 

Template fields can be added by following these steps:

  1. Go to Components -> CSVI Pro -> Templates
  2. Click on Template fields
  3. In the Search Tools select your template
  4. Click on New to add a single field or click on Quick Add to add multiple fields.

Quick Add

The Quick Add Option allows you to quickly add multiple fields to a template. It is not possible to set any settings per field here but that can be done after the fields have been added to the template.

Run the import by following these steps:

  1. Go to Components -> CSVI Pro -> 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 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.

Generic child variant for VirtueMart import

Also note that if you would like to include the parent product in the list on the front end then add another field to the import content custom_param with value withParent="1"|parentOrderable="0"|wPrice=0|. So the example import content would be

SH10001;;Men shoe basic size;Shoe size;product_name;withParent="1"|parentOrderable="0"|wPrice=0|
SH100017;SH10001;Men shoe size 7;Shoe size;product_name;withParent="1"|parentOrderable="0"|wPrice=0|
SH100018;SH10001;Men shoe size 8;Shoe size;product_name;withParent="1"|parentOrderable="0"|wPrice=0|
SH100019;SH10001;Men shoe size 9;Shoe size;product_name;withParent="1"|parentOrderable="0"|wPrice=0|
SH1000110;SH10001;Men shoe size 10;Shoe size;product_name;withParent="1"|parentOrderable="0"|wPrice=0|

More articles on this subject

Related Articles