i have more than 10000 products :shock: in my cs-cart website ,each one of them has product code :confused: , i want to prevent duplicate product code when admin insert new product with product code already used with other product :confused: ????
Why not just make an index in the cscart_products table making product_code unique? I.e. any new insert (or update of a product) using a duplicate product_code would simply fail at the SQL level.
The SQL INSERT/UPDATE would fail. However, for import/export, cs-cart ignores SQL errors and does not report them. In the UI, you'd get the failure. Try it. If you don't like how it behaves (versus silently setting "$can_update = false") then you can simply drop the index and go back to how you are or using the hook above.
Note that if you have made the product_code column unique, you will have to make adjustments to the clone code to alter the product code like it does for page titles, product names, etc. by probably adding "[CLONE}" to it.
Thanks eCom-Labs for your contribution. However, this doens't work on my store - MV. Is it no longer working for latest MV editions? Or would it be a cache issue (I don't know if PHP files are being cached).
Hmm.. It works on my local installation with the latest Multi-Vendor version
That's weired! I tried updating the fn.catalog.php directly with no luck. The results are the same as I have NOT added any code. In fact, I have set the variable $can_update in the beginning of the function (line 2495) from true to false just for checking. Still everthing works as I have dont nothing!
That's weired! I tried updating the fn.catalog.php directly with no luck. The results are the same as I have NOT added any code. In fact, I have set the variable $can_update in the beginning of the function (line 2495) from true to false just for checking. Still everthing works as I have dont nothing!
Did you set the code after hook? 3rd party addons can override it and set to true somewhere