The ability to import custom field filter values and filter them using the Multiple Customfields Filter for Virtuemart.
Creating the custom field
Before you can start to import your filter values, you first need to create a custom field with a plugin of the VirtueMart2 multiple customfield plugin type. Take these steps to create the custom field:
- Click on Custom Fields in the left menu in the Products section
- Click on New
- Fill in the following fields:
- Custom Field Type: Plug-ins
- Title: Color (Remember this name as you will need it later in the CSV file)
- Published: Yes
- Parent: Don't change
- Cart Attribute: No
- Description: Change as you like
- Default: Don't change
- Tooltip: Don't change
- Layout position: Don't change
- Admin Only: No
- Is a list?: No
- Hidden: No
- Select a plug-in: VirtueMart2 multiple customfield plugin
- Click Save
- Go to the bottom of the page and notice there are some settings that can be set.
Set the Output template to multiselect-chosen.
For this example fill the parameters with:
- Click on Save & Close
- The Custom field has now been created
Creating the CSV file
An example CSV file for existing products looks like this:
"10001";"Color";"param";"Blue#Pink#Grey";"Product with filter";"0";"100"
Let's have a closer look at the fields
This is the unique code for a product.
The name of the custom field. The correct name can be found on the Custom Fields page in VirtueMart in the column named Title. This is the name used in step 3.2 when creating the custom field.
This must always be param.
The custom_param fields holds all the values you want to assign to the product, each one separated by a #.
The name of the product.
The number of products that there are in stock.
The price of the product. This field is required for the parent product otherwise the selections will not show up.
It is possible that you have multiple filter fields that you want to assign to a product, for example Color and Size. The CSV file looks like this:
"10001";"Color~Size";"param~param";"Blue#Pink#Grey~M#L#S";"Product with filter";"0";"100"
If you have 2 custom titles, there must also be 2 custom values and 2 custom parameters.