Variant code not updating?

  • Posts: 10
  • Thank you received: 0
9 years 9 months ago #189070

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6

Hey guys I have a strange one, I've noticed that when I create a NEW product and save it, then change the product code my variants codes update correctly, However when I copy a product and change the product code the variant code does not update for some reason.

Is there anyway I could fix this as I have a tonne of products I'd like to add which all have the same price and variants, just different images etc so the copy feature is perfect for me.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 9 months ago #189081

Hi,

It's because the system which updates the variants code bases itself on the fact that the variants code have a specific format. When you copy a product, it's variants have a _copyXXXX text appended to the variants code which makes it impossible for the system to updates the variants code to do its magic.
Change the line:
$copy->product_code = $copy->product_code.'_copy'.rand();
to:
$copy->product_code = str_replace($this->template->product_code,$newProduct->product_code,$copy->product_code);
in the file administrator/components/com_hikashop/helpers/import.php and that should avoid the issue for new products you copy after the change.

The following user(s) said Thank You: dc10555

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

  • Posts: 10
  • Thank you received: 0
9 years 9 months ago #189140

nicolas wrote: Hi,

It's because the system which updates the variants code bases itself on the fact that the variants code have a specific format. When you copy a product, it's variants have a _copyXXXX text appended to the variants code which makes it impossible for the system to updates the variants code to do its magic.
Change the line:
$copy->product_code = $copy->product_code.'_copy'.rand();
to:
$copy->product_code = str_replace($this->template->product_code,$newProduct->product_code,$copy->product_code);
in the file administrator/components/com_hikashop/helpers/import.php and that should avoid the issue for new products you copy after the change.


Thank so much this worked perfectly! It makes more sense for the system to process stuff like this especially for copying products, might be worth putting it in the next update? :P

*EDIT*
Ugh, I just realized you can do a mass product import using a preset product template and a CSV, Maybe it might be good idea to highlight this feature a bit more so it stands out as I think it's a little lost down at the bottom.

Last edit: 9 years 9 months ago by dc10555.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 9 months ago #189156

It's already applied on our end for next release yes.

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

Time to create page: 0.057 seconds
Powered by Kunena Forum