Announcement

Collapse
No announcement yet.

Two cattrees cause duplicate set of sub-categories

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

    Two cattrees cause duplicate set of sub-categories

    I am using two sets of cattree coding. One displays via the normal <mvt:item name="category_tree" /> and is hidden on smaller screens. Then second one was built in a ReadyTheme Content Section can be toggled from the smaller screen nav bar. Everything up to this point works beautifully. It's not until you get to a category page that has sub-categories that the problem arises.

    Using the "new" StoreMorph code to display sub-cats results in each sub-cat being displayed a second time:

    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">
      <div class="subcategory-listing col-md-12 container-fluid clearfix">
        <mvt:foreach iterator="sub_category" array="subcats">
          <div class="col-md-4 col-sm-4 col-xs-6 subcategory-wrapper">
            <div class="subcategory-item box-shadow">
              <div class="item-image">
                <mvt:if expr="l.settings:sub_category:image"> <a href="&mvt:sub_category:link;"><img src="&mvt:sub_category:image;" class="img-responsive" alt="Shop &mvte:sub_category:name; Now" title="Shop &mvte:sub_category:name; Now" /></a>
                  <mvt:else>
                  <a href="&mvt:sub_category:link;"><img src="http://placehold.it/124x236&text=124x236+image" class="img-responsive" alt="Shop &mvte:sub_category:name; Now" title="Shop &mvte:sub_category:name; Now" /></a> </mvt:if>
              </div>
              <div class="item-details">
                <mvt:item name="toolkit" param="customcategory|cust1|l.all_settings:sub_category:id|catadd1" />
                <h5><a href="&mvt:sub_category:link;">&mvte:global:cust1;</a></h5>
              </div>
            </div>
          </div>
        </mvt:foreach>
      </div>
    </mvt:if>
    I could go back to using the Toolkit coding to display this since it doesn't have this problem, but I'd really like to use the "new" coding. I'm thinking there should be a way make the code only display the first instance of the cattree, but then would it affect the small screen display of the sub-category listing?
    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
    Did you ever figure out a way around this? I'm seeing the same behavior.
    Ted Hust
    AarcMediaGroup.com

    Celebrating 13 Years of Outstanding Service & Support
    Miva Merchant Design

    Comment

    Working...
    X