Jump to content

Any Way To Avoid Duplicate Sku (Product Reference)?


Recommended Posts

Hi,

 

Is there any way to avoid duplication of product SKU (reference)? The reason is that all my products should have unique sku's

 

For example if I have a "Superb Test Product 1" with reference "stp1" and than I would like to create new product "Superb Test Product 2" which should have unique reference like "stp2". But what if I accidentally set the same SKU? In this case I would like Prestashop not to allow me to save the product, instead I would like to see the error like "warning! duplicated reference field!"

 

Is it possible to do something like that? Thanks

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi

you may check duplicated products depending on reference by execute this sql statement on product table and delete duplicated item manually

 

SELECT `reference`,

COUNT(`reference`) AS duplicated

FROM aaa_product

GROUP BY `reference`

HAVING ( COUNT(`reference`) > 1 )

  • Like 2
Link to comment
Share on other sites

  • 8 months later...

What about a simple workaround to add a uniqe index on reference column?

Off course in the first instance you need to make an order in references, then it should be possible to add unique index. When this index is applied db will not allow on another product with same reference.

Link to comment
Share on other sites

  • 9 months later...
  • 2 weeks later...
×
×
  • Create New...