There is a problem when importing product classes with multiple attributes with node_import.
The first problem related with this is the Insert made by node_import in the "uc_product_adjustments" table since node_import creates and insert in this table with int values when the format should be string values :
a:2:{i:4;s:1:"4";i:5;s:2:"10";} - Normal format of the "uc_product_adjustments" table
a:2:{i:4;i:4;i:5;i:10;} - Format inserted by node_import
To fix this i changed the following lines in the uc_attribute_node_import_postprocess function in attribute.inc file :
l206 : $valid_option = $oid; to $valid_option = (string)$oid;
l225 : $valid_option = $new_oid; to (string)$valid_option = (string)$new_oid;
l238 : $attrs_present[$aid] = $valid_option; to $attrs_present[$aid] = (string)$valid_option;
The second problem is the ordering of the attributes, since node_import calls the "uc_class_get_attributes" function to get attributes it is important to check if the ordering in the "uc_class_attributes" table is correctly set. I experienced a problem where this function was returning my attributes in a different order than when i created a product manually..i changed the order in the front end or bd so that this attributes where returned in the correct order..
"SELECT uca.aid
FROM drp_uc_class_attributes AS uca
LEFT JOIN drp_uc_attributes AS ua ON uca.aid = ua.aid
WHERE uca.pcid = '%s'
ORDER BY uca.ordering, ua.name"
(Query used by the "uc_class_get_attributes" function)
When creating a product manually (not using import) the ordering is ignored, probably does not use the "uc_class_get_attributes" function to create the uc_product_adjustments table.
Hope this can help anyone experience the same problem.
Best regards,
Comments
Comment #1
Headache commentedThanks dude. Helped a lot.
Works fine, should be commited.
Comment #2
nicothezulu commentedHello! How must we format the product attributes in the xls for the import? Do you know that?
I have multiple attributes per product with custom prices too...
Comment #3
rakugaki commentedwhere is/does attribute.inc come from?
Comment #4
syturvy commented@fungi: try http://www.ubercart.org/project/node_import_uc_stock