Announcement

Collapse
No announcement yet.

Test for products assigned to category

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

    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
    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
    Re: Test for products assigned to category

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

    Comment


      #3
      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
      Larry
      Luce Kanun Web Design
      www.facebook.com/wajake41
      www.plus.google.com/116415026668025242914/posts?hl=en


      Comment


        #4
        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>
        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


          #5
          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.

          Comment

          Working...
          X