- Posts: 61
- Thank you received: 2
Multivendor Add product code duplicate issue
Scenario.
Add Product Form.
I have excluded Code from the ACL , I don't want clients to get too overwhelmed and confused.
Entry of the title, example. Test
There is already a product named Test existing. If gives the following error
A product with the same code already exists
Any simple way to add a sequential number to code section only of the product being uploaded to avoid this?
Please Log in or Create an account to join the conversation.
What do you mean with the "product being uploaded" ?
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
on save of product with the same title as existing product, Is there something i can do to have duplicate titles to have a different code?
ie..
Product 1
Title = Test Code = Test
Product 2
Title = Test Code = Test1
Product 3
Title = Test Code = Test2
Product 4
Title = Test Code = Test3
and so on ......
Please Log in or Create an account to join the conversation.
For the same vendor or for different vendors ?
Do you think that an option to set automatically a prefix for the vendor product codes could be interesting ?
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Your guys support is absolutely amazing i am going to say. Top Shelf
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I am working on a patch in the same time than the patch for the template data during saving.
I talked with Nicolas, we will see how to improve this product_code generation for HikaShop and HikaMarket.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Still working on the algorithm.
Creating an incremental suffix could be complicated because we have to load every product codes which have the same "pattern" and make a loop to find an available number.
So I am trying to just loading the last product code with the same "pattern", the product code with the higher number but you can have false positives.
For example if your product code is "test" and you have "test_1", "test_2" in your database. The last element will be "test_2" so the algorithm will work.
But if you have a product code "test_test" in your database, it will be retrieve as the last element during the sort, so we won't be able to find the right prefix.
I don't want to use a SQL "regex" because it will be too much. So if I don't find a number suffix for the last element in my query, I use the "product id" as the number in the suffix.
I have to make more test but it should abort the error message (and save the product).
I wondering if showing a notice message telling that the product code was already used so a new one has been generated, could be interesting.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I have finish to test the patch for the HikaMarket Product class.
You can add into the class file "administrator/components/com_hikamarket/classes/product.php" this new function:
You can use the new SQL query (replace "#_" by your database prefix. Like: "jos_hikamarket_config")
You can add a translation for the text "WARNING_DUPLICATE_PRODUCT_CODE_MODIFIED". If the translation is empty, no message will be displayed when a duplicate product code will be detect/modified.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Parse error: syntax error, unexpected T_PROTECTED in /home/*******/public_html/******/administrator/components/com_hikamarket/classes/product.php on line 93
Is the error I am getting on the site now
Please Log in or Create an account to join the conversation.
I think you paste the function in the wrong place in the file.
You have to paste it just after:
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Good to know.
The feature/function will be include in the next HikaMarket release, with the other new features.
Options will be introduce in the configuration part in order to activate it easily.
Thanks
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The solution would be to redirect the user to the product edition page just after the product creation.
So when the user will try to refresh the page, it will just refresh the product edition page, not the previous creation form.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.