Skip to main content

Major error with duplicate product_code

9 years 11 months ago #255852 by PeterChain
-- HikaShop version -- : 2.6.4
-- HikaMarket version -- : 1.7.2
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6.25
-- Browser(s) name and version -- : All browsers
-- Error-message(debug-mod must be tuned on) -- : Duplicate entry 'MON-0002' for key 'product_code' SQL=UPDATE `#__hikashop_product` SET `product_name`='Name',`product_code`='MON-0002',`product_quantity`='-1',`product_manufacturer_id`='',`product_published`='1',`product_vendor_id`='1',`product_page_title`='',`product_url`='',`product_meta_description`='',`product_keywords`='',`product_alias`='name',`product_canonical`='',`product_tax_id`='',`product_msrp`='0.0000000',`product_min_per_order`='0',`product_max_per_order`='0',`product_sale_start`='',`product_sale_end`='',`product_warehouse_id`='',`product_weight`='0.000',`product_weight_unit`='kg',`product_length`='0.000',`product_width`='0.000',`product_dimension_unit`='m',`product_height`='0.000',`testcustomfield`='',`product_access`='all',`product_type`='main',`product_description`='',`product_modified`='1479818869' WHERE `product_id`='53'

We found two major errors with the handling of duplicated product code.

FIRST

When Hikamarket multivendor settings -> main -> main options -> Avoid duplicate product code is SET TO NO



if I create a new product from scratch and use an already existing product_code a message shows warning of:

A product with the same code already exists

This seems to me wrong as the settings are reacting the opposite of its label indication "Avoid duplicate product code"



If I duplicate an already existing product and then I remove the _copy384756 suffix so the product_code gets back to match the original product_code then I get an horrible CRASH SCREEN as the one attached here:



The only thing that to my understanding is working is when the Avoid duplicate product code is set to YES as then the system by its own aggregates the product_id as a suffix to the product_code.

Anyhow I think (but this is only my interpretation of how it should work) the user should be warned of this product_code mutation automatically been made when the product is saved.

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

9 years 11 months ago #255855 by Jerome
Hi,

The HikaShop check for the product code has been moved in a different function ; so that check is no more called when HikaMarket ask HikaShop to save the product.
So I will add a patch to perform the verification even if the "avoid product duplication" is set.

Now please note that :
* If you do not provide a product code, that code is generate automatically by HikaShop during the save ; no previous check can be done.
* If you do not activate the setting "avoid product duplication", HikaMarket won't perform any check on the product code and will pass the data to HikaShop to perform the save.
* The setting "avoid product duplication" is there to change the "product code" if there is already the same code in the database ; but it requires that the product code is provided and enter by the user.
* There is also a setting to put a prefix on vendor products.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: PeterChain

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

Moderators: Obsidev
Time to create page: 0.069 seconds
Powered by Kunena Forum