Originally posted by aarcmedia
View Post
Code:
<mvt:assign name="l.settings:products" value="0" />
<mvt:assign name="l.settings:myProducts" value="0" />
<mvt:assign name="l.settings:products" value="0" />
<mvt:foreach array="cattree_categories" iterator="category_children"> <mvt:if expr="l.settings:category_children:parent_id EQ l.settings:category:id"> <mvt:assign name="l.null" value="miva_array_insert(l.settings:subcategories, l.settings:category_children, -1)" /> </mvt:if> </mvt:foreach> <mvt:assign name="l.settings:category_children" value="miva_array_elements(l.settings:subcategories)" /> <mvt:if expr="l.settings:subcategories GT 0"> <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:assign name="l.settings:myProducts" value="0" /> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, l.settings:null, g.NextOffset, l.settings:myProducts )" /> <table> <tr> <th>Image</th> <th>Name</th> <th>Size</th> <th>Order</th> </tr> <mvt:foreach iterator="product" array="myProducts"> <mvt:assign name="l.uri:store_id" value="g.Store:id" /> <mvt:assign name="l.uri:screen" value="''" /> <mvt:assign name="l.uri:page_id" value="0" /> <mvt:assign name="l.uri:cat_id" value="0" /> <mvt:assign name="l.uri:product_id" value="l.settings:product:id" /> <mvt:do file="g.Module_Feature_URI_DB" name="l.have_uri" value="URI_Load_Item_Canonical( l.uri, l.settings:canonical_uri )" /> <mvt:do name="l.success" file="g.Module_Library_DB" value="ProductImage_Load_Type(l.settings:product:id, 1, l.settings:imagetype)" /> <mvt:do name="l.success" file="g.Module_Library_DB" value="Image_Load_ID(l.settings:imagetype:image_id, l.settings:imagedata)" /> <mvt:assign name="g.subProductImage" value="g.baseurl $ l.settings:imagedata:image" /> <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'product_size', g.product_size)" /> <tr> <td> <a href="&mvt:canonical_uri:uri;"><img src="&mvt:global:subProductImage;" alt="&mvt:product:name;" /></a> </td> <td><a href="&mvt:canonical_uri:uri;">&mvt:product:name;</a></td> <td nowrap>&mvt:global:product_size;</td> <td> <!-- add to cart form is here, I removed because we're doing funky stuff there also --> </td> </tr> </mvt:foreach> <!-- end .x-product-list --> </table> </mvt:foreach> <mvt:else> <mvt:item name="category_listing" /> </mvt:if>
<mvt:if expr="l.settings:product:quantity GT 0"> <span class="x-product-layout-purchase__product-quantity u-font-tiny"> QTY in Cart: <strong>&mvt:product:quantity;</strong> </span> </mvt:if>
<mvt:do file="g.Module_Library_DB" name="l.settings:product:quantity" value="Basket_Quantity(l.settings:item:basket_id, l.settings:product:id)" /> <mvt:if expr="l.settings:product:quantity GT 0"> <span class="x-product-layout-purchase__product-quantity u-font-tiny"> QTY in Cart: <strong>&mvt:product:quantity;</strong> </span> </mvt:if>
<!-- placed outside product loop --> <mvt:assign name="l.settings:img:width" value="400"/> <mvt:assign name="l.settings:img:height" value="400"/> <!-- placed within the product loop --> <mvt:do file="g.Module_Library_DB" name="l.settings:sub_category:product:image_count" value="ProductImageDataList_Load_Product(l.settings:product:id, l.settings:product:images)" /> <mvt:foreach iterator="image" array="product:images"> <mvt:if expr="l.settings:image:imagetype:code EQ 'main'"> <mvt:assign name="l.settings:product:main_image" value="l.settings:image" /> <mvt:foreachstop/> </mvt:if> </mvt:foreach> <mvt:do file="g.Module_Library_DB" name="l.result" value="GeneratedImage_FindOrInsert_Image_Dimensions( l.settings:product:main_image:image, l.settings:img:width, l.settings:img:height, l.settings:product:main_image:generated )" /> <mvt:assign name="l.settings:image:mainthumb" value="l.settings:product:main_image:generated:image" /> &mvte:image:mainthumb;
<mvt:assign name="l.settings:myProducts" value="0" />
<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="Runtime_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"> <h2 style="font-size:1.4rem; font-weight:bold;"><a name="&mvt:subcat:code;"></a>&mvte:subcat:name;</h2> <mvt:assign name="l.settings:sub_categories2" value=" " /> <mvt:do name="l.result" file="g.Module_Library_DB" value="Runtime_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"> <section> <p></p> <ul class="c-form-list o-layout o-layout--wide"> <li class="c-form-list__item o-layout__item u-width-10--m"> <a name="&mvte:subcat2:code;"></a> <h3><strong>&mvte:subcat2:name;</strong></h3></li> <li class="c-form-list__item o-layout__item u-width-2--m"> <h3> <a href="/&mvt:category:code;.html#top"><span class="u-font-small u-icon-chevron-up"></span> <strong class="u-color-red">Back to top</strong></a></h3></li> </ul> </section> <mvt:comment>tweaked with Ted's code</mvt:comment> <mvt:assign name="l.settings:myProducts" value="0" /> <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:subcat2:id, g.Offset, l.settings:null, g.NextOffset, l.settings:myProducts )" /> <section class="o-layout o-layout--row--l o-layout--wide"> <div class="o-layout__item u-width-3--l"> <mvt:do file="g.Module_Root $ '/modules/component/cmp-cssui-cattitle.mvc'" name="l.success" value="CSSUI_CatTitle_Load(l.settings:subcat2:id, l.settings:subcat2:title_image)" /> <img src="&mvt:subcat2:title_image:image;" alt="&mvte:subcat2:name;"> </div> <div class="o-layout__item u-width-9--l"> <mvt:foreach iterator="product" array="myProducts"> <section> <form class="o-layout__item u-width-12 inline-labeling ctgy-add-form" data-hook="purchase" action="&mvte:urls:BASK:auto;" method="post" name="add"> <input type="hidden" name="Action" value="ADPR" /> <input type="hidden" name="Product_Code" value="&mvte:product:code;" /> <ul class="c-form-list o-layout o-layout--wide"> <li class="c-form-list__item o-layout__item u-width-6--m"><span>&mvt:product:name;</span> <mvt:if expr="NOT ISNULL l.settings:product:descrip"> <br>&mvt:product:descrip; </mvt:if> <mvt:item name="customfields" param="Read_Product_ID(l.settings:product:id, 'notes', l.settings:product:notes)" /> <mvt:if expr="NOT ISNULL l.settings:product:notes"> <br><div class="custom-field" id="customfields-notes"><span class="bold">Notes:</span> &mvt:product:notes;</div> </mvt:if> </li> <li class="c-form-list__item o-layout__item u-width-2--m"> <span>$<mvt:eval expr="l.settings:product:price ROUND 2" /></span></li> <li class="c-form-list__item o-layout__item u-width-1--m"><span> <input class="form-control form-control-sm col-sm-4 text-center float-right cart-quantity ctgyQuantity" autocomplete="off" style="margin:0 auto" type="tel" min="0" name="Quantity" value="1"> </span></li> <li class="c-form-list__item o-layout__item u-width-3--m"> <input type="submit" value="Add to Cart" class="ctgyCart c-button c-button--full c-button--large c-control-group__button u-bg-primary u-color-yellow u-text-bold u-font-small u-text-uppercase"> </li> </ul> </form> <hr class="c-keyline"> </section> </mvt:foreach> </div> </section> </mvt:foreach> <mvt:assign name="l.settings:sub_categories2" value=" " /> </mvt:if> </mvt:foreach> </mvt:if>
Comment