Announcement

Collapse
No announcement yet.

to auto auto-generate inventory variants

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

    to auto auto-generate inventory variants

    Client has about 2K of products with variants. Now, needs to turn on Inventory in the attributes and then auto-generate the inventory variants. The balance would be to import the inventory, so that isn't an issue.

    Is there a way to auto generate inventory variants with an import step? Or, does this need to be done manually for all products with variants?

    Thanks,

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    Re: to auto auto-generate inventory variants

    We've done this before by generating an XML file which will auto generate the variants. We create a new page template which uses the sitemap item to loop though all products an output the correct XML provisioning code. Then we just import the XML file.

    Here is an example:


    Code:
    <mvt:foreach iterator="product" array="products">
    <mvt:item name="product_attributes" param="product:id" />
    <!– Generate Variants –>
    <ProductVariant_Generate product_code="&mvt:product:code;" pricing_method="master" delimiter="_" />
    </mvt:foreach>
    Then in the product attribute template:
    Code:
    <!– Turn ON inventory for all attributes –>
    <mvt:foreach iterator="attribute" array="attributes">
    <ProductAttribute_Update product_code="&mvt:product:code;" attribute_code="&mvte:attribute:code;">
    <Inventory>Yes</Inventory>
    </ProductAttribute_Update>
    </mvt:foreach>
    The nice part about this is if a product does not have attributes, the ProductVariant_Generate XML tag just ignores the product and moves on to the next one.
    Here is the sample output:




    Code:
    <ProductAttribute_Update product_code="21626" attribute_code="alpha">
    <Inventory>Yes</Inventory>
    </ProductAttribute_Update> <!– Generate Variants –>
    <ProductVariant_Generate product_code="21626" pricing_method="master" delimiter="_" />
    <!– Turn ON inventory for all attributes –>
    <ProductAttribute_Update product_code="32861" attribute_code="COLOR">
    <Inventory>Yes</Inventory>
    </ProductAttribute_Update> <!– Generate Variants –>
    <ProductVariant_Generate product_code="32861" pricing_method="master" delimiter="_" />
    <!– Turn ON inventory for all attributes –>
    <ProductAttribute_Update product_code="35872" attribute_code="color">
    <Inventory>Yes</Inventory>
    </ProductAttribute_Update> <!– Generate Variants –>
    <ProductVariant_Generate product_code="35872" pricing_method="master" delimiter="_" />
    <!– Turn ON inventory for all attributes –>
    <ProductAttribute_Update product_code="32053" attribute_code="COLOR">
    <Inventory>Yes</Inventory>
    </ProductAttribute_Update> <!– Generate Variants –>
    <ProductVariant_Generate product_code="32053" pricing_method="master" delimiter="_" />
    <!– Turn ON inventory for all attributes –>
    <ProductAttribute_Update product_code="39191" attribute_code="color">
    <Inventory>Yes</Inventory>
    </ProductAttribute_Update> <!– Generate Variants –>
    <ProductVariant_Generate product_code="39191" pricing_method="master" delimiter="_" />
    Last edited by Brennan; 11-26-14, 12:01 PM.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    Working...
    X