CSV Import of Variants, pricing not updated

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #146797

-- url of the page with the problem -- :www.safec.co.uk
-- HikaShop version -- :2.3.0
-- Joomla version -- : 2.5.16
-- PHP version -- :5.2.6
-- Browser(s) name and version -- : Chrome

I am creating import files for a number of products that have extensive numbers of variants. Each variant has a price and a parent product that already exists. Most of the time the import works fine. In some cases however the import appears to work but prices are not updated. I have put debugging on and I can see the select and delete statements from the queries. When I look at the price table after looking at the variants in the administrator I notice that the variants are not loaded properly, they appear to have been deleted.

I am trying to understand what is different with the failing cases. I know that there are some variants that do have a null characteristic price causes the import to fail? My process is to set all variants to unpublished and then import with a published = 1 for the imported products.

I see in the debugging some deletes from the price table - are these done for the unpublished records?

I have an import file to view

File Attachment:

File Name: hca20bf0.csv
File Size:54 KB


thanks for any tips


Ian

Attachments:

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

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #146849

Further to my last update

I have now identified that the import works and the pricing works, but I have been checking it in the product Manage Variants and checking the debug code I can see that the Manage Variants is doing a delete from product and product_price hence me seeing no data.

I have used PHP Mysql to prove the data is there and I can see the variants so long as I do not do a Manage Variants.

Is there a logic issue here, does the manage Variants not check to see if there are logical children in place?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 8 months ago #147138

Hi,

I am sorry but I don't visualize the problem with the variant.
Could you provide some screenshot in order to show us the trouble with this "manage variant" and the "missing variants" ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #147147

To be specific

Using the import file above, the import does not complete as follows:-

1. In Hikashop_product The product_parent_id is sometimes left null and I have had to tidy it up using PHP Myadmin
2. In Hikashop_price The product_price_value is not always created

Is this because if a product uses a characteristic that has say 25 variants from a 5 x 5 matrix and I only import 15 as some do not apply to this product does this cause a problem with the code?

What I have been doing is creating the product, selecting the characteristics, marking all variants as unpublished and then importing published variants, but this solution works inconsistently.

I now have two "broken" products in the system that do not show all characteristics See FBP-All and FBP-All2 as examples I have fixed up the parent ids and checked that there are product_prices for each and viewed the variant records from the front end and yet they are still "broken"

You can see on the import file that I point to the parent by name, but I have also tried doing it by parent_id numeric and this does not improve the reliability. Could you first check the import file above and see if it is properly constructed?

thanks

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

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #148576

I still have this problem on import

hikashop_product
Product ID = 85383

when imported has no parent_product_id
I fixed wthis manually with phpmyadmin set to 84570

In the front end I can see the product but it has Free against it (W600 H 500)

I look in hikashop_price and can see that product_id 85383 has a correct price in that table 104.49 per the import CSV

so my question is can someone take a look at my import file and process and let me know what is incorrect.
I have truncated it for easier troubleshooting (attached)

This product import in particular has caused me much trouble, I am trying to see what is different could it be some hidden escape characters? I have removed the / from the import to test?

Aidez mois SVP

Attachments:

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

  • Posts: 45
  • Thank you received: 0
10 years 8 months ago #148603

I run into the same or similar problem. I found out the following: in case the main product is in the same file as the variant, the import works OK. In case only the variant is updated and the main is not in the .csv file, the product_parent_id is not filled in.

This loads OK:

product_name;product_code;product_type;product_parent_id;char_package;price_value
lekkere wijn;lekkere_wijn;main;;;
;lekkere_wijn_fles;variant;lekkere_wijn;Fles;3.45

This is not OK:
product_name;product_code;product_type;product_parent_id;char_package;price_value
;lekkere_wijn_fles;variant;lekkere_wijn;Fles;3.45

In PhPMyAdmin I can see that the import of the variant is done, but the parent_id is not set.

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

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #148659

I agree that the parent ID can only be updated if the system knows explicitly or by reference which product the variants refer to.

In my example though the parent ID is SOMETIMES updated and sometimes not even though I use the same data file. So something seems to abort the import without an error message. As I say I can fix this manually, however even when fixed, the characteristic pricing does not appear at the front end even though I can see a variant price in the Hikashop_price table.

Is there another table relationship between product, variant and price?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 8 months ago #148583

Hi,

I don't see any column for the characteristic name in your CSV. When you import products with variants, you need to have a column for each characteristic of the product and for each variant you need to have in that column the corresponding value of the characteristic.
And in the main product, you need to have the default value of the characteristic.
Without that information, the system is not able to match the variants with the characteristic of the product and thus it fails to set the variants of the product.

If you look at our documentation on the import process, we explain that principle:
www.hikashop.com/support/support/documen...hikashop-import.html
Also, if you click on the "export" button of your products listing, you'll get a CSV example of what should be done to import the products you have already created and you'll see that you have a column for each characteristic and that the column is filled according to my explanation.

That should hopefully help you understand why it doesn't work.

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

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #148767

Nicolas

The Two characteristics that drive the code are Width and Height

They are both within the file and contain values for each that match the product_code.

However I have now checked the export file and see that I have on this version of the file - incorrectly formatted them without the mm and in the export file I can see that they are imported (Because of the correctly formatted product code - but not properly associated with the characteristic) So I am getting warm.

I will report back

Thank you
Ian

Last edit: 10 years 8 months ago by IRedsell.

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

  • Posts: 16
  • Thank you received: 0
10 years 8 months ago #149110

Aha - the answer was as ever simple but hard to find

Someone had introduced a custom field called Height and this is why the imports stopped working, I have also explicitly told the import file what the parent product IDs are for the avoidance of doubt and the import now works reliably again

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

  • Posts: 13201
  • Thank you received: 2322
10 years 8 months ago #149112

Hi,

Indeed a custom field with this kind of name can broke the import.
Thanks to have shared your solution. This will help other users.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum