Announcement

Collapse
No announcement yet.

Multi-Add Form Issue

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

    Multi-Add Form Issue

    I'm working on a massive "multi-add" for a category page, and I'm "so close" but the form itself when submitted is resulting in nothing. I'm using the Shadows ReadyTheme. Is there something wrong in this form setup that is causing items not to add, or is it something with my domain settings? I confirmed a normal add to cart on a product page works fine. Here's what I'm working with..... NOTE, you're seeing me loop through sub-cats of the parent and where there are products in those sub-cats, it's looping through those as well, and those are what I'm trying to multi-add......

    HTML Code:
                                <form method="post" action="&mvte:global:secure_sessionurl;Screen=BASK"> 
                                <input type="hidden" name="Action" value="ADPM">
    
                                <mvt:foreach iterator="subcategory" array="subcategories">
                                    <h2 class="u-text-uppercase"><a href="&mvte:subcategory:link;">
                                        <strong>&mvte:subcategory:name;</strong>
                                    </a></h2>
    
                                    <mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:subcategory:code, l.settings:thisCategory)" />
                                    <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, 100, g.NextOffset, l.settings:myProducts )" />
    
                                    <table class="table-compact">
                                        <tr>
                                            <td>Name</td>
                                            <td>Price</td>
                                            <td>Size</td>
                                            <td>MSRP</td>
                                            <td>UPC</td>
                                            <td>Order</td>
                                        </tr>
    
                                        <mvt:foreach iterator="product" array="myProducts">
    
                                        <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'upc', g.upc)" />
                                        <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'suggest_retail', g.suggest_retail)" />
                                        <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'product_size', g.product_size)" />
                                        <tr>
                                            <td>&mvt:product:name;</td>
                                            <td>
                                                <mvt:if expr="l.settings:product:base_price GT l.settings:product:price">
                                                    <span><s>$&mvt:product:base_price;</s></span>
                                                    <span class="u-color-red">$&mvt:product:price;</span>
                                                <mvt:else>
                                                    <span>$&mvt:product:price;</span>
                                                </mvt:if>
                                            </td>
                                            <td>&mvt:global:product_size;</td>
                                            <td>&mvt:global:suggest_retail;</td>
                                            <td>&mvt:global:upc;</td>
                                            <td>
    
                                                <input type="hidden" name="Products[&mvt:product:id;]:code" value="&mvte:product:code;"> 
                                                <input type="text" name="Products[&mvt:product:id;]:quantity" value="0"> 
    
                                        </tr>
    
                                        </mvt:foreach>
    
                                    </table>
    
                                </mvt:foreach>
                                    <button class="btn btn-primary btn-yellow btn-block btn-lg" type="submit"><i class="fa fa-shopping-cart"></i>&nbsp; Add to Cart</button>
                                </form>
    Ted Hust
    AarcMediaGroup.com

    Celebrating 13 Years of Outstanding Service & Support
    Miva Merchant Design

    #2
    See if you can dig something useful out of this


    Code:
        <mvt:assign name="l.settings:subcat:id" value=" " />
    
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( g.Category_Code, l.settings:current_category )" />
    <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:current_category:id, l.settings:sub_categories )" />
    <mvt:assign name="l.subcat_count" value="miva_array_elements( l.settings:sub_categories )" />
    <mvt:if expr="l.subcat_count GT 0">
    
    
        <mvt:foreach iterator="subcat" array="sub_categories">
            <p><a name="&mvt:subcat:code;"></a><strong>&mvte:subcat:name;</strong></p>
            <mvt:assign name="l.settings:sub_categories2" value=" " />
    
            <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:subcat:id, l.settings:sub_categories2 )" />
            <mvt:assign name="l.subcat2_count" value="miva_array_elements( l.settings:sub_categories2 )" />
            <mvt:if expr="l.subcat2_count GT 0">
                <mvt:foreach iterator="subcat2" array="sub_categories2">
                    <p></p>
                    <a name="&mvte:subcat2:code;"></a>
                    <p><strong class="red">&mvte:subcat2:name;</strong></p>
                    <mvt:comment>load first 100 prodcts assigned to a specific category</mvt:comment>
                    <mvt:assign name="l.settings:products" value="0" />
                    <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:subcat2:id, g.Offset, 100, g.NextOffset, l.settings:products )" />
    
    
                    <form class="o-layout__item x-product-layout-purchase u-width-12 u-width-6--l u-width-5--w" data-hook="purchase" action="&mvte:urls:BASK:auto;" method="post" name="add">
      <input type="hidden" name="Action" value="ADPM">
      <table width="600"> 
          <tr>
                  <td>Product Name</td>
                  <td>Quantity</td>
          </tr>
       <mvt:foreach iterator="product" array="products">
          <tr> 
          <td>&mvt:product:name;</td>
          <td> 
                <input type="hidden" name="Products[ &mvt:product:id; ]:code" value="&mvte:product:code;">
    
              <input class="form-control form-control-sm col-sm-4 text-center float-right cart-quantity" style="margin:0 auto" type="number" min="0" name="Products[ &mvt:product:id; ]:quantity" value="" placeholder="0"></td>
          </tr> 
          </mvt:foreach> 
          </table> 
          <input type="submit" value="Add to Basket">
    </form>
                </mvt:foreach>
                <mvt:assign name="l.settings:sub_categories2" value=" " />
            </mvt:if>
        </mvt:foreach>
    </mvt:if>
    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


      #3
      Originally posted by aarcmedia View Post
      I'm working on a massive "multi-add" for a category page, and I'm "so close" but the form itself when submitted is resulting in nothing. I'm using the Shadows ReadyTheme. Is there something wrong in this form setup that is causing items not to add, or is it something with my domain settings? I confirmed a normal add to cart on a product page works fine. Here's what I'm working with..... NOTE, you're seeing me loop through sub-cats of the parent and where there are products in those sub-cats, it's looping through those as well, and those are what I'm trying to multi-add......

      HTML Code:
       <form method="post" action="&mvte:global:secure_sessionurl;Screen=BASK">
      <input type="hidden" name="Action" value="ADPM">
      
      <mvt:foreach iterator="subcategory" array="subcategories">
      <h2 class="u-text-uppercase"><a href="&mvte:subcategory:link;">
      <strong>&mvte:subcategory:name;</strong>
      </a></h2>
      
      <mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:subcategory:code, l.settings:thisCategory)" />
      <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, 100, g.NextOffset, l.settings:myProducts )" />
      
      <table class="table-compact">
      <tr>
      <td>Name</td>
      <td>Price</td>
      <td>Size</td>
      <td>MSRP</td>
      <td>UPC</td>
      <td>Order</td>
      </tr>
      
      <mvt:foreach iterator="product" array="myProducts">
      
      <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'upc', g.upc)" />
      <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'suggest_retail', g.suggest_retail)" />
      <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'product_size', g.product_size)" />
      <tr>
      <td>&mvt:product:name;</td>
      <td>
      <mvt:if expr="l.settings:product:base_price GT l.settings:product:price">
      <span><s>$&mvt:product:base_price;</s></span>
      <span class="u-color-red">$&mvt:product:price;</span>
      <mvt:else>
      <span>$&mvt:product:price;</span>
      </mvt:if>
      </td>
      <td>&mvt:global:product_size;</td>
      <td>&mvt:global:suggest_retail;</td>
      <td>&mvt:global:upc;</td>
      <td>
      
      <input type="hidden" name="Products[&mvt:product:id;]:code" value="&mvte:product:code;">
      <input type="text" name="Products[&mvt:product:id;]:quantity" value="0">
      
      </tr>
      
      </mvt:foreach>
      
      </table>
      
      </mvt:foreach>
      <button class="btn btn-primary btn-yellow btn-block btn-lg" type="submit"><i class="fa fa-shopping-cart"></i>&nbsp; Add to Cart</button>
      </form>
      Om a side note, I noticed you too are using &mvt:product:price;. Are you having a problem with &mvt:product:formatted_price; displaying? I can't get it to work and it makes no sense to me.
      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

      Working...
      X