24/7 Support - 800.608.6482

Miva Merchant Community Forums

Thread: Syntax to Include a Category Prefix and Exclude a Category Suffix

  1. #1
    Join Date
    Apr 2012
    Posts
    128

    Default Syntax to Include a Category Prefix and Exclude a Category Suffix

    Hello,

    I need to be able to exclude a category suffix in the code below. I am using the following code to include any category that has the prefix "GCD_" and want it to exclude the two categories with the suffix "_BBG" and "_CAG".

    <mvt:if expr="'GCD_' CIN l.settings:category:code">
    do this
    </mvt:if>

    Is there an easy way to do this instead of having a line that would basically include 40+ categories? I am concerned with the line getting too long and slowing things down.

    Thanks in advance,
    Mike

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

    Default Re: Syntax to Include a Category Prefix and Exclude a Category Suffix

    Try:

    Code:
    <mvt:if expr="'GCD_' CIN l.settings:category:code">
    <mvt:if expr="NOT ('_BBG,_CAG' CIN l.settings:category:code)">
    do this
    </mvt:if>
    </mvt:if>

  3. #3
    Join Date
    Mar 2006
    Posts
    6,856

    Default Re: Syntax to Include a Category Prefix and Exclude a Category Suffix

    I don't think that second expression will work because its going to look for "_BBG,_CAG" in the l.settings category code. You would have to write it out as AND NOT( '_BBG' CIN l.settings:category:code) AND NOT( '_CAG' CIN l.settings:category:code).

    You can also just add this to the first expression.

  4. #4
    Join Date
    Apr 2012
    Posts
    128

    Default Re: Syntax to Include a Category Prefix and Exclude a Category Suffix

    Thanks, this one did the trick!

    <mvt:if expr="'GCD_' CIN l.settings:category:code">
    <mvt:if expr="NOT ('_BBG,_CAG' CIN l.settings:category:code)">
    do this
    </mvt:if>
    </mvt:if>

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

    Default Re: Syntax to Include a Category Prefix and Exclude a Category Suffix

    Glad to help.

Posting Rules

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