Jump to content

If Statement To Check If A Selected Product Is In The Cart


Recommended Posts

Hi folks,

 

it's the first time I am posting here, hoping to find some help. Usually I am at the german board, but unfortunatly sometimes that one is a bit lazy, plenty of posts that don't get any answer and so on. I guess this english board is a bit mor active, probably having more users. So I hope some can help me with the following:

 

I order to hide a message that displays the left amount untill free shipping is available in cart, I need to wrap an if-statement around this message inside the tpl file, because I have 1 product, which triggers free shipping anyway regardless cart amount.

 

So my target is to get an if statement that identifys (let's say my product has the ID = 12=) the following:

 

{If productInCart != 12}

this is my message placeholder

{/if}

 

How can give me the right syntax/code snippet to realize that?

 

I guess for developers this might be an easy thing, isn't it?

Link to comment
Share on other sites

  • 7 years later...
On 2/18/2016 at 6:51 PM, Simone Salerno said:

 

 

{if !Context::getContext()->cart->containsProduct(12)}

your message

{/if}

 

 

Hi ,

what if i have 2 or more products in cart, and one of them have 0 price and i want to create/remove a button if any of the product price in cart is 0. how i can write the statement? 

regards 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...