delete all products

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 anos atrás
Hi there
v3.9
is there a quick way to delete all products from the database?
im using query express
ive imported thousands wrongly so prefer not to do it from the back office as its a bit slow!
thanks!
6 anos atrás
Find associated reference key tables and first delete items from it,

Delete from GiftCard where PurchasedWithOrderItemId in (select id from Product)


And then delete products.


Update Product set Deleted = 1  --soft delete

OR

Delete Product  
6 anos atrás
perfect. thanks !!
6 anos atrás
Hi there
v3.9
when i delete all the products and then re import products the product url then becomes -2
as if the site still remembers the original product. as i dont want the "2" version of the url have i missed a step in the deletion process?
i.e.

url looks like

http://www.tonerkit.fr/en/samsung-xpress-c428w-compatible-toner-cartridge-black-2

it should be

http://www.tonerkit.fr/en/samsung-xpress-c428w-compatible-toner-cartridge-black

Thanks !
6 anos atrás
toadman wrote:
Hi there
v3.9
when i delete all the products and then re import products the product url then becomes -2
as if the site still remembers the original product. as i dont want the "2" version of the url have i missed a step in the deletion process?
!

Hi,

This is because slug still present in UrlRecord table.
-1,-2 indicates same name multiple times.

If you don't want to display it, then just delete the UrlRecord for products.

To specifically delete one product slug:


Delete from UrlRecord where EntityId = [product id here]


To Delete all products slug:


Delete from UrlRecord where EntityName = 'Product'



Noted: delete products first and then remove slug, otherwise you may face same issue  

Hope this helps!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.