-
Notifications
You must be signed in to change notification settings - Fork 2
Handler‐specific Usage Notes
- ProductsAttribsBasicHandler. Exports and imports 'basic' Zen Cart products' attributes.
- ProductsAttribsRawHandler. Exports and imports 'raw' Zen Cart products' attributes.
- ProductsHandler. Exports and imports Zen Cart products.
- ProductsOptionsValuesHandler. Exports and imports Zen Cart products' options' values.
The ProductsAttribsBasicHandler supports the import and export of products' option-combinations for your Zen Cart.
| Feature Name | Comments |
|---|---|
| Export/Import | Both |
| Customized Fields for Export | ✗ |
| Export Filters | None |
| Required Columns (aka Fields) for Import |
v_products_model, v_products_options_type, v_products_options_name, v_products_options_values_name
|
| Database Tables Affected | products_attributes |
| DbIo Commands | ✗ |
This handler's export supplies the following information in each of CSV column:
| Field Name | Description |
|---|---|
| v_products_model | The 'products_model' associated with the attribute's products_id. Used on import to 'find' the products_id. |
| v_products_options_type | The integer value identifying the 'option_type' defined for v_products_options_name . |
| v_products_options_name | The 'name' associated with the attribute's 'option'. Used on import to 'find' the options_id. |
| v_products_options_values_name | A list (separated by ^) of currently-defined option-values' names for the named option for the product. Used on import to 'find' the options_values_id values. |
This handler is used to import new attribute option-combinations for a product; any option-combinations already present for a product are ignored. For an option-combination to be successfully inserted for a product:
- There must be a product associated with the specified
v_products_model. - There must be a product-option with the name
v_products_options_name(of typev_products_options_type) in the site's default language. - For each of the options' values' names identified in
v_products_options_values_name:- There must be a product-option-value with that name in the site's default language.
- The option-value must be associated (in the
products_options_values_to_products_optionstable) to the named option.
If the above validations are successful for a CSV record, all option-combinations not currently present for the associated product are inserted into the products_attributes table, using default values for all fields other than products_id, options_id and options_values_id.
The ProductsAttribsRawHandler supports the import and export of product-attribute related fields for your Zen Cart.
| Feature Name | Comments |
|---|---|
| Export/Import | Both |
| Customized Fields for Export | ✗ |
| Export Filters | None |
| Required Columns (aka Fields) for Import |
v_products_id, v_options_id, v_options_values_id
|
| Database Tables Affected |
products_attributes, products_attributes_download, products_options_values_to_products_options, and products (via zen_update_products_price_sorter). |
| DbIo Commands | REMOVE |
This handler provides some additional fields on an 'export' action to make it easier to identify the attribute; all but the v_dbio_command field are ignored on an import:
| Field Name | Description |
|---|---|
| v_products_model | The 'products_model' associated with the attribute's products_id. |
| v_manufacturers_name | The 'name' associated with the attribute's product's manufacturers_id. |
| v_products_options_name | The 'name' associated with the attribute's options_id. |
| v_products_options_values_name | The 'name' associated with the attribute's options_values_id. |
| v_dbio_command | Can be either an empty string (no command) or REMOVE to cause the attribute to be removed from the database. |
An attribute's import can optionally include a download filename associated with the attribute, associated with the products_attributes_download table. The import processing depends on
- Whether the base attribute information is being inserted or updated.
- Whether an existing attribute has a pre-existing download filename.
- Whether a download filename (
v_products_attributes_filename) is supplied for the to-be-imported record.- The handler supports a sub-command (
REMOVE) value for this field, enabling a previously-recorded filename to be removed from the given attribute.
- The handler supports a sub-command (
Here's how the processing flows:
- If an attribute matching the
products_id+options_id+options_values_iddoes not exist or the attribute exists but does not currently have an associated download filename:- If the
products_attributes_filenamefield does not exist in the import or if the field exists and is an empty string:- No
products_attributes_downloadrecord is created.
- No
- Otherwise, if the filename field is not a valid filename
- The addition of the
products_attributes_downloadrecord is disallowed. Note that a newproducts_attributesrecord might have been created!
- The addition of the
- Otherwise, the
products_attributes_downloadrecord is created.
- If the
- Otherwise, an existing attribute with an existing
products_attributes_downloadrecord:- If the
products_attributes_filenamefield does not exist in the import- No update is made to the
products_attributes_downloadtable.
- No update is made to the
- Otherwise, if that field is set to
REMOVE(capitalization required)- The associated
products_attributes_downloadtable record is deleted.
- The associated
- Otherwise, if that field is not a valid filename (including an empty string)
- No change is made to the
products_attributes_downloadtable and the record is marked as an import error.
- No change is made to the
- Otherwise, the associated
products_attributes_downloadrecord is updated.
- If the
When an import includes a v_products_attributes_filename field, there are a couple of rudimentary checks on that filename that must pass to enable the associated products_attributes_download table-record to be created or updated:
- The field's value must not be an empty string.
- The field's value must not start with a
.(period). - The field's value must not contain any characters in this list:
[<>:"|?*].
The ProductsHandler supports the import and export of product-related fields for your Zen Cart.
| Feature Name | Comments |
|---|---|
| Export/Import | Both |
| Customized Fields for Export | ✓ |
| Export Filters | Product's Status, Product's Manufacturer, Product's Category |
| Required Columns (aka Fields) for Import |
v_products_id, v_products_model
|
| DbIo Commands |
REMOVE, ADD, UNLINK (added in v1.6.4), LINK (added in v2.1.0), MOVE (added in v2.1.0) |
This handler supports some additional "special" fields:
| Field Name | Description |
|---|---|
| v_manufacturers_name | The 'name' associated with the product's manufacturers_id. |
| v_tax_class_title | The 'name' associated with the product's products_tax_class_id. |
| v_categories_name | The name(s) associated with the product's master_categories_id, using the store's default language. This is represented by ^-separated names reflecting the product's category path. |
| v_dbio_command | Can be an empty string (no command), ADD to force the addition/insertion of a product's definition, REMOVE to cause the product to be removed from the database, UNLINK to unlink the product from a category other than its master-category, LINK to link the product to an additional category or MOVE to move the product to a new master-category. |
This handler uses a couple of Database I/O Manager configuration settings that control import features:

This setting, which defaults to No on installation, indicates whether (Yes) or not to allow duplicate model numbers to be applied to products on an import. If set to No, a csv-line import that would result in a duplicate model-number to be applied is not imported.
This setting, added for v1.6.4, indicates whether (Yes) or not (No, the default) a DbIo ADD command is required to create a product if no matching v_products_id or v_products_model is found.
This setting, which defaults to No on installation, indicates whether (Yes) or not to automatically create otherwise non-existent categories when importing a new product. If set to No, a csv-line import that contains an undefined v_categories_name and would result in a product's addition/insert is not imported.
A product's import can optionally set the product's master_categories_id or link a product to another category:
- If the product is new, then the
v_categories_namefield must be present so that the product'smaster_categories_idcan be determined. - If the product is being updated and no
v_dbio_commandis set, thev_categories_name(if included) identifies the product's newmaster_categories_id. The product's previousmaster_categories_idbecomes a linked category. - If the product exists and the
v_dbio_commandis set toUNLINK, the product is removed fromv_categories_nameif that category is not the product's current master-category. - (v2.1.0+) If the product exists and the
v_dbio_commandis set toLINK, the product is 'linked' to the category associated withv_categories_name; the product'smaster_categories_idis unchanged. - (v2.1.0+) If the product exists and the
v_dbio_commandis set toMOVE, the product is 'moved' (i.e. itsmaster_categories_idis changed) to category associated withv_categories_name.
The default, non-customized export for this handler gathers all the fields from the products, products_description and meta_tags_products_description tables, along with this handler's special fields.
Notes:
- If you are exporting all fields for a multi-lingual store, the fields from the
products_descriptionandmeta_tags_products_descriptiontables will each be grouped by language (default language first). - If you are exporting customized fields for a multi-lingual store, any fields within those two language-dependent table are grouped by language (default language first).
The ProductsOptionsValuesHandler supports the import and export of product's' options' values fields for your Zen Cart.
Note: This handler and its I/O requirements were changed in DbIo v2.0.2. See this GitHub issue for more information.
| Feature Name | Comments |
|---|---|
| Export/Import | Both |
| Customized Fields for Export | ✗ |
| Export Filters | None |
| Required Columns (aka Fields) for Import |
v_products_options_values_id, v_language_id, v_products_options_values_name, v_products_options_id, v_products_options_values_sort_order
|
| Database Tables Affected |
products_options_values, products_options_values_to_products_options
|
| DbIo Commands | Not supported |
For the import, the CSV must contain all the required columns/fields noted above.
- When importing new records for a multi-language store, the import should be run once per language value. Otherwise, the
products_options_values_idwill get "out-of-sync" between the multiple languages. - On an import:
- If the
products_options_values_idvalue is 0, the import is forced to be an insert. The record is inserted using the specifiedlanguage_idand aproducts_options_values_idthat is calculated as the table's current maximum value (+1). - If the associated
language_idis not valid for the store, the record's import will be denied.
- If the