HomeHome Product Discus... Product Discus...SmithCartSmithCartClearing out all variants. Easy way to accomplish?Clearing out all variants. Easy way to accomplish?
Previous
 
Next
New Post
8/13/2013 1:55 PM
 
Hello - 

I recently did a re-import of product data on my site to include the new image alt tag and related products field data. While doing so, I was unaware of the fact that if you import product variants on a product that already has them, it will create duplicates of all the variants.

So now I've got about 400 products with double variants. It would be an extremely grueling task to clean this up manually. Is there a script I can run against my database to clear out all product variants? Once all products have had their variants removed, I can easily re-import the spreadsheets to get them back to their original status.

Thanks a bunch! This will help a ton!

Alex
 
New Post
8/14/2013 10:59 AM
 
Hi Alex,
To delete your variants you would need to issue a sql delete statement on the following tables for the variants you want to delete:
  1. Smith_ProductVariant
  2. Smith_ProductVariantGroup
  3. Smith_ProductVariantInventory
  4. Smith_ProductVariantInvLinker
The SQL delete statement would look something like this (replace the variantid's with your variantid's):

delete * from smith_productvariant where variantid in (1,2,3,4)

Important: Please make sure you have a full database backup before issuing any delete statements in case you need to rollback.

Hope this helps!



Scott Kelly
Project Manager
DotNetNuke Consulting, DotNetNuke Store and DNN Ecommerce
 
New Post
8/22/2013 11:43 AM
 
Thanks Scott - this worked perfectly!
 
New Post
8/22/2013 3:46 PM
 
Glad to hear this solution worked for you Alex!
 
Previous
 
Next
HomeHome Product Discus... Product Discus...SmithCartSmithCartClearing out all variants. Easy way to accomplish?Clearing out all variants. Easy way to accomplish?