Announcement

Collapse
No announcement yet.

List all products in a known category

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

    List all products in a known category

    I am trying to use the Toolkit cxp and/or cxpc functions to pull a list of all the products in a particular category "mycategorycode" for a dropdown. I don't want all the categories to display, just the one that I need. The problem is that the Toolkit function only seems to work to list all products in all categories. I basically want to replace "g.Category_Code" with "mycategorycode" in the following Toolkit code.

    <mvt:item name="toolkit" param="cxpc|pcount|g.Category_Code" /> to <mvt:item name="toolkit" param="cxpc|pcount|mycategorycode" />

    I've tried several variations but none are working. Not sure what I'm overlooking or if I need to use some other function to accomplish this.

    Thanks for any insight.

    #2
    Use something like the following (no toolkit)

    Code:
    <mvt:do name="l.doit" file="g.Module_Library_DB" value="Category_Load_Code( 'yourCatCodeHere', l.settings:thisCategory)" />
    <mvt:do name="l.doit" file="g.Module_Library_DB" value="Runtime_ProductList_Load_Offset_Category( l.settings:thisCategory:id, g.Offset, 100, g.NextOffset, l.settings:myProducts )" />
    
    <mvt:comment> Now you have an array of products so</mvt:comment>
    
    <mvt:foreach iterator="product" array="myProducts">
    
    &mvt:product:code;
    &mvt:product:name;
    &mvt:product:thumb;
    etc
    
    </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


      #3
      Thanks Bruce, I'll have to give that a try! I think I finally got it work with Toolkit too. Had to use the parentcat function then the cxpc...

      <!-- Display all products in mycategory-->
      <mvt:item name="toolkit" param="parentcat|pccount" />
      <mvt:foreach iterator="parent_category" array="parent_categories">
      <mvt:if expr="('mycategory' CIN l.settings:parent_category:code)" >
      <li><a href="/category/&mvta:parent_category:code;.html"><span>&mvt:paren t_category:name;</span></a>

      <ul>
      <mvt:item name="toolkit" param="cxpc|pcount|l.all_settings:parent_category: code" />
      <mvt:foreach iterator="sub_product" array="sub_products">
      <mvt:if expr="pcount GT 0">
      <li><a href="/product/&mvta:parent_category:code;/&mvta:sub_product:code;.html">
      <span>&mvt:sub_product:name;</span></a>
      </li>
      </mvt:if>
      </mvt:foreach>
      </ul>

      </li>
      </mvt:if>
      </mvt:foreach>

      Comment

      Working...
      X