Announcement

Collapse
No announcement yet.

Display sub-sub-categories

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

  • lesliekirk
    replied
    I did get this working and I meant to post what I did

    Code:
    <!-- placed outside product loop -->
    <mvt:assign name="l.settings:img:width" value="160"/>
    <mvt:assign name="l.settings:img:height" value="160"/>
    
    <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 )" />
    
    <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-2--m">
    
    <!-- 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.setting s: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_Dimension s( 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:ima ge" />
    <mvt:item name="customfields" param="Read_Product_ID(l.settings:product:id, 'index', l.settings:product:index)" />
    <mvt:if expr="NOT ISNULL l.settings:product:index">
    
    <a data-mm-linktype="product-list-link" href="&mvt:canonical_uri:uri;">
    
    <mvt:if expr="l.settings:image:mainthumb">
    <img src="&mvte:image:mainthumb;" alt="&mvte:product:name;" />
    <mvt:else>
    <img src="graphics/00000001/1/image-coming-soon_160x160.png" alt="&mvte:product:name;" />
    </mvt:if>
    </a>
    <mvt:else>
    <mvt:if expr="l.settings:image:mainthumb">
    <img src="&mvte:image:mainthumb;" alt="&mvte:product:name;" />
    <mvt:else>
    <img src="graphics/00000001/1/image-coming-soon_160x160.png" alt="&mvte:product:name;" />
    </mvt:if>
    </mvt:if>
    </li>

    I'll take a peek at what you did, it looks a bit "less involved". Thanks!

    Leave a comment:


  • SidFeyDesigns
    replied
    This code has both the product base price and price formatted snippet as well as the main image type snippet

    Code:
    <mvt:foreach array="cattree_categories" iterator="cattree_category">
      <mvt:if expr="l.settings:cattree_category:parent_id EQ l.settings:category:id">
        <mvt:assign name="l.null" value="miva_array_insert(l.settings:subcats_prods, l.settings:cattree_category, -1)" />
      </mvt:if>
    </mvt:foreach>
    <section class="row">
      <mvt:foreach iterator="sub_category" array="subcats_prods"><mvt:comment>< --- Change this to the array needed</mvt:comment>
        <h2 class="column whole np">&mvt:sub_category:name;</h2>
        <ul class="o-layout category-product-layout u-grids-1 u-grids-2--xxs u-grids-4--l bottom-shadow">
          <mvt:do name="l.success" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:sub_category:id, g.Offset, 4, g.NextOffset, l.settings:products )" />
        <mvt:assign name="l.settings:product_count" value="miva_array_elements( l.settings:products )" /><mvt:comment>< --- Keep this and the line below outside of the product loop</mvt:comment>
          <mvt:do name="l.success" file="g.module_feature_tui_ut" value="CommonComponentFields_Initialize_Product_Discounts_Runtime( l.settings:products, l.settings:product_count )" />
          <mvt:foreach iterator="product" array="products"><mvt:comment>< --- Change this to the array needed</mvt:comment>
            <li class="o-layout__item category-product">
              <mvt:assign name="l.settings:uri:store_id" value="g.Store:id" />
              <mvt:assign name="l.settings:uri:product_id" value="l.settings:product:id" />
              <mvt:do file="g.Module_Feature_URI_DB" name="l.settings:have_uri" value="URI_Load_Item_Canonical( l.settings:uri, l.settings:canonical_uri )" />
              <mvt:assign name="l.settings:product:link" value="'https://' $ g.domain:name $ l.settings:canonical_uri:uri" />
              <a href="&mvte:product:link;" title="&mvte:product:name;" aria-label="&mvte:product:name; &mvt:product:formatted_price;">
                <figure class="nm">
                  <div class="place-holder">
                    <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,' product_flag', l.settings:product_flag2)" />
                    <mvt:if expr="NOT ISNULL l.settings:product_flag2">
                      <mvt:assign name="l.settings:product:flag2" value="'flag--' $ tolower(l.settings:product_flag2)" />
                      <div class="flag-wrap &mvt:product:flag2;"><div class="flag &mvt:product:flag2; bold white"><span class="&mvt:product:flag2;"></span></div></div>
                    </mvt:if>
                  <mvt:do name="l.image_count" file="g.Module_Library_DB" value="ProductImageDataList_Load_Product( l.settings:product:id, l.settings:imagedata )" />
                    <mvt:foreach iterator="data" array="imagedata">
                      <mvt:if expr="l.settings:data:imagetype:code EQ 'main'"><mvt:comment>< --- Change this to the EQ 'value' needed</mvt:comment>
                        <mvt:assign name="l.constraints[1]:height" value="205" /><mvt:comment>< --- Change this to the value needed</mvt:comment>
                        <mvt:assign name="l.constraints[1]:width" value="205" /><mvt:comment>< --- Change this to the value needed</mvt:comment>
                        <mvt:assign name="l.imagetype_codes[1]" value="'main'" /><mvt:comment>< --- Change this to the value needed</mvt:comment>
                        <mvt:assign name="l.constraints_count" value="miva_array_elements( l.constraints )" />
                        <mvt:assign name="l.imagetypecode_count" value="miva_array_elements( l.imagetype_codes )" />
                        <mvt:do file="g.Module_Library_DB" name="l.imagedata_count" value="ProductImageDataList_Load_Product_TypeCodes _Constrained( l.settings:product:id, l.imagetype_codes, l.imagetypecode_count, l.constraints, l.constraints_count, l.settings:productimagedatalist )" />
                        <img class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" width="207" height="207" data-src="&mvt:productimagedatalist[1]:generatedimages[1]:image;" alt="&mvte:product:name;"/>
                        <mvt:foreachstop/><mvt:comment>< --- Important! Do Not Remove</mvt:comment>
                      <mvt:else>
                        <img class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" width="207" height="207" data-src="themes/suivant/images/img_no_thumb.gif" alt="&mvte:product:code;"/>
                        <mvt:foreachstop/><mvt:comment>< --- Important! Do Not Remove</mvt:comment>
                      </mvt:if>
                    </mvt:foreach>
                    <mvt:item name="pm_easy_review" param="summary" />
                  </div>
                  <figcaption>&mvte:product:name;<br />
                  <mvt:foreach iterator="discount" array="product:discounts">
                      <mvt:if expr="l.settings:discount:formatted_discount">
                        <mvt:assign name="l.settings:product:baseprice" value="l.settings:product:price + l.settings:discount:discount" />
                        <mvt:do file="g.Module_Store_Module_Currency" name="l.settings:product:formatted_baseprice" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, l.settings:product:baseprice )" />
                        <span class="red bold strike">&mvt:product:formatted_baseprice;</span>
                      </mvt:if>
                    </mvt:foreach>
                    <span class="black bold">&mvt:product:formatted_price;</span>
                  </figcaption>
                </figure>
              </a>
            </li>
          </mvt:foreach>
          <mvt:assign name="l.settings:products" value="''"/><mvt:comment>< --- Change this to the name needed</mvt:comment>
          <li class="column whole np pbm1 align-center">
            <a href="&mvt:sub_category:link;" title="&mvte:sub_category:name;" class="button button-medium nb bg-red corners">View All Gifts</a>
          </li>
        </ul>
      </mvt:foreach>
    </section>
    Tried my best to point out what you'll need to change to suit your specific code.

    Hope this helps and it is not too late.
    Last edited by SidFeyDesigns; 03-08-22, 12:34 PM.

    Leave a comment:


  • lesliekirk
    replied
    While I wait on the previous answer I have a much bigger problem - who do I display the product image? I have tried a couple of different things that seem obvious but don't work.


    Here is the code I'm working with:

    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="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-2--m">
    <img src="&mvte:product:imagetypes:main;" alt="&mvte:product:name;" />
    &mvt:customfield_values:productimagecustomfields:main;
    </li>
    <li class="c-form-list__item o-layout__item u-width-4--m">
    
    <mvt:item name="customfields" param="Read_Product_ID(l.settings:product:id, 'index', l.settings:product:index)" />
    <mvt:if expr="NOT ISNULL l.settings:product:index">
    <a href="/&mvt:product:code;.html"><span>&mvt:product:name;</span></a>
    <mvt:else>
    <span>&mvt:product:name;</span>
    </mvt:if>
    <mvt:comment>
    <mvt:if expr="NOT ISNULL l.settings:product:descrip">
    <br>&mvt:product:descrip;
    </mvt:if>
    </mvt:comment>
    <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>
    Note - &mvte:product:imagetypes:main; doesn't work not does &mvt:customfield_values:productimagecustomfields:m ain; but the other "product" items do.

    FYI - the copy & paste seems to have inserted spaces in the code, they are not in the template.

    Leave a comment:


  • lesliekirk
    replied
    I'm going to circle back here even though this is within a Colossus ReadyTheme. I first noticed this on the dev site that is behind a wall so I moved the code to my dev site to be able to share. I'm trying to figure out why a couple of the categories are duplicating themselves

    https://lesliekirk.mivamerchantdev.c...-cabinets.html

    For example, Antique Shaker Corner Sink Front is appearing 3 times. It shouldn't do that and since subcategories cannot be assigned to more than one category something is squirrelly:

    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">
            <h2 style="font-size:1.2rem; font-weight:bold;"><a name="&mvt:subcat:code;"></a><span style="color:#f00;">&mvte:subcat:name;</span></h2>
            <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>
                    <h3><strong class="red">&mvte:subcat2:name;</strong></h3>
                    <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" data-hook="purchase" action="&mvte:urls:CTGY:auto;" method="post" name="add">
      <input type="hidden" name="Action" value="ADPM">
    <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;" />
                    <input type="hidden" name="Offset" value="&mvte:global:CatListingOffset;" />
                    <input type="hidden" name="AllOffset" value="&mvte:global:AllOffset;" />
                    <input type="hidden" name="CatListingOffset" value="&mvte:global:CatListingOffset;" />
    <section>
                <ul class="c-form-list o-layout o-layout--wide u-text-uppercase">
                    <li class="c-form-list__item o-layout__item u-width-7--m">
                  <span>Name</span></li>
    <li class="c-form-list__item o-layout__item u-width-3--m">
              <span>Price</span>
    
          </li>
                        </ul>
        </section>
    
       <mvt:foreach iterator="product" array="products">
    
         <section>
                <ul class="c-form-list o-layout o-layout--wide u-text-uppercase">
                    <li class="c-form-list__item o-layout__item u-width-7--m">
                        <span>&mvt:product:name;</span>
                    </li>
                    <li class="c-form-list__item o-layout__item u-width-3--m">
                        <span>&mvt:product:formatted_price;     &mvt:product:price;</span>
                    </li>
                    <li class="c-form-list__item o-layout__item u-width-2--m">
                         <span> 
                <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="tel" min="0" name="Products[ &mvt:product:id; ]:quantity" value=""></span>
                    </li>
                </ul>
                <hr class="c-keyline">
            </section>
          </mvt:foreach> 
    
    <!-- <input type="submit" value="Add to Basket"> -->
         <section>
                <ul class="c-form-list o-layout o-layout--row-reverse u-text-uppercase">
    <li class="c-form-list__item o-layout__item u-width-3--m">
    <input class="c-button c-button--full c-button--huge c-control-group__button u-bg-primary u-color-black u-text-bold u-font-small u-text-uppercase" data-action="&mvte:urls:CTGY:auto_sep;ajax=1" data-hook="add-to-cart" data-value="Add To Cart" type="submit" value="Add To Cart"></li>
    
      </ul>  
    </section>  
    </form>
                </mvt:foreach>
                <mvt:assign name="l.settings:sub_categories2" value=" " />
            </mvt:if>
        </mvt:foreach>
    </mvt:if>

    Antique Shaker Spice & Glass Wall and Antique Shaker Shelf Wall also duplicates itself.

    I also still have an issue with the Product Price not displaying the formated price.

    Leave a comment:


  • lesliekirk
    replied
    Follow up on my sub-sub category template attempt(s). I've moved from the Base ReadyTheme coding to the Colossus ReadyTheme coding but I noticed this problem before I switched ReadyThemes. The formated product price will not display, only the price


    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 )" />
                    <mvt:foreach iterator="product" array="products">
                        &mvt:product:name; - &mvt:product:code; - &mvt:product:price; &mvt:product:formatted_price;<br>
                    </mvt:foreach>
                </mvt:foreach>
                <mvt:assign name="l.settings:sub_categories2" value=" " />
            </mvt:if>
        </mvt:foreach>
    </mvt:if>
    It's very odd, the product name and product code both display as expected.

    Leave a comment:


  • lesliekirk
    replied
    Thank you, Leanne!!! That's got me moving in the right direction.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Question - what does this do?

    <mvt:assign name="l.null" value="miva_array_insert(l.settings:subcategories, l.settings:category_children, -1"> This inserts the l.settings:category_children values into the array called l.settings:subcategories. the -1 is the position. Almost always its -1 which is the 'end' of the array. But it could be used to insert records with a specific order. (sorry, quoting isn't working for me...neither is it keeping my logged in)

    Leave a comment:


  • Leanne
    replied
    ????

    Code:
                <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:subcategory_count" value="miva_array_elements(l.settings:subcategories)" />
    
                    <section class="o-layout u-grids-2 u-grids-3--l x-product-list" style="margin-top:16px;">
                        <mvt:foreach iterator="subcategory" array="subcategories">
                            <div class="o-layout__item u-text-center x-product-list__item">
                                <a class="u-block x-product-list__link" href="&mvte:subcategory:link;">
                                    <figure class="x-product-list__figure">
                                        <mvt:if expr="l.settings:subcategory:image">
                                            <img class="x-product-list__image" src="&mvt:subcategory:image;">
                                        </mvt:if>
                                        <figcaption>
                                            <strong class="x-product-list__name u-text-uppercase">&mvte:subcategory:name;</strong>
                                        </figcaption>
    
                                        <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:subcategory:code, l.settings:sub_subcategory )" />
                                        <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:sub_subcategory:id, l.settings:sub_subcategories )" />
    
                                        <mvt:if expr="l.settings:sub_subcategories">
                                            <mvt:foreach iterator="sub_subcategory" array="sub_subcategories">
                                                <div class="o-layout__item u-text-center x-product-list__item">
                                                    <a class="u-block x-product-list__link" href="&mvte:sub_subcategory:link;">
                                                        <figure class="x-product-list__figure">
                                                            <mvt:if expr="l.settings:subcategory:image">
                                                                <img class="x-product-list__image" src="&mvt:sub_subcategory:image;">
                                                            </mvt:if>
                                                            <figcaption>
                                                                <strong class="x-product-list__name u-text-uppercase">&mvte:sub_subcategory:name;</strong>
                                                            </figcaption>
                                                        </figure>
                                                    </a>
                                                </div>
                                            </mvt:foreach>   
                                            <mvt:assign name="l.settings:sub_subcategory" value="''"/>
                                            <mvt:assign name="l.settings:sub_subcategories" value="''"/>
                                        </mvt:if>
                                    </figure>
                                </a>
                            </div>
                        </mvt:foreach>
                    </section>

    Leave a comment:


  • lesliekirk
    replied
    Here is the code that I would like to be able to display the sub-sub category in


    Code:
    <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:subcategory_count" value="miva_array_elements(l.settings:subcategories)" />
    
                    <section class="o-layout u-grids-2 u-grids-3--l x-product-list" style="margin-top:16px;">
                        <mvt:foreach iterator="subcategory" array="subcategories">
                            <div class="o-layout__item u-text-center x-product-list__item">
                                <a class="u-block x-product-list__link" href="&mvte:subcategory:link;">
                                    <figure class="x-product-list__figure">
                                        <mvt:if expr="l.settings:subcategory:image">
                                            <img class="x-product-list__image" src="&mvt:subcategory:image;">
                                        </mvt:if>
                                        <figcaption>
                                            <strong class="x-product-list__name u-text-uppercase">&mvte:subcategory:name;</strong>
                                        </figcaption>
    need sub-sub here
                                    </figure>
                                </a>
                            </div>
                        </mvt:foreach>
                    </section>
    Question - what does this do?

    Code:
     <mvt:assign name="l.null" value="miva_array_insert(l.settings:subcategories, l.settings:category_children, -1)" />
    Specifically that -1 value.

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Leanne View Post
    What is the current code you are testing, Leslie?
    I'm starting from scratch so I don't have any. I probably should move this thread to the Shadows ReadyTheme Forum since will be the code I want to start from

    Code:
    <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:subcategory_count" value="miva_array_elements(l.settings:subcategories)" />
                <mvt:if expr="l.settings:subcategories GT 0">
                    <section class="o-layout u-grids-2 u-grids-3--l x-product-list">
                        <mvt:foreach iterator="subcategory" array="subcategories">
                            <div class="o-layout__item u-text-center x-product-list__item">
                                <a class="u-block x-product-list__link" href="&mvte:subcategory:link;">
                                    <figure class="x-product-list__figure">
                                        <mvt:if expr="l.settings:subcategory:image">
                                            <img class="x-product-list__image" src="&mvt:subcategory:image;">
                                        </mvt:if>
                                        <figcaption>
                                            <strong class="x-product-list__name u-text-uppercase">&mvte:subcategory:name;</strong>
                                        </figcaption>
                                    </figure>
                                </a>
                            </div>
                        </mvt:foreach>
                    </section>
                <mvt:else>
                    <mvt:item name="category_listing" />
                </mvt:if>
    Bruce sent me this snippet but it didn't work (as is).

    Code:
     <mvt:foreach iterator="sub_category" array="subcats">
    <li>
       <a href="&mvte:sub_category:link;">&mvte:sub_category:name;</a>
    
       <mvt:do name="l.result" file="g.Module_Library_DB"
    value="Category_Load_Code( l.settings:sub_category:code,
    l.settings:sub_sub_category )" />
       <mvt:do name="l.result" file="g.Module_Library_DB"
    value="CategoryList_Load_Parent( l.settings:sub_sub_category,
    l.settings:sub_sub_cat )" /> 
    
       <mvt:if expr="l.settings:sub_sub_cat">
       <ul>
       <mvt:foreach iterator="this_cat" array="sub_sub_cat">
    
       &mvt:this_cat:etc;
    
       </mvt:foreach>   
       <mvt:assign name="l.settings:sub_sub_category" value="''"/>
       <mvt:assign name="l.settings:sub_sub_cat" value="''"/>
       </ul>
       </mvt:if>
    
    
    
       <!-- // sub-sub-cat -->
    </li>
    </mvt:foreach>
    This is the Toolkit snippet from the current layout. It does not work in the Shadows ReadyTheme layout for some unknown reason:

    subcategory_listing
    Code:
    <!-- <h4 class="subcategory-title">Subcategories in &mvte:category:name;</h4> -->
    <div class="clearfix"></div>
    
        <!-- BOF Sub Sub Top Links -->
          <mvt:item name="toolkit" param="parentcat|pccount" />
          <!-- check for parent cats //-->
          <!-- check for 1st level subcats //-->
          <mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
          <mvt:if expr="ccount GT 0">
    <div class="subcategory-listing col-md-12 container-fluid clearfix">
                   <mvt:foreach iterator="sub_category" array="sub_categories">
                    <div class="col-md-4 col-sm-4 col-xs-12 subcategory-wrapper">
    
                    <mvt:item name="fonts" param="ctgy_font">
                         <mvt:if expr="g.Category_Code EQ l.settings:sub_category:code"> <a href="&mvt:category:link;#&mvt:sub_category:code;">&mvt:sub_category:name;</a>
                <mvt:else>
                  <a href="&mvt:category:link;#&mvt:sub_category:code;"><b>&mvt:sub_category:name;</b></a><br />
              </mvt:if>
              <!-- check for 2nd level subcats //-->
              <mvt:item name="toolkit" param="subcat2|ccount2|l.all_settings:sub_category:code" />
              <mvt:if expr="ccount2 GT 0">
                <mvt:foreach iterator="sub_category2" array="sub_categories2">
                  <mvt:if expr="g.Category_Code EQ l.settings:sub_category2:code">&mvt:sub_category2:name;<br />
                    <mvt:else>
                    <div style="padding-left:5px;">
                     <a href="/&mvta:category:code;.html#&mvt:sub_category2:code;">&mvt:sub_category2:name;</a>
                    </div>
                  </mvt:if>
                </mvt:foreach>
               </mvt:if></mvt:item>
                    </div>
    
                </mvt:foreach>
    </div>
    
              </mvt:if>
    This snippet does work but needs to be updated. The Add to Basket form is at the crux of the makeover dilemma"

    Category Product List Layout
    Code:
    <div class="line-item">
          <mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
    <mvt:if expr="ccount GT 0">
            <mvt:foreach iterator="sub_category" array="sub_categories">  
           <h2 style="margin-bottom:4px; padding-left:10px; padding-top:30px; font-family:Arial, Helvetica, sans-serif; font-size:16px; border-bottom: solid #000 2px;">&mvt:sub_category:name;</h2>
            <a name="&mvt:sub_category:code;"></a>
            <!-- Begin Sub Categories -->
    <mvt:item name="toolkit" param="subcat2|ccount2|l.all_settings:sub_category:code" />
    <mvt:if expr="ccount2 GT 0">
    <mvt:foreach iterator="sub_category2" array="sub_categories2">
    
    <!-- Begin Product Display for each subcategory -->
    <mvt:item name="toolkit" param="cxpc|pcount|l.all_settings:sub_category2:code" />
    <mvt:if expr="pcount GT 0">
    <div>
    
    <mvt:item name="toolkit" param="catimage|bigimage|l.all_settings:sub_category2:code" />
    <mvt:if expr="bigimage">
    <div class="col-md-3 col-sm-3">
    
    
        <div>
    
    <img src="&mvte:global:bigimage;" alt="&mvt:sub_category2:name;" title="&mvt:sub_category2:name;">
    
    </div>
    </div>
    
        <div class="col-md-9 col-sm-9">
        <mvt:else>
        <div class="col-md-12 col-sm-12">
        </mvt:if>
     <form method="post" action="&mvte:global:sessionurl;Screen=CTGY">
      <input type="hidden" name="Action" value="ADPM">
        <input type="hidden" name="Category_Code" value="&mvte:global:Category_Code;" />    
            <table class="subcat">
            <tr><td colspan="4">
     <a name="&mvt:sub_category2:code;"></a><h2 style="margin-bottom:4px; font-family:Arial, Helvetica, sans-serif; font-size:16px;"><!-- &mvt:sub_category2:name;-->&mvt:sub_category2:name;&nbsp;&nbsp;<span style="background-color: #FF0000; color:#FFFF00;"><font size="2">
        </font><a href="/&mvt:category:code;.html#top">
        <font size="2" color="#FFFF00">Back to top</font></a>&nbsp;</span></h2>
    </td></tr>
    
            <tr class="red-bg">
            <td></td>
              <td><b>Name</b></td>
                <td><b>Price</b></td>
            <td>&nbsp;</td></tr>
    
        <mvt:foreach iterator="sub_product" array="sub_products">
    
                <tr valign="top">
                <td><mvt:if expr="NOT ISNULL l.settings:sub_product:thumbnail">
                              <img src="&mvte:sub_product:thumbnail;" alt="&mvt:sub_product:name;" title="&mvt:sub_product:name;">
    <mvt:else>
    &nbsp;
    </mvt:if></td>
                  <td>&mvt:sub_product:name;</td>
                 <td>&mvt:sub_product:formatted_price;</td>
                    <td class="item-buttons" style="text-align:right;">
    
                    <input type="hidden" name="Products[ &mvt:sub_product:id; ]:code" value="&mvte:sub_product:code;">
                <input type="text" name="Products[ &mvt:sub_product:id; ]:quantity" value="0">
                </td>
              </tr>
    <tr>
      <td colspan="4" style="border-bottom:#000 solid 1px;"></td></tr>
            </mvt:foreach>
            <tr><td colspan="3"><input type="submit" value="Add to Basket"></td></tr>
            </table>
            </form>
    
    
        </div></div>
            <div class="clearfix"></div>
    <div style="padding-bottom:20px; padding-top:20px; width:100%;"><div style="border-bottom:solid #000 1px;"></div></div>
    </mvt:if>
    
    <!-- End Product Display for each subcategory -->
    
    
    <div style="clear:both;"></div>
    </mvt:foreach>
    </mvt:if>
    
    <!-- End Sub Categories -->
    </mvt:foreach>
    </mvt:if>
       </div>
    Just trying to figure a good starting point. The current site has a template for the sub-sub-cat, so I may need to start by redoing that page and see what happens. The ultimate goal though, is to try and do this without the Toolkit (I just don't know if it's doable).

    Leave a comment:


  • Leanne
    replied
    What is the current code you are testing, Leslie?

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by Bruce - PhosphorMedia View Post

    You may need to:

    #1 NULL the l.settings:sub_cat:id, l.settings:sub_sub_cat:id, and l.settings:subsubcats 's before each loop
    #2 Wrap in a conditional for l.setting:subsubcats ISNOT NULL.

    (it's a context issue, as I've used this dozens of times, but it's not something that 'drop in' code would suffice. and by default, doing this as a module call would NULL the previous values
    So I'm about ready to attempt this again, I'd really like to make it work with "native" code as I know someday Bill's Toolkit will no longer work.

    Sorry Bruce, but I've reread what you posted a number of times over and it's still not become any clearer for me.

    Here is a link to what I want to redo

    Leave a comment:


  • William Davis
    replied
    Originally posted by lesliekirk View Post

    I miss Bill, at least he had examples I could break:

    http://www.emporiumplus.com/v5/tk_tree2.txt


    Who dosen't? Old man Weiland's work and work ethic is unrivaled!

    Leave a comment:


  • lesliekirk
    replied
    Originally posted by lesliekirk View Post
    Yeah, I think I'll just use Bill's Toolkit for this...
    Wow, still no solution.

    Leave a comment:


  • lesliekirk
    replied
    Yeah, I think I'll just use Bill's Toolkit for this...

    Leave a comment:

Working...
X