Announcement

Collapse
No announcement yet.

Using / displaying the CTGY Category Tree Tree Image field

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

    Using / displaying the CTGY Category Tree Tree Image field

    I want to use the Category Tree Tree Image field to display a second image on the category page without needing to use the EP Toolkit. I thought the token was

    Code:
    &mvt:cattree_categories:customfield_values:cmp_cssui_cattree:category_tree_image;
    I even made sure the custom field was assigned to the Category Tree Template. That doesn't work. I tried the older token

    Code:
    &mvte:cattree_category:image;
    that didn't work. I give up, what's it supposed to be?
    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
    This is the correct variable to display the category tree image:

    &mvte:cattree_category:image;

    However is is only avaiable in the context of looping though the category tree. There are ways to load it, but since it is already being loaded in the categoy tree loop you can just set a new variable to be the current categories image.

    Code:
    <div id="category-tree">
    <mvt:foreach array="cattree_categories" iterator="cattree_category">
        <mvt:if expr="NOT ISNULL l.settings:category:id AND l.settings:category:id EQ l.settings:cattree_category:id">
        <div class="level-&mvte:cattree_category:level; active">
        <mvt:elseif expr="NOT ISNULL g.Category_Code AND ISNULL l.settings:category:id AND l.settings:cattree_category:code EQ g.Category_Code">
        <mvt:assign name="g.current_category_tree_image" value="l.settings:cattree_category:image" />
        <div class="level-&mvte:cattree_category:level; active">
        <mvt:else>
        <div class="level-&mvte:cattree_category:level;">
        </mvt:if>
            <a href="&mvte:cattree_category:link;">
            <mvt:if expr="l.settings:cattree_category:image">
            <img src="&mvte:cattree_category:image;" alt="&mvte:cattree_category:name;" />
            <mvt:else>
            &mvte:cattree_category:name;
            </mvt:if>
            </a>
        </div>
    </mvt:foreach>
    </div>
    Then you should be able to use &mvt:global:current_category_tree_image; anywhere on the page.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    Working...
    X