Page 1 of 1
adding "add to cart" button in the category page
Posted: Wed Feb 06, 2008 5:49 pm
by gila
hello, i'm tring to add the "add to cart" button on every product shown when i click a category so a customer can directly add to cart the article without going in the details of product
if i use this i have an advice of undefined variable product_id
i try i have an advice of udefined index id
how can i do?
thanks to all replies
Re: adding "add to cart" button in the category page
Posted: Wed Feb 06, 2008 6:35 pm
by gila
after a few test i found this solution:
!!!try this solution at your own risk!!!
first backup your opencart db and installation!
in the file opencart\catalog\controller\category.php
line 72 add:
then line 79 add:
then line 80 add:
Code: Select all
$view->set('action_cart', $url->href('product', FALSE, $query));
now in the file opencart\catalog\template\category.tpl
add "" method="post" enctype="multipart/form-data">" after "" line
then add "" />
" after "" line before ""
it seems to work
Re: adding "add to cart" button in the category page
Posted: Thu Apr 17, 2008 4:31 am
by lucky_slevin
could you post the code around those "added" codes of yours? so we can find it with a better ease.
Re: adding "add to cart" button in the category page
Posted: Fri Apr 18, 2008 12:53 am
by lucky_slevin
I tested this solution of yours on my test server and no in fact is does not work.
Re: adding "add to cart" button in the category page
Posted: Sun Aug 31, 2008 2:42 am
by jty
Follow Gila's instructions carefully. It works on version 0.7.8
Now to extend it to include options
Thank-you Gila.
Re: adding "add to cart" button in the category page
Posted: Sun Aug 31, 2008 5:17 am
by jty
Oops, there is a bug. It sometimes works and other times it doesn't
I haven't figured out when the bug happens.
Re: adding "add to cart" button in the category page
Posted: Sun Aug 31, 2008 5:39 am
by jty
OK. I found the bug. The bug was me not following instructions precisely
Line 72 is under
$product_data[] = array(
Silly me put it in the wrong place
