RO CSVI

Product import with custom fields

Requirements

  • CSVI 6.0+
  • Joomla 3.0+
  • VirtueMart 3.0+

Background information

To import custom fields for product normal product import procedure is followed. This article explains how to import custom field value for a product.

Virtuemart product customfield import

The fields necessary for importing products with custom fields are:

  • product_sku
  • custom_title
  • custom_value
  • custom_price
  • custom_param

Optional fields

  • custom_disabler
  • custom_override

Basic import with custom fields

It is important to note that the fields starting with custom_ are required when you use plugin custom fields and are optional for normal custom fields. Normal custom fields will be available as available fields so these fields can be directly used as template field in import. To be more clear say if Photo and Size are string type custom fields then import can also be done by using the fields in import like

"product_sku";"product_name";"Photo";"Size"
"P01";"Product 1";"product1.jpg";"36"
"P02";"Product 2";"product2.jpg";"38"
"P03";"Product 3";"product3.jpg";"40"
"P04";"Product 4";"product4.jpg";"42"

 

Virtuemart product customfield import template fields

There are 2 scenarios in which you can import custom fields:

  1. custom fields with a single value
  2. custom fields with mulitple values

Custom fields with a single value

An example CSV file looks like this:

"product_sku";"custom_title";"custom_value";"custom_price";"custom_param";"custom_disabler";"custom_override"
"P01";"Photo";"7";"";"";"Y";"Y"
"P01";"Size";"36";"";"";"Y";"N"

Let's have a closer look at the fields.

product_sku

This is the unique code for a product.

custom_title

The name of the custom field. The correct name can be found on the Custom Fields page in VirtueMart in the column named Title.

custom_value

This is the value belonging to the custom field. As seen in the example for the Size we have created sizes 36, 38 and 40.

custom_price

Optionally a price if the plugin uses and/or requires it

custom_param

Optionally a parameter if the plugin uses and/or requires it

custom_disabler

Optionally a parameter if parent customfield is not used for child product. The value should be Y to enable it or N to disable the disabler.

custom_override

Optionally a parameter if parent customfield value to be overridden for child product. The value should be Y to enable it or N to disable the override.

 

Once the csv file is ready, select the file and start the normal import process.

Virtuemart product customfield import start

 

Check the preview of the file

Virtuemart product customfield import preview

 

Start the process. Once complete, CSVI will notify with the log if enabled on the status of import process

Virtuemart product customfield import complete

 

Custom fields with multiple values

An example CSV file looks like this:

product_sku;custom_title;custom_value;custom_price;custom_param;custom_disabler;custom_override
H01;Size~Size~Size;34~36~38;24~26~28;Y~N~Y;Y~N~Y

All values are separated by the tilde character.

All custom fields have multiple values with the exception of the parameter field. So if we put the values in a table it would look like this.

Please note the table is just for understanding purpose but the format of csv file has to be strictly followed as explained above for the import to work flawless.

product_sku custom_title custom_value custom_price custom_param custom_disabler custom_override
H01 Size 34 24   Y Y
H01 Size 36 26   N N
H01 Size 38 28   Y Y

 

This is how CSVI will add the values to the product H01. As you can see the custom_param column is empty. This means that CSVI will leave that one empty.

Let's have a closer look at the fields.

product_sku

This is the unique code for a product.

custom_title

The name of the custom field. The correct name can be found on the Custom Fields page in VirtueMart in the column named Title.

Since we are adding multiple values, each value is separated by a tilde symbol. This allows for specifying more than 1 custom field to add to the product.

custom_value

This is the value belonging to the custom field. As seen in the example for the Size we have created sizes 34, 36 and 38.

custom_price

Optionally a price if the plugin uses and/or requires it

custom_param

Optionally a parameter if the plugin uses and/or requires it

custom_disabler

Optionally a parameter if parent customfield is not used for child product. This can be either 1/Y/y or 0/N/n.

custom_override

Optionally a parameter if parent customfield value to be overridden for child product. This can be either 1/Y/y or 0/N/n.

 

Once the import process is done without errors, imported custom fields for a particular product can be seen in the Virtuemart product page and in Custom fields tab.

Virtuemart product customfield import final value

Delete custom values

The field custom_delete makes it possible to delete custom values assigned to products. The field takes the following values:

  • Y: delete the custom value
  • N: do not delete the custom value
  • Empty: do not delete the custom value

This field works the same as the other custom fields, multiple values are separated by a tilde symbol. The CSV would look like this:

product_sku;custom_title;custom_value;custom_price;custom_delete
H01;Size~Size~Size;34~36~38;24~26~28;N~Y~N

This will delete size 36.

Ordering custom fields

The field custom_ordering makes it possible to order custom fields assigned to products. To set the ordering of custom fields the following fields are required:

  • product_sku
  • custom_title
  • custom_value
  • custom_ordering

You can add more fields to your import file of course, these are the minimum.

This field works the same as the other custom fields, multiple values are separated by a tilde symbol. The CSV would look like this:

"product_sku";"custom_title";"custom_value";"custom_ordering"
"P01";"Size~Color~Width";"34~Green~38";"2~1~3"

This will show the custom fields in this order:

  1. Color: Green
  2. Size: 34
  3. Width: 38

When using custom fields as an available field, they will be added in the order they are set in the CSV file. If they are part of a group, the group will be added automatically if needed.

Multiple custom values

The field custom_multiple makes it possible to import the same custom field multiple times with different values for one product. The field takes the following values:

  • Y: add as multiple value
  • N: do not add as multiple value
    Existing values will be removed
  • Empty: add as multiple value

This field works the same as the other custom fields, multiple values are separated by a tilde symbol. The CSV would look like this:

"product_sku";"custom_title";"custom_value";"custom_multiple"
"P01";"Photo~Size~Size~Size";"7~34~36~38";"N~Y~Y~Y"

Or in multiple lines:

"product_sku";"custom_title";"custom_value";"custom_multiple"
"P01";"Photo";"7";"N"
"P01";"Size";"34";"Y"
"P01";"Size";"36";"Y"
"P01";"Size";"38";"Y"

This will give the custom field Photo only 1 entry and the custom field Size 3 entries in the product.

Updating existing custom fields values

To update value of existing custom field you need custom_title, custom_value, custom_delete field along with individual template field with new value. Say if Size is a string custom field and has a value L set for a product. If you want to update value from L to XL then CSV would look like

"product_sku","custom_title","custom_value","custom_delete","Size"
"P01","Size","L","Y","XL"

Related Articles