Announcement

Collapse
No announcement yet.

Attributes variable if product has no attributes

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

    Attributes variable if product has no attributes

    What's a reasonable variable to use for "if product has no attributes"?

    I'm styling the attributes containing DIV. Looks great on products with attributes, but on products that don't have attributes, this styled DIV still shows, and it's empty. Would prefer it not to display when there are no attributes for the product.

    Using the token list, nothing stands out to me as the right variable.

    Thanks
    Mark


    #2
    You can use miva_array_elements to count the number of elements in the attributes array:

    Code:
    <mvt:assign name="g.attribute_count" value="miva_array_elements( l.settings:attributes )" />
    <mvt:if expr="g.attribute_count EQ 0">
        There are no attributes
    <mvt:else>
        There are attributes
    </mvt:if>
    Last edited by Brennan; 02-09-16, 04:41 PM.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      That did the job.
      Thank you.

      Comment

      Working...
      X