CSV Import of variants not as expected

  • Posts: 45
  • Thank you received: 0
10 years 7 months ago #149590

Hello there,

I'm trying to upload my shop inventory from CSV files. I would like to have a number of products, describing their specifications, and then add packaging variants with price information. E.g. as a product I may have chocolate, and as variant I may sell chocolate bars and chocolote boxes.

I've run several trials to get this working, but only with a D-tour it leads to success. In order to understand what's going on, I created some test cases to show things.

Test case 1:
The products to import

product_name;product_code;product_type;product_parent_id;package;price_value
chocolate;;main;;;
chocolate-bar;;variant;chocolate;bar;3
chocolate-bottle;;variant;chocolate;bottle;4
chocolate-box;;variant;chocolate;box;5

And this is what happens:
ACTION: Import OK ->

4 products found : 4 new products imported, 0 invalid product code, 0 already existing products

INSPECT: phpMyAdmin shows four products in the table #__hikashop_product
INSPECT: Variants recognized in the back-end, with correct pricing
INSPECT: All variants appear, prices are not updated when selecting a variant, no suffix is displayed for the variant in the product name.

ACTION: Product -> Manage variants ->

Before configuring the variant of your product, you need to first create one or several characteristics with the menu Products->Characteristics, and then add one or several characteristics to your product

INSPECT: Variants are removed from the front-end; product is free
INSPECT: phpMyAdmin shows only one product in the table #__hikashop_product; all variants are gone
INSPECT: in the back-end, all variants are gone as well.

Test case 2:
The file to import the main product:
product_name;product_code;product_type;product_parent_id;package;price_value
candy;;main;;;

And the file to import all variants somewhat later:
product_name;product_code;product_type;product_parent_id;package;price_value
candy-bar;;variant;candy;bar;3
candy-bottle;;variant;candy;bottle;4
candy-box;;variant;candy;box;5

And this is what happens:
ACTION: Import main product,

OK -> 1 products found : 1 new products imported, 0 invalid product code, 0 already existing products

ACTION: Product -> Add characteristics
INSPECT: Three additional products without name are found in phpMyAdmin, all child of the just imported product
INSPECT: Three variants are shown in the back-end
INSPECT: Three variants are shown in the front-end, suffixes are displayed for the variant in the product name. No variant has a price, which is in-line with expectations.

ACTION 2: Import variants, OK ->

3 products found : 3 new products imported, 0 invalid product code, 0 already existing products

INSPECT: Three additional variants with name are now found in phpMyAdmin, making in total 6 variants
INSPECT: The newly imported variants are orphans
INSPECT: The newly imported variants don show in the back-end
INSPECT: No price information is available in the front-end

Test case 3
The file to import the main product
product_name;product_code;product_type;product_parent_id;package;price_value
cookie;;main;;;

The file to import the variants later:
product_name;product_code;product_type;product_parent_id;package;price_value
cookie;;main;;;
cookie-bar;;variant;cookie;bar;3
cookie-bottle;;variant;cookie;bottle;4
cookie-box;;variant;cookie;box;5

Note that the variant file this time also contains the main product

Then this is what happens:
ACTION: Import main product, OK ->

1 products found : 1 new products imported, 0 invalid product code, 0 already existing products

ACTION: Product -> Add characteristics
ACTION: Product -> Manage variants -> delete all
INSPECT: Three additional products without name are found in phpMyAdmin, all child of the just imported product
INSPECT: Three variants are shown in the back-end, having no names
INSPECT: Three variants are shown in the front-end, suffixes are displayed for the variant in the product name. No variant has a price, which is in-line with expectations.

ACTION 2: Import variants, OK ->

4 products found : 3 new products imported, 0 invalid product code, 1 already existing products

INSPECT: The variants are updated with the newly read information, as shown in phpMyAdmin
INSPECT: The back-end shows the correct structure
INSPECT: The front-end displays the variants with variant price and package suffix in the title --> SUCCESS

Test case 4
The file for the product and variants, actually the same as test case 1:
product_name;product_code;product_type;product_parent_id;package;price_value
winegum;;main;;;
winegum-bar;;variant;winegum;bar;3
winegum-bottle;;variant;winegum;bottle;4
winegum-box;;variant;winegum;box;5

And here are the test results:
ACTION: Import OK ->

4 products found : 4 new products imported, 0 invalid product code, 0 already existing products

ACTION: Product -> Manage variants ->

Before configuring the variant of your product, you need to first create one or several characteristics with the menu Products->Characteristics, and then add one or several characteristics to your product

ACTION: Product -> add characteristics
ACTION: Product -> Manage variants -> select and delete all
INSPECT: Unnamed variants still exists in the back-end

ACTION 2:Import again, same file, OK ->

4 products found : 3 new products imported, 0 invalid product code, 1 already existing products

INSPECT: Everything is fine --> SUCCESS

Conclusions
  • To import variants, the file must also name the main product. Having the main product already loaded is not sufficient
  • The way to load variants is to first create these using "add characteristics", then delete all created variants, then load the variants.

Can someone help here?

Thanks and regards,

Paul


-- HikaShop version -- : 2.3.0 Business edition
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.5.9-1 Ubuntu
-- Browser(s) name and version -- : Chrome

Last edit: 10 years 7 months ago by paulvanharen. Reason: typos

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 7 months ago #149756

Hi,

Here is how your CSV should be:

product_name;product_code;product_type;product_parent_id;package;price_value
chocolate;;main;;bar;
chocolate-bar;;variant;chocolate;bar;3
chocolate-bottle;;variant;chocolate;bottle;4
chocolate-box;;variant;chocolate;box;5
Basically, you are missing the link between the main product and the characteristic in your CSV (which is where you actually define the default value of the characteristic for that product). That's why you got these issues.

Please Log in or Create an account to join the conversation.

  • Posts: 45
  • Thank you received: 0
10 years 7 months ago #149871

Dear Nicolas,

Thanks for your help. Test case 1 is now indeed working.

If I apply the same fix to test case 2, it is still malfunctioning. Would you have any suggestion to fix test case 2, or is that simply not possible?

Thanks again, Paul

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 7 months ago #149903

Hi,

You can't import pieces of a product in different CSV files.
So the test case 2 won't work.
As you can see in my previous message, and as explained in the import documentation, the product and the variants must both be in the CSV so that the product data is valid

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
10 years 6 months ago #156812

Sorry i have this situation:
"product_parent_id";"product_name";"product_code";"product_type";"product_manufacturer_id";"product_keywords";"categories";"price_value";"price_currency_id";"options";"capienza";"specifiche";"canali";"regolazione"
"Manfrotto_MB 401N";;"Manfrotto_MB 401N_6";"variant";61;"Manfrotto_MB 401N";;64,14;"EUR";;;"Specifiche";;
;"Manfrotto Pro V Zaino nero medio";"Manfrotto_MB LB050-5BB";"main";61;"Manfrotto_MB LB050-5BB";"Accessori;Borse";;;;;"Specifiche";;

where specifiche is a characteristic and Specifiche is the variant.
After import i get the relation between the main and the variant but in the administration panel of the product the characteristic field is empty. If I try to add the specifiche characteristic then everithing appears with the right values. How I get this field filled after import?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 6 months ago #156909

Hi,

It's better to create the characteristics with the desired variants and then import the products with the variant value set.

So thanks to create the characteristic via Product > Characteristics and then import the desired product.

hikashop.com/support/support/documentati...hikashop-import.html

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
10 years 6 months ago #156920

Now I created another characteriscic called "singolo", with a variant called "scheda" and now everithing is working. Maybe calling the characteristic and the variant with te same name such "Specifiche" and "specifiche" will give this error. Thank you!

Please Log in or Create an account to join the conversation.

Time to create page: 0.087 seconds
Powered by Kunena Forum