Announcement

Collapse
No announcement yet.

Another Inventory Variants twist

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

    Another Inventory Variants twist

    Got a new twist to see if it's doable - displaying a product's inventory variants on the product page with the ability to use quantity boxes.

    For example product A has 3 Invenory Variants A1, A2, A3 - currently the only way I've been using the Inventory Variants is with a drop down select list. This means I can only only order the quantity for the product. I can't have 3 of A1 and 6 of A3 unless A1 and A3 are not attributes but products and then they would have seperate product pages.

    Leslie
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    Re: Another Inventory Variants twist

    Hey Leslie -

    It sounds like you need the ability to add multiple attributes to the cart with a single click.

    We do it here: http://www.bedbathhome.com/EleganceWHITE/elegance-voile-white-sheer-curtain.html

    T
    his uses Sebenza's Product Template Manger. It has a built in feature that allows you to turn radio buttons to quantity boxes which can add multiple attributes to the cart with a single click.

    When you buy the module it comes with some sample code on how to implement this.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Re: Another Inventory Variants twist

      LOL - I love the Sebenza Template modules, use them all the time. I was trying to push the "out-of-the-box" envelope again.
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        Re: Another Inventory Variants twist

        Originally posted by Brennan View Post
        Hey Leslie -

        It sounds like you need the ability to add multiple attributes to the cart with a single click.

        We do it here: http://www.bedbathhome.com/EleganceWHITE/elegance-voile-white-sheer-curtain.html

        T
        his uses Sebenza's Product Template Manger. It has a built in feature that allows you to turn radio buttons to quantity boxes which can add multiple attributes to the cart with a single click.

        When you buy the module it comes with some sample code on how to implement this.
        Have you attempted this at the category page level and just double checking - it will work with the Inventory Variants?
        Leslie Kirk
        Miva Certified Developer
        Miva Merchant Specialist since 1997
        Previously of Webs Your Way
        (aka Leslie Nord leslienord)

        Email me: [email protected]
        www.lesliekirk.com

        Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

        Comment


          #5
          Re: Another Inventory Variants twist

          Originally posted by Brennan View Post
          Hey Leslie -

          It sounds like you need the ability to add multiple attributes to the cart with a single click.

          We do it here: http://www.bedbathhome.com/EleganceWHITE/elegance-voile-white-sheer-curtain.html

          T
          his uses Sebenza's Product Template Manger. It has a built in feature that allows you to turn radio buttons to quantity boxes which can add multiple attributes to the cart with a single click.

          When you buy the module it comes with some sample code on how to implement this.
          Hey Brennan,

          I'm looking at the code in the attribute_quantity_example.txt file that I already had (and was resent to me) - I'm not seeing how to turn the radio buttons into quantity boxes based on the code in the attribute_quantity_example.txt - but I could be doing something wrong too. But it seems to only add a quantity box next to the radio buttons instead of turning them into quantity boxes.

          Leslie
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment


            #6
            Re: Another Inventory Variants twist

            Leslie,

            In order for this functionality to work there are some modifications that you will need to make to the attribute_quantity_example.txt that are undocumented. Below are the changes and an explanation of what they are doing.

            First I want you to know that there are some restrictions when using this functionality. You can not have multiple types of attributes and use this functionality. For example Product A has attribute 1 (radio) with three options and has attribute 2 (checkbox) with two options. This will not work because of the way that this functionality processes the information.

            In order for this functionality to work you will need to change the hidden value from ATTRQTY to OPTQTY. This new action lets Miva know that you are passing option quantities and not attribute quantities. And unfortunately you can not pass two actions at once so it is either one or the other.

            Also these changes will affect all attributes that are assigned as radio buttons. If you would like to only affect certain radio button attributes you will need to add some additional code. If this is something that you would like to do let me know and I will post the additional changes.

            That being said here are the changes to the attribute_quantity_example.txt that you will need to make.

            1. First you will need to remove the hidden action from the first line of the form and add the if statement below right after the Product_Attribute_Count hidden input field which is located after the end of the attribute foreach loop.

            Code:
            <mvt:if expr="l.settings:attr:type EQ 'radio'">
                <input type="hidden" name="Action" value="OPTQTY">
            <mvt:else>
                <input type="hidden" name="Action" value="ATTRQTY">
            </mvt:if>
            This if statement is checking if the attribute is a radio button and if it is than it will change the Action to OPTQTY which will allow you to add multiple option quantities to the basket.

            2. Next you will need to replace the radio if statement with the following code:

            Code:
                <mvt:if expr="l.settings:attr:type EQ 'radio'">
                <mvt:item name="toolkit" param="sassign|current_nbr|0"/>
                    <mvt:foreach iterator="option" array="attr:options">
                    <tr>
                        <td valign="middle">
                            <mvt:item name="toolkit" param="counter|current_nbr" />
                            <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:value" id="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:value" value="&mvt:option:code;" />
                            &mvt:option:prompt;
                        </td>
                        <td valign="middle">
                            Quantity:
                            <input type="text" class="productQty attrQty" id="attrQty" name="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:quantity" id="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:quantity" value="0"/>                    
                        </td>
                    </tr>
                    </mvt:foreach>
                            
                    <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:code" value="&mvt:attr:code;">
                    
                    <mvt:if expr="NOT ISNULL l.settings:attr:template_code">
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:template_code" value="&mvt:attr:template_code;">
                    </mvt:if>
                </mvt:if>
            Here you are assigning a global variable to the option foreach loop using toolkit which will allow you to count the number of options in the attribute. This now allows us to add the option number to the hidden input so the quantity for that input can be passed to the basket.

            Here is what your new file should resemble:

            Code:
            <html>
            <head>
                <title>&mvt:store:name;: &mvt:product:name;</title>
                <base href="&mvt:global:basehref;">
                <mvt:item name="head" param="head_tag" />
            </head>
            
            
            <mvt:item name="body">
                <mvt:item name="hdft" param="global_header" />    
            
            
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr><td align="left" valign="bottom" colspan=2 >
                    <mvt:item name="navbar" />
                </td></tr>
                <tr><td align="left" valign="bottom"> 
                    <mvt:item name="hdft" param="header" />
                </td></tr>
            
            
                <tr><td align="left" valign="top" bgcolor="&mvt:colors:ctgy_bg;">
                    <table border="0" cellpadding="10" cellspacing="0">
                    <tr><td align="left" valign="top" nowrap>
                        <mvt:item name="fonts" param="ctgy_font">
                        <mvt:item name="customerlink" />
                        <mvt:item name="affiliatelink" />
                        <mvt:item name="category_tree" />
                        </mvt:item>
                    </td></tr>
                    </table>
                </td><td align="left" valign="top" width="80%">
                    <blockquote>
            
            
                    <mvt:item name="prod_ctgy_hdft" param="prod_header" />
            
            
                    <br>
                    <table border="0" cellpadding="5" cellspacing="0">
                    <tr><td align="left" valign="middle" colspan="2">
                        <mvt:item name="fonts" param="hdr_font">
                        <b>&mvt:product:name;</b>
                        </mvt:item>
                    </td></tr>
                    <tr><td align="left" valign="middle" colspan="2">&nbsp;</td></tr>
                    <tr><td align="center" valign="top" rowspan="5">
                        <mvt:if expr="NOT ISNULL l.settings:product:image">
                            <img src="&mvt:product:image;" alt="&mvt:product:name;">
                        <mvt:else>
                            &nbsp;
                        </mvt:if>
                    </td><td align="left" valign="top">
                        <mvt:item name="fonts" param="body_font">
                        Quantity in Basket:
                        <mvt:if expr="l.settings:product:quantity EQ 0">
                            <i>None</i>
                        <mvt:else>
                            <b>&mvt:product:quantity;</b>
                        </mvt:if>
                        <br>
                        Code: <b>&mvt:product:code;</b><br>
                        Price: <b>&mvt:product:formatted_price;</b><br>
                        <mvt:if expr="l.settings:product:weight NE 0">
                            Shipping Weight: <b>&mvt:product:weight;</b> &mvt:store:wtunits;<br>
                        </mvt:if>
                        <mvt:if expr="l.settings:product:inv_active">
                            &mvt:product:inv_long;
                        </mvt:if>
                        </mvt:item>
                    </td></tr>
                    <form method="post" action="&mvt:global:sessionurl;">
                    <input type="hidden" name="Screen" value="PROD">
                    <input type="hidden" name="Store_Code" value="&mvte:store:code;">
                    <input type="hidden" name="Product_Code" value="&mvte:product:code;">
                    <input type="hidden" name="Category_Code" value="&mvte:global:category_code;">
                    <tr><td>&nbsp;</td></tr>
                    <tr><td align="left" valign="top">
            
            
            <table border="0">
            <mvt:foreach iterator="attr" array="productattributes">
            
            
                <mvt:if expr="l.settings:attr:type EQ 'checkbox'">
                    <tr><td>
                        &nbsp;
                    </td><td valign="middle">
                        <mvt:if expr="l.settings:attr:required"><b></mvt:if>
            
            
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:value" value="Yes">
            
            
                        <input type="text" size="4" name="Product_Attributes[&mvt:attr:pos;]:quantity" value="0"> 
            
            
                        &mvt:attr:prompt;
            
            
                        <mvt:if expr="l.settings:attr:required"></b></mvt:if>
                    </td></tr>
            
            
                    <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:code" value="&mvt:attr:code;">
                    <mvt:if expr="NOT ISNULL l.settings:attr:template_code">
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:template_code" value="&mvt:attr:template_code;">
                    </mvt:if>
                </mvt:if>
            
            
                <mvt:if expr="l.settings:attr:type EQ 'select'">
                    <tr><td>
                        <mvt:if expr="l.settings:attr:required"><b></mvt:if>
            
            
                        &mvt:attr:prompt; : 
            
            
                        <mvt:if expr="l.settings:attr:required"></b></mvt:if>
                    </td><td valign="middle">
                        <select name="Product_Attributes[&mvt:attr:pos;]:value">
                        <option value="">< Select One ></option>
                        <mvt:foreach iterator="option" array="attr:options">
            
            
                            <mvt:if expr="g.Product_Attributes[l.settings:attr:pos]:value">
                                <mvt:if expr="g.Product_Attributes[l.settings:attr:pos]:value EQ l.settings:option:code">
                                    <option value="&mvt:option:code;" SELECTED>&mvt:option:prompt;</option>
                                <mvt:else>
                                    <option value="&mvt:option:code;">&mvt:option:prompt;</option>
                                </mvt:if>
                            <mvt:else>
                                <mvt:if expr="l.settings:attr:default_id EQ l.settings:option:id">
                                    <option value="&mvt:option:code;" SELECTED>&mvt:option:prompt;</option>
                                <mvt:else>
                                    <option value="&mvt:option:code;">&mvt:option:prompt;</option>
                                </mvt:if>
                            </mvt:if>
            
            
                        </mvt:foreach>
                        </select>
                    </td><td valign="middle">
                        <input type="text" size="4" name="Product_Attributes[&mvt:attr:pos;]:quantity" value="0"> 
                    </td></tr>
            
            
                    <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:code" value="&mvt:attr:code;">
            
            
                    <mvt:if expr="NOT ISNULL l.settings:attr:template_code">
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:template_code" value="&mvt:attr:template_code;">
                    </mvt:if>
                </mvt:if>
            
            
                <mvt:if expr="l.settings:attr:type EQ 'radio'">
                <mvt:item name="toolkit" param="sassign|current_nbr|0"/>
                    <mvt:foreach iterator="option" array="attr:options">
                    <tr>
                        <td valign="middle">
                            <mvt:item name="toolkit" param="counter|current_nbr" />
                            <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:value" id="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:value" value="&mvt:option:code;" />
                            &mvt:option:prompt;
                        </td>
                        <td valign="middle">
                            Quantity:
                            <input type="text" class="productQty attrQty" id="attrQty" name="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:quantity" id="Product_Attributes[&mvt:attr:pos;]:Option[&mvte:global:current_nbr;]:quantity" value="0"/>                    
                        </td>
                    </tr>
                    </mvt:foreach>
                            
                    <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:code" value="&mvt:attr:code;">
                    
                    <mvt:if expr="NOT ISNULL l.settings:attr:template_code">
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:template_code" value="&mvt:attr:template_code;">
                    </mvt:if>
                </mvt:if>
            
            
                <mvt:if expr="l.settings:attr:type EQ 'text'">
                    <tr><td>
                        <mvt:if expr="l.settings:attr:required"><b></mvt:if>
            
            
                        &mvt:attr:prompt; : 
            
            
                        <mvt:if expr="l.settings:attr:required"></b></mvt:if>
                    </td><td valign="middle">
                        <input type="text" size="40" name="Product_Attributes[&mvt:attr:pos;]:value" value="&mvt:attr:value;">
                    </td><td valign="middle">
                    </td></tr>
            
            
                    <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:code" value="&mvt:attr:code;">
                    <mvt:if expr="NOT ISNULL l.settings:attr:template_code">
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:template_code" value="&mvt:attr:template_code;">
                    </mvt:if>
                </mvt:if>
            
            
                <mvt:if expr="l.settings:attr:type EQ 'memo'">
                    <tr><td valign="top">
                        <mvt:if expr="l.settings:attr:required"><b></mvt:if>
            
            
                        &mvt:attr:prompt; : 
            
            
                        <mvt:if expr="l.settings:attr:required"></b></mvt:if>
                    </td><td valign="middle">
                        <textarea name="Product_Attributes[&mvt:attr:pos;]:value" rows="10" cols="58" WRAP="on">&mvt:attr:value;</textarea>
                    </td><td valign="middle">
                    </td></tr>
            
            
                    <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:code" value="&mvt:attr:code;">
                    <mvt:if expr="NOT ISNULL l.settings:attr:template_code">
                        <input type="hidden" name="Product_Attributes[&mvt:attr:pos;]:template_code" value="&mvt:attr:template_code;">
                    </mvt:if>
                </mvt:if>
            
            
            </mvt:foreach>
            
            
            <input type="hidden" name="Product_Attribute_Count" value="&mvt:attr_count;">
            <mvt:if expr="l.settings:attr:type EQ 'radio'">
                <input type="hidden" name="Action" value="OPTQTY">
            <mvt:else>
                <input type="hidden" name="Action" value="ATTRQTY">
            </mvt:if>
            
            
            </table>
            
            
                    </td></tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr><td align="left" valign="middle">
                        <mvt:item name="fonts" param="body_font">
                        <mvt:item name="buttons" param="AddToBasket" />
                        </mvt:item>
                    </td></tr>
                    </form>
                    <tr><td align="left" valign="middle" colspan="2">&nbsp;</td></tr>
                    <tr><td align="left" valign="middle" colspan="2">
                        <mvt:item name="fonts" param="body_font">
                        &mvt:product:descrip;
                        </mvt:item>
                    </td></tr>
                    </table>
            
            
                    <mvt:comment> *** Related Products *** </mvt:comment>
            
            
                    <mvt:if expr="l.settings:product_count NE 0">
                        <br><br>
                        <mvt:item name="fonts" param="hdr_font">
                        <b>Related Item(s)</b><br>
                        </mvt:item>
            
            
                    </mvt:if>
                    <mvt:item name="prod_ctgy_hdft" param="prod_footer" />
                    </blockquote>
                </td></tr>
            
            
                <tr><td align="left" valign="bottom"> 
                    <mvt:item name="hdft" param="footer" />
                </td></tr>
                </table>
            
            
                <mvt:item name="hdft" param="global_footer" />    
            </mvt:item>
            </html>
            That is all that you need to do in order to pass multiple option quantities to the basket. Let me know if you have any other questions.

            Nicholas Adkins
            Associate Developer
            Miva Merchant
            [email protected]
            http://www.mivamerchant.com
            Last edited by Nick; 04-10-12, 09:08 AM.
            Nicholas Adkins
            Technical Training Specialist / Miva, Inc.
            [email protected]
            https://www.miva.com/mivalearn

            Comment


              #7
              Re: Another Inventory Variants twist

              Hi Nick,

              Fantastic - now here's the $64,000 question - do you think this modification will work on the Category Template Manager QUICKADD layout? Do you think it would work if I assigned the xprodtemplate item to the CTGY screen? I ask because my original question didn't make it clear that was what I now need to do.

              Thanks!
              Leslie

              Thanks!
              Leslie
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #8
                Re: Another Inventory Variants twist

                Yes if you use the same logic as far as adding the option number to the hidden inputs so that Miva knows which option and quantity is being placed in the basket. Also you will need to use change the action to OPTQTY. I actually used something very similar on another site, http://www.mepxymarkers.com/category...l-markers.html .

                Let me know if you have any issues implementing it on the category page and I post the code for accomplishing this as well.
                Nicholas Adkins
                Technical Training Specialist / Miva, Inc.
                [email protected]
                https://www.miva.com/mivalearn

                Comment


                  #9
                  Re: Another Inventory Variants twist

                  Hi Nick - that's very close to what I need, except I need a single add to cart button. It would be fanstatic if you posted the code for your category page

                  Thanks!
                  Leslie
                  Leslie Kirk
                  Miva Certified Developer
                  Miva Merchant Specialist since 1997
                  Previously of Webs Your Way
                  (aka Leslie Nord leslienord)

                  Email me: [email protected]
                  www.lesliekirk.com

                  Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                  Comment


                    #10
                    Re: Another Inventory Variants twist

                    Originally posted by Nick View Post

                    Let me know if you have any issues implementing it on the category page and I post the code for accomplishing this as well.
                    Yeah, I'm sort of having a few issues. I'd love to see your code.
                    Leslie Kirk
                    Miva Certified Developer
                    Miva Merchant Specialist since 1997
                    Previously of Webs Your Way
                    (aka Leslie Nord leslienord)

                    Email me: [email protected]
                    www.lesliekirk.com

                    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                    Comment


                      #11
                      Re: Another Inventory Variants twist

                      Nick,
                      I purchased the module and was attempting to implement your code. I had difficulty following where to make the changes you were indicating. Reading on it appeared to me that you incorporated these changes in the 3rd code box so I just made a new template with #3 code box. There must be missing code that I just don't understand because Miva didn't like this template and I got and error message.

                      Can you post the complete code so I can then modify it? My Miva coding skills are limited but improving.
                      Thanks,
                      Chet Vincentz
                      [email protected]

                      www.electrodyne.cc Quality Motoring Accessories
                      www.racdyn-usa.com BMW, MINI & Porsche performance
                      www.artisticartifacts.com Creative art materials

                      Comment

                      Working...
                      X