I did an export/import, and the import ended up creating new product records. I was going to restore my DB backup, but I'm getting some SQL error with that. Can I just do a DELETE FROM ac_Products WHERE ProductId < N? Will deletes cascade properly? If not, should I delete from other related tables, too?
It would be so much easier than figuring out why SQL Server is complaining. I've never seen the error before, and I've never really worked with this server before, so I don't know if it has issues.
Thanks,
Seth
Import created duplicate products
Re: Import created duplicate products
If you want to delete products from store better make use of AbleCommerce API to carryout this job. Here is a code snippet that can delete all products from store
if you want to delete all products having product id less then some numeric value.
All you need to do is to place this code at some location from where you can trigger it. With this approach API will take care of cascading product associations.
Code: Select all
foreach (Product product in Token.Instance.Store.Products)
product.Delete();
Code: Select all
int numaricValue = 7777;
foreach (Product product in Token.Instance.Store.Products)
if (product.ProductId < numaricValue)
product.Delete();