This set 'mvt:if' conditionals does not seem to affect display

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cpp-dev
    Mivite


    • Jun 2017
    • 178

    #1

    This set 'mvt:if' conditionals does not seem to affect display

    What: A ReadyTheme content section holding a set of information that relates to specific groups of products, but not all the products where the content section will be displayed.

    Desired outcome: Group the 'sub sections' into mvt:if statements that will only show the relevant information. I have achieved a similar effect before, but it only evaluated a single value not a group of values.

    The code:
    Code:
    <mvt:comment>item dog special</mvt:comment>
    <div class="banner-alert">
      <div class="item-special-head">
          Save on item
      </div>
      <mvt:if expr="l.settings:product:code EQ 'item-9-22-1tab' OR 'item-22-44-1tab' OR 'item-44-88-1tab' OR 'item-88-123-1tab'">
        <div class="banner-text item-special">
          <p>Save $_on Singles</p>
          <p>Use coupon code: <em>code</em></p>
        </div>
      </mvt:if>
      <mvt:if expr="l.settings:product:code EQ 'item-4-9-3tabs' OR 'item-9-22-3tabs' OR 'item-22-44-3tabs' OR 'item-44-88-3tabs' OR 'item-88-123-3tabs'">
        <div class="banner-text item-special" style="border-right: 1px solcode #4178c8; border-left: 1px solcode #4178c8;">
          <p>Save $_on 3 Pack</p>
          <p>Use coupon code: <em>code</em></p>
        </div>
      </mvt:if>
      <mvt:if expr="l.settings:product:code EQ 'item-4-9-6tabs' OR 'item-9-22-6tabs' OR 'item-22-44-6tabs' OR 'item-44-88-6tabs' OR 'item-88-123-6tabs'">
        <div class="banner-text item-special">
          <p>Save $_on 6 Pack</p>
          <p>Use coupon code: <em>Code</em></p>
        </div>
      </mvt:if>
    </div>
    This seems like it should work, but when ever I load one of the pages with this Content Section displayed, it shows all of the sub sections.
  • PCINET - Andreas
    Developer Partner




    • Mar 2006
    • 2439

    #2
    Try this syntax instead:
    <mvt:if expr="l.settings:product:code CIN 'item-9-22-1tab,item-22-44-1tab,item-44-88-1tab,item-88-123-1tab'">
    Andreas Toman
    PCINET, LLC

    Miva Merchant Design, Development, Integration & Support
    We built over 200 Miva Merchant stores!
    Miva shopping cart design & integration service and see our Portfolio!


    e-mail: [email protected]
    web: www.pcinet.com
    LinkedIn: Andreas Toman
    phone: (786) 250-2056 (Miami, FL)

    Comment

    • cpp-dev
      Mivite


      • Jun 2017
      • 178

      #3
      Originally posted by PCINET - Andreas View Post
      Try this syntax instead:
      <mvt:if expr="l.settings:product:code CIN 'item-9-22-1tab,item-22-44-1tab,item-44-88-1tab,item-88-123-1tab'">
      That seems to have done the trick! Wicked!!

      I've not seen the CIN operator before. What does it mean? I'm not seeing it in the docs.
      Last edited by cpp-dev; 08-23-18, 08:35 AM.

      Comment

      • Bruce - PhosphorMedia
        Developer Partner











        • Mar 2006
        • 11256

        #4
        CIN and IN look for specific matching strings within either other strings or variables.

        IN is the same as CIN but only matches the exact case of the string.

        For example:

        If the variable g.testThis is "hello"

        'Hello' IN g.testThis is false
        'hello' IN g.testThis is true
        'Hello' CIN g.testThis is true

        NOTE: Use IN if you know the format of the variable value as its much faster.
        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

        • cpp-dev
          Mivite


          • Jun 2017
          • 178

          #5
          Originally posted by Bruce - PhosphorMedia View Post
          CIN and IN look for specific matching strings within either other strings or variables.

          IN is the same as CIN but only matches the exact case of the string.

          ...

          NOTE: Use IN if you know the format of the variable value as its much faster.
          Thank you, Bruce! Very clear and concise!

          Comment

          Working...
          X