Closed torvista closed 3 years ago
From the comments for the DbIoProductsOptionsValuesHandler
:
For the import, the CSV must contain both the products_options_values_id and language_id fields, since those are used as the table's key-pair. An entry is updated if a database record is found that matches both fields; otherwise, the record is inserted using the specified language_id and a products_options_values_id that is calculated as the current table's maximum value (+1).
Usage Notes:
Thus, to create a new option-value, simply set the v_products_options_values_id
to 0 with a valid v_language_id
. The option-values get 'bound' to their associated option via the ProductsAttribsBasic
or ProductsAttribsRaw
handlers' imports.
From the comments for the DbIoProductsOptionsValuesHandler:
Where is that?
/YOUR_ADMIN/includes/classes/dbio/DbIoProductsOptionsValuesHandler.php
If I do an import for lang 1 and then an import for lang 2, they are loaded into the table sequentially: the products_options_values id for the first entry of lang2 is the next id after the last entry of lang1, instead of the same id as the first entry of lang1. If I do a single import of the two langs, they are sequential too.
Arggh, languages! This gets complicated. You'll need to import (using v_products_options_values_id
set to 0) an initial set so that the values' ids are created for one of the store's languages. Once the _id
s are set, you'll use that now-assigned non-zero _id
with an additional language_id for that next language.
ok, once I understood/read properly, I got the values into the table.
Now I would have thought there should be a step to associate those values with an id in the table products_options_values_to_products_options
But, from your description, I understood that this gets done on the import for a product. So I tried to import a ProductsAttribsRaw to a single product using the v_products_options_name as the option name and v_products_options_values_name as a list of the values:
GPX-A01^GPX-A02^GPX-A03^GPX-A04^GPX-A05^GPX-A06^GPX-A07^GPX-A08^GPX-A09^GPX-A10^GPX-A11^GPX-A12^GPX-A13^GPX-A14^GPX-A15^GPX-A16^GPX-A17^GPX-A18^GPX-A19^GPX-A20^GPX-A21^GPX-A22^GPX-A23^GPX-A24^GPX-A25^GPX-A26^GPX-A27^GPX-A28
thinking that would tie the option name and the values together.
But I got the error
Attributes not inserted at line number 2; one or more option-values.....were either not present in the default language or are not associated with the products_options_id of 16
Implying that there should be a prior association of option name to value?
Works. I note that on the import of the ProductsAttribsRaw csv, to add product attributes and create the Name-Value associations, if any of the three columns associated with downloads are present, (even though they are empty as from the export), empty entries are created in the products_attributes_download table, leading to these orphan displays:
I'll document the original 'conversation' for the ProductsOptionsValuesHandler
and open a new issue to track the changes associated with that unwanted filename insertion.
I would have expected a import csv to need the product option id and the values texts and sort orders. I surmise that at present it is only possible to update the existing option values as the import demands the option value id, no import of new values?