Announcement

Collapse
No announcement yet.

Deleting variants

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Deleting variants

    Hi folks --

    I was just working on a module project that calls Product_Delete(), and I was surprised to find that if I did this to a product with attributes and variants, the variants were not deleted. As a check, I tried the same thing on the admin pages: create a master product with attributes, auto-generate variants, and then delete the master. In this case, too, the variants were left behind.

    Is that correct behavior? It seems counter-intuitive to leave the variants behind; aren't they useless without a master?

    Suppose I create a new master product with the same code as the one I deleted: will the orphan variants be automatically linked to the new master?

    Inquiring minds want to know ... Thanks --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    #2
    Re: Deleting variants

    Originally posted by Kent Multer View Post
    Hi folks --

    I was just working on a module project that calls Product_Delete(), and I was surprised to find that if I did this to a product with attributes and variants, the variants were not deleted. As a check, I tried the same thing on the admin pages: create a master product with attributes, auto-generate variants, and then delete the master. In this case, too, the variants were left behind.

    Is that correct behavior? It seems counter-intuitive to leave the variants behind; aren't they useless without a master?

    Suppose I create a new master product with the same code as the one I deleted: will the orphan variants be automatically linked to the new master?

    Inquiring minds want to know ... Thanks --
    The problem is that the variant is just an inactive product. You could run a check on the s0n_ProductVariants and s0n_ProductVariantParts tables and if the entry matches the product_id of the product being deleted delete that entry but the variant would still exist in the s0n_Products table.

    If you were to recreate the master product and attributes you could then generate the variants and relink the orphaned variants to that new master. It's not exactly automatic but it could be done.
    Last edited by Jim McCormick; 10-28-14, 12:06 PM. Reason: removed incorrect statement
    Jim McCormick
    Miva Merchant Support
    866-284-9812

    https://www.miva.com

    Comment

    Working...
    X