Post by gila » Wed Feb 06, 2008 5:49 pm

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

New member

Posts

Joined
Fri Jan 25, 2008 4:33 am

Post by gila » Wed Feb 06, 2008 6:35 pm

after a few test i found this solution:

!!!try this solution at your own risk!!! ;D

first backup your opencart db and installation!

in the file opencart\catalog\controller\category.php
line 72 add: 

Code: Select all

 'id' => $result['product_id'], 
then line 79 add:

Code: Select all

 $query = array();
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

New member

Posts

Joined
Fri Jan 25, 2008 4:33 am

Post by lucky_slevin » Thu Apr 17, 2008 4:31 am

could you post the code around those "added" codes of yours? so we can find it with a better ease.

___________________________________________________________

http://www.monnaiesjdcoins.com (still in the works)


New member

Posts

Joined
Wed Mar 12, 2008 2:30 am

Post by lucky_slevin » Fri Apr 18, 2008 12:53 am

I tested this solution of yours on my test server and no in fact is does not work.

___________________________________________________________

http://www.monnaiesjdcoins.com (still in the works)


New member

Posts

Joined
Wed Mar 12, 2008 2:30 am

Post by jty » Sun Aug 31, 2008 2:42 am

Follow Gila's instructions carefully. It works on version 0.7.8
Now to extend it to include options

Thank-you Gila.

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by jty » Sun Aug 31, 2008 5:17 am

Oops, there is a bug. It sometimes works and other times it doesn't
I haven't figured out when the bug happens.

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am

Post by jty » Sun Aug 31, 2008 5:39 am

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  :D

jty
Active Member

Posts

Joined
Sat Aug 30, 2008 8:19 am
Who is online

Users browsing this forum: No registered users and 6 guests