Testing for Category Header/Footer content

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lesliekirk
    Super Moderator











    • Aug 2008
    • 9291

    #1

    Testing for Category Header/Footer content

    I need a way to test for Category Header (or Footer) content and if the field is empty display alternate content. I thought I had figured it out but of course not

    Code:
     <mvt:if expr="ISNULL l.settings:customfield_names:cmp_cssui_pchdft:header">
    <p class="tableheader" style="margin-left:10px;">&mvt:category:name;</p>
    <mvt:else>
    
    <div class="ctgy-header">
    <mvt:item name="prod_ctgy_hdft" param="ctgy_header" />
    </div>
    </mvt:if>
    What am I doing wrong?
    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: X | Facebook | Pinterest
  • Kent Multer
    Mega Mivite









    • Mar 2006
    • 3251

    #2
    I don't think cmp_cssui_pchdft is a valid custom field name. Since the header content is rendered from an mvt:item tag, you may need to put the tag inside an mvt:capture. That will put the content into a variable, and then you can check whether that variable contains any text.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment

    • dreamingdigital
      Mighty Mivite









      • Aug 2006
      • 804

      #3
      I've stumbled upon the same thing Kent did, I forget how or why, but its an easy way for getting info logically from stuff like that. Even combinations of stuff like that. Just output the mvt tag in question within mvt:capture. Now you can do logic on the variable that you choose.

      <mvt:capture variable="g.man_this_is_cool"><mvt:item name="prod_ctgy_hdft" param="ctgy_header" /></mvt:capture>

      &mvt:global:man_this_is_cool; is the contents of the category header.

      Obviously you can run checks on it. like if g.man_this_is_cool NE '' then bla bla bla kazam.

      Hope all that helps and you get some wild and crazy ideas.

      CP
      Colin Puttick
      Miva Web Developer @ Glendale Designs

      Comment

      • lesliekirk
        Super Moderator











        • Aug 2008
        • 9291

        #4
        Originally posted by dreamingdigital View Post
        I've stumbled upon the same thing Kent did, I forget how or why, but its an easy way for getting info logically from stuff like that. Even combinations of stuff like that. Just output the mvt tag in question within mvt:capture. Now you can do logic on the variable that you choose.

        <mvt:capture variable="g.man_this_is_cool"><mvt:item name="prod_ctgy_hdft" param="ctgy_header" /></mvt:capture>

        &mvt:global:man_this_is_cool; is the contents of the category header.

        Obviously you can run checks on it. like if g.man_this_is_cool NE '' then bla bla bla kazam.

        Hope all that helps and you get some wild and crazy ideas.

        CP
        Hey Colin, I sort of understand but sort of don't (what else is new?).

        So are you saying I test for the content but output it using "&mvt:global:man_this_is_cool;" instead of the <mvt:item name="prod_ctgy_hdft" param="ctgy_header" /> tag?
        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: X | Facebook | Pinterest

        Comment

        • lesliekirk
          Super Moderator











          • Aug 2008
          • 9291

          #5
          To answer my own question (and for those who might want to do this too):

          Code:
          <mvt:capture variable="g.man_this_is_cool"><mvt:item name="prod_ctgy_hdft" param="ctgy_header" /></mvt:capture>
          <mvt:if expr="g.man_this_is_cool NE ''">
          <div class="ctgy-header">
          &mvt:global:man_this_is_cool;
          </div>
          <mvt:else>
          <p class="tableheader" style="margin-left:10px;">&mvt:category:name;</p>
          </mvt:if>
          Thank you Colin!
          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: X | Facebook | Pinterest

          Comment

          Working...
          X