Announcement

Collapse
No announcement yet.

Display sub-sub-categories

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

  • Display sub-sub-categories

    Is there a way to display the sub-sub-categories as part of the subcategory_listing for the CTGY Page template? I have a Toolkit snippet version but it needs to be converted.

    Code:
     <!-- 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: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>
                    </div>
    
                </mvt:foreach>
    </div>
    
              </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

  • This:

    Code:
    <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:category:code.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_sub_cat )" /> 
    
     <mvt:foreach iterator="this_cat" array="sub_sub_cat">
       &mvt:this_cat:etc;
    
    </mvt:foreach>
    within the sub_cat foreach will do it.
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


    • I'm wondering how that plays with the CTGY subcategory_listing. I'm wanting to add it where the bold red is at. (I know what is there is wrong, it's just sort of a placeholder for me)


      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, l.settings:cattree_category, -1)" />
          </mvt:if>
      </mvt:foreach>
      <mvt:assign name="l.settings:subcat_count" value="miva_array_elements(l.settings:subcats)" />
      
      <mvt:if expr="l.settings:subcats GT 0 OR l.settings:category_listing:products_on_page_count GT 1">
          <hr class="border--secondary h-nm">
      
              <mvt:if expr="l.settings:subcats GT 0">
                <section style="padding: 2.625rem 0.75rem; text-align:center; width: 60%; margin: 0 auto;">
                  <nav class="cmp-subcategories inline-list secondary-font">
                      <ul>
                          <mvt:foreach iterator="sub_category" array="subcats">
                              <li>
                                  <a href="&mvte:sub_category:link;">&mvte:sub_category:name;</a>
      <ul>
                                    <mvt:foreach iterator="sub_sub_category" array="subcats">
                                    <li><a href="&mvte:sub_sub_category:link;">&mvte:sub_sub_category:name;</a></li>
                                        </mvt:foreach>
                                </ul>
                                  <!-- // sub-sub-cat -->
                              </li>
                          </mvt:foreach>
                      </ul>
                  </nav>
                </section>
                  <!-- end .cmp-subcategories -->
              </mvt:if>
      
      
          <!-- end .cmp-subcategories-filtering -->
      </mvt:if>

      Or does the "default" code have to be scrapped for something from scratch? Sigh...
      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


      • Yes, that's basically where the code I wrote should go. Just make sure you name the array and iterator different from the sub-categories and you'll be fine. You also add a sub-sub-sub-cat if you want...essentially creating a complete category tree. Note: this will, of course, add to processing time.
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


        • Originally posted by Bruce - PhosphorMedia View Post
          Yes, that's basically where the code I wrote should go. Just make sure you name the array and iterator different from the sub-categories and you'll be fine. You also add a sub-sub-sub-cat if you want...essentially creating a complete category tree. Note: this will, of course, add to processing time.
          LOL - so I tried this

          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, l.settings:cattree_category, -1)" />
              </mvt:if>
          </mvt:foreach>
          <mvt:assign name="l.settings:subcat_count" value="miva_array_elements(l.settings:subcats)" />
          
          <mvt:if expr="l.settings:subcats GT 0 OR l.settings:category_listing:products_on_page_count GT 1">
              <hr class="border--secondary h-nm">
          
                  <mvt:if expr="l.settings:subcats GT 0">
                    <section style="padding: 2.625rem 0.75rem; text-align:center; width: 60%; margin: 0 auto;">
                      <nav class="cmp-subcategories inline-list secondary-font">
                          <ul>
                              <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:category:code.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:subsubcats )" />     
          
                                      <ul>
                                        <mvt:foreach iterator="sub_sub_category" array="subsubcats">
                                        <li><a href="&mvte:sub_sub_category:link;">&mvte:sub_sub_category:name;</a></li>
                                            </mvt:foreach>
                                    </ul>
                                      <!-- // sub-sub-cat -->
                                  </li>
                              </mvt:foreach>
                          </ul>
                      </nav>
                    </section>
                      <!-- end .cmp-subcategories -->
                  </mvt:if>
          
          
          
          
          
          
              <!-- end .cmp-subcategories-filtering -->
          </mvt:if>
          What it gave me was

          A
          A B C D
          B
          A B C D
          C
          A B C D
          D
          A B C D

          I think I didn't do it right




          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


          • partially my fault

            l.settings:category:code.Category_Code

            Should be whatever the current parent category code is. in your case that'd be l.settings:sub_category:code...although you might not even need that line as you should check to see if l.settings:sub_category:id is available and just use that in the next line.
            Bruce Golub
            Phosphor Media - "Your Success is our Business"

            Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
            phosphormedia.com

            Comment


            • Bill's solutions are so much simpler and shorter...is that because his module did all the "heavy lifting" in the background?
              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


              • Originally posted by Bruce - PhosphorMedia View Post
                partially my fault

                l.settings:category:code.Category_Code

                Should be whatever the current parent category code is. in your case that'd be l.settings:sub_category:code...although you might not even need that line as you should check to see if l.settings:sub_category:id is available and just use that in the next line.
                Obviously, I did that wrong too. Now I get EVERY parent category listed below the subcategory name (&mvte:sub_category:name;)
                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, l.settings:cattree_category, -1)" />
                    </mvt:if>
                </mvt:foreach>
                <mvt:assign name="l.settings:subcat_count" value="miva_array_elements(l.settings:subcats)" />
                
                <mvt:if expr="l.settings:subcats GT 0 OR l.settings:category_listing:products_on_page_count GT 1">
                    <hr class="border--secondary h-nm">
                      <mvt:if expr="l.settings:subcats GT 0">
                          <section style="padding: 2.625rem 0.75rem; text-align:center; width: 60%; margin: 0 auto;">
                            <nav class="cmp-subcategories inline-list secondary-font">
                                <ul>
                                    <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.Category_Code, l.settings:sub_category:code )" />
                 <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:current_sub_category:id, l.settings:subsubcats )" />   
                
                                            <ul>
                                              <mvt:foreach iterator="sub_sub_category" array="subsubcats">
                                              <li><a href="&mvte:sub_sub_category:link;">&mvte:sub_sub_category:name;</a></li>
                                                  </mvt:foreach>
                                          </ul>
                                            <!-- // sub-sub-cat -->
                                        </li>
                                    </mvt:foreach>
                                </ul>
                            </nav>
                          </section>
                            <!-- end .cmp-subcategories -->
                        </mvt:if>
                    <!-- end .cmp-subcategories-filtering -->
                </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


                • if that's the actual code you are using it still has the typo :
                  l.settings:sub_category:code.Category_Code
                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment


                  • Originally posted by Bruce - PhosphorMedia View Post
                    if that's the actual code you are using it still has the typo :
                    l.settings:sub_category:code.Category_Code
                    Yes, that's the exact code I'm trying to use. Color me confused, but I don't know what your typo is...
                    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



                    • <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:sub_category:code.Category_Code, l.settings:sub_category:code )" /> s/b
                      <mvt:do name="l.result" file="g.Module_Library_DB" value="Category_Load_Code( l.settings:subcats:code, l.settings:subsub_category )" /> <mvt:do name="l.result" file="g.Module_Library_DB" value="CategoryList_Load_Parent( l.settings:subsub_category:id, l.settings:subsubcats )" /> <mvt:foreach iterator="subbies" array="subsubcats"> </mvt:foreach>
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment


                      • Well, that didn't work. I produced somewhat similar results as previously mentioned. This time the instead of having the 4 subcategories with all of the parent categories listed below each one, now I have one subcategory with the parent categories followed by 3 more "groups" of the parent categories.

                        It's truly not wanting to load the sub sub categories.
                        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


                        • Originally posted by lesliekirk View Post
                          Well, that didn't work. I produced somewhat similar results as previously mentioned. This time the instead of having the 4 subcategories with all of the parent categories listed below each one, now I have one subcategory with the parent categories followed by 3 more "groups" of the parent categories.

                          It's truly not wanting to load the sub sub categories.
                          Leslie, you mean something like this?

                          https://tinyurl.com/y5nyvfcq
                          Thank you, Bill Davis

                          Comment


                          • It's a bit different than assigning the products to the category. Take a look at this link. It was built with the EmporiumPlus Toolkit.

                            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


                            • Originally posted by lesliekirk View Post
                              Well, that didn't work. I produced somewhat similar results as previously mentioned. This time the instead of having the 4 subcategories with all of the parent categories listed below each one, now I have one subcategory with the parent categories followed by 3 more "groups" of the parent categories.

                              It's truly not wanting to load the sub sub categories.
                              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
                              Bruce Golub
                              Phosphor Media - "Your Success is our Business"

                              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                              phosphormedia.com

                              Comment

                              Working...
                              X

                              This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

                              This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

                              Accept