Announcement

Collapse
No announcement yet.

Category Tree with a Random Product Image - Toolkit

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

    Category Tree with a Random Product Image - Toolkit

    I am trying to create a Category Tree with a Random Product Image from Products within each category.

    Problem: The Product Image is not displaying for each Category.

    Can someone take a look and provide some feedback?

    HTML Code:
    <mvt:foreach array="cattree_categories" iterator="cattree_category">
     <a href="&mvte:cattree_category:link;">
    
    <mvt:item name="toolkit" param="sassign|cat_code|l.settings:cattree_category:code" />
    <mvt:item name="toolkit" param="randomcat|pcount|g.cat_code|1" />
    <mvt:if expr="pcount GT 0">
    <mvt:foreach iterator="sub_product" array="sub_products">
    <mvt:item name="toolkit" param="customimage|ipath|l.all_settings:sub_product:id||150|150|" />
    <mvt:if expr="g.ipath AND (NOT ISNULL l.settings:toolkitadditionalimages[1]:generated:image)">
     <img src="&mvte:toolkitadditionalimages[1]:generated:image;" border="0">
     <br />
    <mvt:else>
     <mvt:if expr="(NOT ISNULL l.settings:sub_product:thumbnail)">
      <img src="&mvte:sub_product:thumbnail;" border="0">
      <br />
     </mvt:if>
    </mvt:if>
    </mvt:foreach> 
    </mvt:if>
    
      &mvte:cattree_category:name;
      </a>
    </mvt:foreach>
    I am guessing that this line of code is wrong....
    HTML Code:
    [<mvt:item name="toolkit" param="sassign|cat_code|l.settings:cattree_category:code" />
    Because, when I plug in an actual cat code instead of using "l.settings:cattree_category:code", the image appears for that specific category. But when running through the category array and using "l.settings:cattree_category:code" no images display.


    Many thanks!
    Corina

    #2
    Re: Category Tree with a Random Product Image - Toolkit

    Try <mvt:item name="toolkit" param="sassign|cat_code|l.all_settings:cattree_category:code" />.

    General rule of thumb: If it starts with <mvt:item name="****"> you usually need to include the all_ because of the way the compiler passes local variables through to component modules.





    Last edited by 1337coders; 01-13-14, 07:44 AM.
    Regards,
    Bryan |
    http://1337coders.com

    Comment


      #3
      Re: Category Tree with a Random Product Image - Toolkit

      Thanks! But that did not work either. Any other suggestions?

      Comment


        #4
        Re: Category Tree with a Random Product Image - Toolkit

        Yes, should have seen this earlier. Use vassign.
        <mvt:item name="toolkit" param="vassign|cat_code|l.all_settings:cattree_category:code" />
        Regards,
        Bryan |
        http://1337coders.com

        Comment


          #5
          Re: Category Tree with a Random Product Image - Toolkit

          That was it! Perfect! Thank you!

          Comment


            #6
            Re: Category Tree with a Random Product Image - Toolkit

            Would like to see how this particular project turns out. Please post or PM the link once you finish this particular project.
            Thank you, Bill Davis

            Comment

            Working...
            X