Forums / General Questions / Need an IF statement to check if a product is in cart?

Need an IF statement to check if a product is in cart?

Started by philip937 on 16 Sep 2012, 4:58 PM · Views: 640

Results 1 to 4 of 4
16 Sep 2012, 4:58 PM
#1
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Need an IF statement to check if a product is in cart?

Can anyone help? Am after a simple if statement to test if a specific product I'd is present in the shopping cart. Can it be done with SESSION cart ?

Appreciate any help

Thanks

Phil

Phil Rogers
A problem shared is a problem solved.

16 Sep 2012, 5:39 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Need an IF statement to check if a product is in cart?

You should be able to use to test, for example, products_id 12:
$_SESSION['cart']->in_cart_check('products_id','12')

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Sep 2012, 8:52 PM
#3
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Need an IF statement to check if a product is in cart?

ajeh:

you should be able to use to test, for example, products_id 12:
$_session['cart']->in_cart_check('products_id','12')

i love you!!

Phil Rogers
A problem shared is a problem solved.

16 Sep 2012, 11:07 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Need an IF statement to check if a product is in cart?

You are most welcome ... remember the Zen Cart Team when you are rich and famous ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!