Announcement

Collapse
No announcement yet.

mvt:else is not displaying

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

    mvt:else is not displaying

    What am I doing wrong here? If there is an Alternate Category Name is displays but if there isn't the Category Name is supposed to display, but it doesn't.

    Code:
    <mvt:if expr="l.settings:customfield_names:customfields:altcatname">
    <section class="o-layout u-hidden u-flex--l">
    <div class="o-layout__item">
    <div class="x-hero" title="&mvte:category:name;">
    <mvt:item name="customfields" param="Read_Category_Code( g.Category_Code, 'altcatname' )" />
    <h1 class="c-heading-delta-cooper u-color-red t-page-title">&mvte:customfields;</h1>
    </div>
    </div>
    </section>
    <mvt:else>
    <section class="o-layout u-hidden u-flex--l">
    <div class="o-layout__item">
    <div class="x-hero" title="&mvte:category:name;">
    <h1 class="c-heading-delta-cooper t-page-title">&mvte:category:name;</h1>
    </div>
    </div>
    </section>
    </mvt:if>
    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
    Reading the custom field needs to be outside the logic block

    Code:
    <mvt:item name="customfields" param="Read_Category_Code( g.Category_Code, 'altcatname', l.settings:lkAltCatName )" />
    
    <mvt:if expr="l.settings:lkAltCatName">
    <section class="o-layout u-hidden u-flex--l">
    <div class="o-layout__item">
    <div class="x-hero" title="&mvte:category:name;">
    <h1 class="c-heading-delta-cooper u-color-red t-page-title">&mvte:customfields;</h1>
    </div>
    </div>
    </section>
    <mvt:else>
    <section class="o-layout u-hidden u-flex--l">
    <div class="o-layout__item">
    <div class="x-hero" title="&mvte:category:name;">
    <h1 class="c-heading-delta-cooper t-page-title">&mvte:category:name;</h1>
    </div>
    </div>
    </section>
    </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


      #3
      Thanks, Bruce, I was even able to fix the boo boo you made and now it works as needed
      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

      Comment


        #4
        Wouldn't the original code have fallen to the ELSE branch if the field was empty or NULL:

        Code:
        <mvt:if expr="l.settings:customfield_names:customfields:altcatname">
        The way I see the code, Yes, grabbing the value before testing the condition is correct, but the original condition, theoretically, should have failed. Otherwise, it was always true somehow.

        Scott
        Need to offer Shipping Insurance?
        Interactive Design Solutions https://www.myids.net
        MivaMerchant Business Partner | Certified MivaMerchant Web Developer
        Competitive Rates, Custom Modules and Integrations, Store Integration
        AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
        My T-shirt Collection is mostly MivaCon T-shirts!!

        Comment


          #5
          Sorry, bad day to stop taking my ADHD meds...

          I meant to also point out that "l.settings:customfield_names:customfields:xxx x is the NAME of the custom field which should be true regardless of whether the value for it was pulled into a variable.
          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

          Working...
          X