csv import of variants deletes existing

  • Posts: 250
  • Thank you received: 7
  • Hikashop Business
4 months 1 week ago #300338

-- url of the page with the problem -- : www.artistpapers.co.uk/shop/drawing-and-...ned-mixed-media-pads
-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.12

My site uses variants extensively and I populated it largely by using csv import which originally worked well. I put all my product images in the hikashop upload folder and reference them in the csv.

I wanted to add some new variants to a product and prepared a csv file with the new data and imported it. I usually set most of the import parameters to "no" in that I don't want the import changing anything existing on the site and the import routine reported four new product added which is all good. However after import I could see my four new variants listed on the front end complete with images, but the original 8 variants had disappeared. No problem I thought, I'll repeat the process but with all the variants in the csv. This time I imported all twelve variants and they were all listed but had lost their images, they were showing the default image. I had to repair this by going through and manually selecting the images.

The csv file with all the variants is attached, initially it just contained the last four which are the new ones.

File Attachment:

File Name: 400SeriesT...edia.csv
File Size:2 KB


I hope you can offer an explanation as to why this could happen.

Thanks,

Ian

Attachments:

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

  • Posts: 65116
  • Thank you received: 9456
  • MODERATOR
4 months 1 week ago #300343

Hi,

The fact that it removed the 8 previous variants is normal.
This is a feature so that you can not only add new variants but also remove the ones you don't want anymore through the import system.
Regarding the images, that's normal that you lost them too. When a product or a variant is deleted, the system checks that for each image attached to it, it is not attached to another product/variant and if that's the case, it deletes the image.
This is so that the upload folder where the images are stored does not get exessively big with lot of images being there while not being used. It's possible to change that behavior thanks to a hidden setting, by adding an entry with the namekey "keep_category_product_images" and the value "1" in the hikashop_config table through your phpmyadmin.

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

  • Posts: 250
  • Thank you received: 7
  • Hikashop Business
4 months 1 week ago #300359

Hi Nicolas,

Thank you for the explanation, at least I know now I'm not going mad!

I think there really should be some warning though that that is about to happen, it isn't even reported in the post import message that variants and / or images have been deleted which left me wondering what was going on. It would be great if there could be an option on the import screen to switch on or off the deletion of variants, and on / off the deletion of unused images. Having a hidden configuration file option isn't really good enough.

Also with images, I imported my four new variants and they displayed with images but the original variants went missing so I then imported a file with all the variants (old and new) and all the images went missing so I had to add them all back in manually. This means there is no way of adding variants without deleting all the images. This isn't very helpful!

Ian

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

  • Posts: 65116
  • Thank you received: 9456
  • MODERATOR
4 months 1 week ago #300420

Hi,

1. An option to avoid deleting variants during the import is a good idea. We'll look at adding that.

2. No, you should be able to add variants with images. You must be missing something between the image file name in the CSV and the file name in the upload directory or something like that. At least, it works fine on my end when I try.

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

  • Posts: 250
  • Thank you received: 7
  • Hikashop Business
4 months 1 week ago #300431

Thanks for your reply Nicolas.

I am absolutely certain that the paths to images were correct in the file because they all worked at one point, just never together.

1) Did my first import when the site was first setup - image filenames in csv, 8 variants all listed with correct images.

2) Wanted to add four more variants - put new images in upload folder and image filenames in new csv, imported csv - four new variants with correct images, but the eight original variants had disappeared.

3) Combined the csv's from 1 & 2 by copying and pasting contents of 2 into 1, so csv now with 12 variants, image filenames same as before. Import csv. This time all twelve variants are listed but NONE of them have images.

Very odd!

Ian

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

  • Posts: 65116
  • Thank you received: 9456
  • MODERATOR
4 months 1 week ago #300437

Hi,

Yes, that's strange. The fact that the first 8 variants would be missing the images after point 3 is normal since the images were removed when you did point 2, but the last 4 variants should still have had there images.

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

Time to create page: 0.071 seconds
Powered by Kunena Forum