[Skip to main content](#vessel-content)

#   Major error with duplicate product\_code

##

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

9 years 11 months ago [\#255852](#255852) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  *[Major error with duplicate product\_code](/forum/22-market-bug-report/887587-major-error-with-duplicate-product-code#255852 "-- 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&#95;code' SQL=UPDATE &#96;#&#95;&#95;hikashop&#95;product&#96; SET &#96;product&#95;name&#96;='Name',&#96;product&#95;code&#96;='MON-0002',&#96;product&#95;quantity&#96;='-1',&#96;product&#95;manufacturer&#95;id&#96;='',&#96;product&#95;published&#96;='1',&#96;product&#95;vendor&#95;id&#96;='1',&#96;product&#95;page&#95;title&#96;='',&#96;product&#95;url&#96;='',&#96;product&#95;meta&#95;description&#96;='',&#96;product&#95;keywords&#96;='',&#96;product&#95;alias&#96;='name',&#96;product&#95;canonical&#96;='',&#96;product&#95;tax&#95;id&#96;='',&#96;product&#95;msrp&#96;='0.0000000',&#96;product&#95;min&#95;per&#95;order&#96;='0',&#96;product&#95;max&#95;per&#95;order&#96;='0',&#96;product&#95;sale&#95;start&#96;='',&#96;product&#95;sale&#95;end&#96;='',&#96;product&#95;warehouse&#95;id&#96;='',&#96;product&#95;weight&#96;='0.000',&#96;product&#95;weight&#95;unit&#96;='kg',&#96;product&#95;length&#96;='0.000',&#96;product&#95;width&#96;='0.000',&#96;product&#95;dimension&#95;unit&#96;='m',&#96;product&#95;height&#96;='0.000',&#96;testcustomfield&#96;='',&#96;product&#95;access&#96;='all',&#96;product&#95;type&#96;='main',&#96;product&#95;description&#96;='',&#96;product&#95;modified&#96;='1479818869' WHERE &#96;product&#95;id&#96;='53'  We found two major errors with the handling of duplicated product code.  FIRST  When Hikamarket multivendor settings -&gt; main -&gt; main options -&gt; Avoid duplicate product code is SET TO NO  if I create a new product from scratch and use an already existing product&#95;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 &quot;Avoid duplicate product code&quot;  If I duplicate an already existing product and then I remove the &#95;copy384756 suffix so the product&#95;code gets back to match the original product&#95;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&#95;id as a suffix to the product&#95;code.  Anyhow I think (but this is only my interpretation of how it should work) the user should be warned of this product&#95;code mutation automatically been made when the product is saved.")* was created by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")*

-- 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 &#96;#__hikashop_product&#96; SET &#96;product_name&#96;='Name',&#96;product_code&#96;='MON-0002',&#96;product_quantity&#96;='-1',&#96;product_manufacturer_id&#96;='',&#96;product_published&#96;='1',&#96;product_vendor_id&#96;='1',&#96;product_page_title&#96;='',&#96;product_url&#96;='',&#96;product_meta_description&#96;='',&#96;product_keywords&#96;='',&#96;product_alias&#96;='name',&#96;product_canonical&#96;='',&#96;product_tax_id&#96;='',&#96;product_msrp&#96;='0.0000000',&#96;product_min_per_order&#96;='0',&#96;product_max_per_order&#96;='0',&#96;product_sale_start&#96;='',&#96;product_sale_end&#96;='',&#96;product_warehouse_id&#96;='',&#96;product_weight&#96;='0.000',&#96;product_weight_unit&#96;='kg',&#96;product_length&#96;='0.000',&#96;product_width&#96;='0.000',&#96;product_dimension_unit&#96;='m',&#96;product_height&#96;='0.000',&#96;testcustomfield&#96;='',&#96;product_access&#96;='all',&#96;product_type&#96;='main',&#96;product_description&#96;='',&#96;product_modified&#96;='1479818869' WHERE &#96;product_id&#96;='53'

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

**FIRST**

When Hikamarket multivendor settings -&gt; main -&gt; main options -&gt; Avoid duplicate product code is **SET TO NO**

[ ![Capturadepantalla2016-11-22ales13.39.15.png](/forum/attachment/34747) ](/forum/attachment/34747 "...es13.39.15.png")

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"

[ ![Capturadepantalla2016-11-22ales13.46.22.png](/forum/attachment/34748) ](/forum/attachment/34748 "...es13.46.22.png")

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:

[ ![Capturadepantalla2016-11-22ales13.37.42.png](/forum/attachment/34749) ](/forum/attachment/34749 "...es13.37.42.png")

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.

- [ ![Capturadepantalla2016-11-22ales13.39.15.png](/forum/attachment/34747) ](/forum/attachment/34747 "...es13.39.15.png") [ ](/forum/attachment/34747?download=1 "...es13.39.15.png")
- [ ![Capturadepantalla2016-11-22ales13.46.22.png](/forum/attachment/34748) ](/forum/attachment/34748 "...es13.46.22.png") [ ](/forum/attachment/34748?download=1 "...es13.46.22.png")
- [ ![Capturadepantalla2016-11-22ales13.37.42.png](/forum/attachment/34749) ](/forum/attachment/34749 "...es13.37.42.png") [ ](/forum/attachment/34749?download=1 "...es13.37.42.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIyLW1hcmtldC1idWctcmVwb3J0Lzg4NzU4Ny1tYWpvci1lcnJvci13aXRoLWR1cGxpY2F0ZS1wcm9kdWN0LWNvZGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 11 months ago [\#255855](#255855) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Major error with duplicate product\_code](/forum/22-market-bug-report/887587-major-error-with-duplicate-product-code#255855 "-- 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&#95;code' SQL=UPDATE &#96;#&#95;&#95;hikashop&#95;product&#96; SET &#96;product&#95;name&#96;='Name',&#96;product&#95;code&#96;='MON-0002',&#96;product&#95;quantity&#96;='-1',&#96;product&#95;manufacturer&#95;id&#96;='',&#96;product&#95;published&#96;='1',&#96;product&#95;vendor&#95;id&#96;='1',&#96;product&#95;page&#95;title&#96;='',&#96;product&#95;url&#96;='',&#96;product&#95;meta&#95;description&#96;='',&#96;product&#95;keywords&#96;='',&#96;product&#95;alias&#96;='name',&#96;product&#95;canonical&#96;='',&#96;product&#95;tax&#95;id&#96;='',&#96;product&#95;msrp&#96;='0.0000000',&#96;product&#95;min&#95;per&#95;order&#96;='0',&#96;product&#95;max&#95;per&#95;order&#96;='0',&#96;product&#95;sale&#95;start&#96;='',&#96;product&#95;sale&#95;end&#96;='',&#96;product&#95;warehouse&#95;id&#96;='',&#96;product&#95;weight&#96;='0.000',&#96;product&#95;weight&#95;unit&#96;='kg',&#96;product&#95;length&#96;='0.000',&#96;product&#95;width&#96;='0.000',&#96;product&#95;dimension&#95;unit&#96;='m',&#96;product&#95;height&#96;='0.000',&#96;testcustomfield&#96;='',&#96;product&#95;access&#96;='all',&#96;product&#95;type&#96;='main',&#96;product&#95;description&#96;='',&#96;product&#95;modified&#96;='1479818869' WHERE &#96;product&#95;id&#96;='53'  We found two major errors with the handling of duplicated product code.  FIRST  When Hikamarket multivendor settings -&gt; main -&gt; main options -&gt; Avoid duplicate product code is SET TO NO  if I create a new product from scratch and use an already existing product&#95;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 &quot;Avoid duplicate product code&quot;  If I duplicate an already existing product and then I remove the &#95;copy384756 suffix so the product&#95;code gets back to match the original product&#95;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&#95;id as a suffix to the product&#95;code.  Anyhow I think (but this is only my interpretation of how it should work) the user should be warned of this product&#95;code mutation automatically been made when the product is saved.")*

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 &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIyLW1hcmtldC1idWctcmVwb3J0Lzg4NzU4Ny1tYWpvci1lcnJvci13aXRoLWR1cGxpY2F0ZS1wcm9kdWN0LWNvZGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.085 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
