Announcement

Collapse
No announcement yet.

Conditional to check if specific item is in the cart

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

    Conditional to check if specific item is in the cart

    How can I check to see if a specific item is in the cart? I've been so dependent on toolkit I feel lost lately not being able to use it :)

    I need to check to see if this item is in the cart. If it is I need to hide something so it isn't confusing to the customer.

    The product code is MM_MAGMAIL

    I know this code below doesn't work, I just needed a simple way to explain what I was attempting - LOL!

    <mvt:if expr="'MM_MAGMAIL' GT 0">
    It's in the cart
    <mvt:else>
    It's not in the cart
    </mvt:if>

    P.S. Sorry for all the posts lately - scrambling to get a new product line out and it has so many variables it's maddening. I do appreciate all of the help!

    Mike

    #2
    <mvt:if expr="'l.settings:group:code EQ 'MM_MAGMAIL'">

    should work
    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, it's not working for me.

      <mvt:if expr="'l.settings:group:code' EQ 'MM_MAGMAIL'">
      It's in the cart
      <mvt:else>
      It's not in the cart
      </mvt:if>

      Comment


        #4
        Just so I give you all the information this is on a product page if that matters.

        Comment


          #5
          oh, sorry, yea that's a whole nother ballpart.

          you need to add something like this to the mini-basket items list (where that is depends on framework/version/etc

          mvt:if expr="l.settings:group:code EQ 'your-code'
          mvassign name="g.itsInTheBasket" value="'yes'"
          /mvt:if

          then look for g.itsInTheBasket as in

          mvt:if expr="g.itsInTheBasket"
          do something
          /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


            #6
            Ok thanks, I need to step away for the night - getting syntax errors and my brain is fried :)

            <mvt:if expr="'l.settings:group:code' EQ 'MM_MAGMAIL'">
            <mvt:assign name="g.itsInTheBasket" value="yes">
            </mvt:if>

            <mvt:if expr="'g.itsInTheBasket'">
            It's in the cart
            <mvt:else>
            It's not in the cart
            </mvt:if>

            Comment


              #7
              You're running this within the Items foreach loop in the basket?

              <mvt:if expr="'l.settings:group:code' EQ 'MM_MAGMAIL'">
              <mvt:assign name="g.itsInTheBasket" value="yes">
              </mvt:if>

              If so, what framework are you running? For example, in shadows, you put this in the Global Mini-Basket right after

              <mvt:foreach iterator="item" array="global_minibasket:groups">
              and use l.settings:item:code


              (the thing with foreach loops is that they 'interator' becomes the base array branch for expressing variables. For example, if you had

              <mvt:foreach iterator="whatever" array="global_minibasket:groups">

              then the variable would be l.settings:whatever:code or l.settings:whatever:price, etc.

              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
                I'm using CSSUI framework. Again thanks for the help, I admit I am out of my element here.

                On the product page I am working on I need to see if MM_MAGMAIL is in the cart.

                <mvt:foreach iterator="item" array="basket:items">
                <mvt:if expr="'l.settings:item:product:code' EQ 'MM_MAGMAIL'">
                It's in the cart
                <mvt:else>
                It's not in the cart
                </mvt:if>
                </mvt:foreach>

                Comment

                Working...
                X