Announcement

Collapse
No announcement yet.

Conditionally display header / footer

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

    Conditionally display header / footer

    Yes, I know the token <mvt:item name="prod_ctgy_hdft" param="ctgy_header" /> is used to display the category header content. If nothing is in the field nothing displays, but I want to add some styling which includes a background color. What I want is to be able to wrap the div tag with a conditional to only display if there is something in the field - just like how the category title image does it.

    Code:
    <mvt:if expr="NOT ISNULL l.settings:category_title:image">            
                  <img src="&mvte:category_title:image;" alt="&mvte:category:name;" class="img-responsive" />
                  
                <mvt:else>
                  </mvt:if>
    I can't seem to figure out variable that will work. This didn't work


    <mvt:if expr="NOT ISNULL l.settings:prod_ctgy_hdft:ctgy_header">

    I looked through Var List and even used the PM Inspector - is it possible this one doesn't have the ability to do this?

    Leslie
    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
    Re: Conditionally display header / footer

    I don't have one with a category header footer, but a product shows:

    l.settings:product:customfield_values:cmp_mmui_pch dft:footer

    (and yes, used PM Inspector :) )

    Also, you could just put the formatting into the Header/footer content.
    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
      Re: Conditionally display header / footer

      I'm also trying to use it to conditionally display tabs on the PROD page layout using the header and/or footer fields for additional content. If the field is empty I don't want the tab to display. Yes, I know I can created Custom Product Fields to do the same thing, but why should I make more when the fields are already there?

      Leslie
      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
        Re: Conditionally display header / footer

        Odd, I see no variable for a populated Product Header verses a non-populated one. Call look closer later, but perhaps its time to use a custom field as a flag (or as the content receptacle).
        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


          #5
          Re: Conditionally display header / footer

          yeah I know - I was trying to avoid creating yet another thing to remember....
          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


            #6
            Re: Conditionally display header / footer

            oh, i hear ya. wonder if there isn't some tricky css that one could use...like setting min-height:0 (depending on how the mark up is created, that will often make any style applied to a container invisible (unless the content itself actually gives it a height). Might try it.
            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


              #7
              Re: Conditionally display header / footer

              Toolkit #67 (header) + #68 (footer) . It would seem to want to return a null value global variable if there was no content. Worth a try?

              EDIT: If not, #5 (vlength) could evaluate the variables created.
              Last edited by nottheusual1; 08-08-14, 05:39 PM. Reason: Clarity

              Comment


                #8
                Re: Conditionally display header / footer

                It would be just the same as using the default token unless I could test to see if there is not content. I need to wrap a conditional around it to be able to hide the div tag that should only display when there is content in the header field. If I use this then it puts me back have to put the div tag in every category header. I'm trying to avoid that. I already have a problem with some store owners copy and pasting html that includes everything from the <html> to the </html> tag. Just trying to KISS it for the store owners.
                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


                  #9
                  Re: Conditionally display header / footer

                  The default token isn't used.

                  #67 and #68 both create global variables that can be tested.

                  "67. Use header to save the category or product header to a variable."

                  "68. Use footer to save the category or product footer to a variable.
                  "

                  If they don't return nulls when empty, you can use vlength (#5) to test either variable for a length greater than zero or one.

                  So I'm not sure what your objection is. Did you try either solution?
                  Last edited by nottheusual1; 08-09-14, 07:22 AM.

                  Comment


                    #10
                    Re: Conditionally display header / footer

                    Thanks Nottheusual1 , that worked perfect for me.
                    Highly caffeinated
                    http://www.coffeehouseexpress.com

                    Comment


                      #11
                      Re: Conditionally display header / footer

                      BTW: I believe the header/footer items for products and categories are just 'render' tokens, so they don't create a variable that holds the data. The toolkit calls are most like doing just that, call the content, and stuff it in a variable. If you don't have toolkit, you might be able to do the following:

                      <mvassign name="g.iHasHeader" value="sexists('/mm5/5.00/templates/s01/p'$l.settings:product:id$'-header.mvc'" />

                      (where s01 is your store's directory)

                      then test for g.iHasHeader.
                      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


                        #12
                        Re: Conditionally display header / footer

                        You are welcome, Jim.

                        Comment

                        Working...
                        X