Announcement

Collapse
No announcement yet.

If / Else to Hide Price with Toolkit's Quicklist / Alsobought

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

    If / Else to Hide Price with Toolkit's Quicklist / Alsobought

    I want to hide the price on $0 items in Toolkit's Alsobought.

    This seems like this should work (And I've tried many other variations):

    <mvt:if expr="l.settings:quicklist:price EQ '0'"><mvt:else><b>Price</b>: &mvt:quicklist:formatted_price;</mvt:if>

    But it doesn't. It hides the the price on all products.

    Any suggestions will be helpful. Thanks!

    #2
    Re: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

    That variable is not in the array. Perhaps test formatted_price for EQ '$0.00'
    Bill Weiland - Emporium Plus http://www.emporiumplus.com/store.mvc
    Online Documentation http://www.emporiumplus.com/tk3/v3/doc.htm
    Question http://www.emporiumplus.com/mivamodu...vc?Screen=SPTS
    Facebook http://www.facebook.com/EmporiumPlus
    Twitter http://twitter.com/emporiumplus

    Comment


      #3
      Re: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

      It works!!! Thanks, Bill!

      Comment


        #4
        Re: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

        FYI: I see this a lot (understandable, if your job title is not developer), but:

        <mvt:if expr="l.settings:quicklist:price EQ '0'"><mvt:else><b>Price</b>: &mvt:quicklist:formatted_price;</mvt:if>

        Should be written as

        <mvt:if expr="l.settings:quicklist:price GT 0"><b>Price</b>: &mvt:quicklist:formatted_price;</mvt:if>

        (Or, as Bill corrected:
        <mvt:if expr="l.settings:quicklist:formatted_price NE '$0.00'"><b>Price</b>: &mvt:quicklist:formatted_price;</mvt:if> )


        The first method actually makes the system to 2 comparisons, the later only 1. (oh, also don't put ' ' around actual numbers.)
        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: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

          I see Bruce. That makes a lot of sense. I'll look at this and other places I have used if / else statements to reduce the number of comparisons made.

          And you are right ... I'm just a guy with a website.

          Comment


            #6
            Re: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

            I am wondering if there is either a bug or I am doing something wrong in my code for this. I have the following code on the page below:

            http://www.ntxtools.com/Merchant/mer...en=nl-template

            <mvt:if expr="l.settings:quicklist:formatted_price GT '$250.00'">
            <div><span class="freeship">FREE SHIPPING</span></div>
            </mvt:if>

            If you look, I have products over $250.00 that show "FREE SHIPPING" correctly, some over $250.00 that do NOT show FREE SHIPPING, and yet some that are under $250.00 that also show "FREE SHIPPING". It appears the quick and vquick functions do not support price, only formatted_price, and it rather unforgiving.

            Any insight is greatly appreciated.

            Regards,

            Eldon
            Last edited by eldon99; 01-27-15, 01:10 PM.

            Comment


              #7
              Re: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

              You can't use "greater than" operators on text strings. Since it has '$' in it, the price is a string not a number, do this:

              <mvt:assign name="l.thisPrice" value="glosub(l.settings:quicklist:formatted_price , '$', '')" />

              then test l.thisPrice
              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


                #8
                Re: If / Else to Hide Price with Toolkit's Quicklist / Alsobought

                Bruce,

                Thank you! I took your code and did one extra step: I spit out the tag to a new variable and stripped the comma as well. I did them in separate strings as I was unsure if you could strip out both the $ and comma in the same command.

                Thanks again!

                Regards,

                Eldon

                PS - At the end of the day, it sure would be nice if the quicklist function would spit out the un-formatted cost and price so you don't have to take these extra steps, but it's nice to have a workaround.
                Last edited by eldon99; 01-28-15, 10:29 AM.

                Comment

                Working...
                X