Page 1 of 1

[MOD] check if product is already in cart

Posted: Sat Feb 13, 2010 1:09 am
by alexts
I would like to display "Product already in cart"message next to "add to cart" button if product is already in cart.
I know that I have to edit product.php and pass the variable to product.tpl
I just have no idea how to check cart content from product.php file.
I was wondering if anybody can help me out.

I hope I make sense.

Re: check if product is already in cart

Posted: Sat Feb 13, 2010 1:17 am
by Qphoria
Here you go. vQmod attached
When visiting the product page, if the item is already in the cart, it will show a popup saying that it is already in the cart

Re: check if product is already in cart

Posted: Sat Feb 13, 2010 1:28 am
by alexts
Thank you very much

Re: [MOD] check if product is already in cart

Posted: Fri Jan 22, 2016 9:14 am
by arqueologomusical
Can this be used in Opencart 2.0.1 ??

I need this also as i would be selling unique products, and sometimes people don't realize they have added the product already and error would occur when checking out.

Re: [MOD] check if product is already in cart

Posted: Sat Jan 23, 2016 4:23 am
by Qphoria
arqueologomusical wrote:Can this be used in Opencart 2.0.1 ??

I need this also as i would be selling unique products, and sometimes people don't realize they have added the product already and error would occur when checking out.
I've updated code to work on 1.5.x and 2.x and created as vQmod

Re: [MOD] check if product is already in cart

Posted: Sat Jan 23, 2016 6:59 am
by arqueologomusical
Qphoria wrote:
arqueologomusical wrote:Can this be used in Opencart 2.0.1 ??

I need this also as i would be selling unique products, and sometimes people don't realize they have added the product already and error would occur when checking out.
I've updated code to work on 1.5.x and 2.x and created as vQmod

I downloaded and uploaded the code to my xml folder. do i need to do something else? tried it but dosn't work.

just wondering, in your xml file, the theme its marked as

theme/*/template

do i need to edit that or that is for the currenty theme set?

thank you in advance

Re: [MOD] check if product is already in cart

Posted: Sun Jan 24, 2016 12:49 am
by Qphoria
No need to edit. It uses wildcards. Any errors in the vqmod/logs folder?

Re: [MOD] check if product is already in cart

Posted: Mon Jan 25, 2016 1:44 pm
by arqueologomusical
Qphoria wrote:No need to edit. It uses wildcards. Any errors in the vqmod/logs folder?
I just re-checked, and it partially works but not as desired.

If i enter directly to the product page, and ALERT will say "Product already in cart" if i had in the cart already, but i can still click on the button to add to cart and it keeps adding more.

Also, if i click on the "add to cart" button , whether if its from the catalog view, latest, specials, manufacturers,.. all the pages where the product shows up i can "add to cart" as many times as i want, and keeps going on.

Any ideas how could i

- have this checked from every page where the product displays (catalog, latest, specials, by manufacturer, related)-
- avoid "adding the product" to cart, once its in cart, perhaps "disabling" the button ?

Re: [MOD] check if product is already in cart

Posted: Mon Oct 02, 2017 9:53 pm
by Bastians
Hi,
First off Qphoria thanks for the vqmod system!
I would like to change the "add to cart" button to "in cart" for each individual product on the catagory page.
I've tried editing the supplied vqmod, but when i refresh the category page it's showing "in cart" for all products when a single product is in cart, while the catalog/view/theme/*/template/product/category.tpl has a foreach ($products as $product) and it should validate each cart item per product in the catalog.
Is the code in the catalog/controller/product/category.php causing this problem?
I was wondering if anybody can provide advice or a working edited vqmod, how to implement this for the category view.
Thanks in advance!

Re: [MOD][SOLVED] check if product is already in cart

Posted: Tue Oct 10, 2017 6:49 pm
by Bastians
Bastians wrote:
Mon Oct 02, 2017 9:53 pm
I've finally figured how to acquire my goal.
VQmod attached.

Re: [MOD] check if product is already in cart

Posted: Wed Jul 29, 2020 3:00 pm
by abdulkaderahmad
Can any one help me and update to Opencart V3 ?