24/7 Support - 800.608.6482

Miva Merchant Community Forums

  1. #1
    Join Date
    Aug 2008
    Location
    Pelham, AL
    Posts
    3,630

    Default Test for products assigned to category

    I need to conditional display a category link depending upon if there are products assigned to the category. I have a few pieces of the puzzle but I'm missing the important one.

    Code:
    <mvt:item name="toolkit" param="sassign|cat_code|cat-code-here" />
    
    <mvt:item name="toolkit" param="what param here for pcount" />
    
    <mvt:if expr="pcount GT 0">
    category link
    <mve:else>
    other  link
    </mvt:if>
    What is the param that I need for the pcount?

    Thanks,
    Leslie
    Leslie Kirk (aka Leslie Nord leslienord)
    Miva Merchant Certified Developer
    Miva Merchant Specialist since 1998
    Previously of Webs Your Way

    Email me: leslie@lesliekirk.com
    www.lesliekirk.com

    Follow me: Twitter Twitter Twitter Twitter | Facebook | FourSquare | Pinterest | Flickr

  2. #2
    Join Date
    Jul 2008
    Location
    NE Ohio - Go Cavs!
    Posts
    981

    Default Re: Test for products assigned to category

    21. CXP, but it also creates a product array.

  3. #3
    Join Date
    Dec 2009
    Posts
    1,662

    Default Re: Test for products assigned to category

    On our PROD page, we create a view all in category button like this:
    <mvt:comment> retrieve the category for this product and create a view all in category link </mvt:comment>
    <mvt:item name="toolkit" param="productincategory|incatcount|g.Product_Code " />
    <mvt:if expr="incatcount GT 0">
    <mvt:foreach iterator="incategory" array="incategories">
    </mvt:foreach>
    <b>
    <a style="text-decoration:none" href="http://&mvt:global:domain:name;/CTGY...ory:code;.html" class="button"><font color=black>&nbsp; View all in Category &nbsp;</font></a>
    </mvt:if>

    Does that help?
    Larry

  4. #4
    Join Date
    Mar 2006
    Posts
    7,017

    Default Re: Test for products assigned to category

    What's wrong with :

    l.settings:product_count (&mvt:product_count;)
    Code:
    <mvt:if expr="l.settings:product_count GT 0">
    We have products
    <mvt:else>
    No we don't
    </mvt:if>

  5. #5
    Join Date
    Jul 2008
    Location
    NE Ohio - Go Cavs!
    Posts
    981

    Default Re: Test for products assigned to category

    "What's wrong with"

    Nothing for the current category. My understanding was this was about any/all categories.

    Actually, Toolkit has a way to maintain a category product count via category custom field, then that field can be tested.

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •