Post by Web-developer » Thu Mar 17, 2011 4:59 am

Hi I am trying to pass value from product page to cart after pressing [add to cart].

I have tried following, in product.tpl

Code: Select all

<input type="text" name="custom_val" value="text">
And then in cart.tpl

Code: Select all

$custom_val = $_POST['custom_val']; echo custom_val;
But above example gave me "undefined" in cart.tpl

Basically I am trying to add custom "text" field to product and be able to display it in shopping card, and probably add it to database in confirm.tpl where order is being created. I can deal with entering those into database, but how do I pass value from [add to cart] up to cart.tpl and canfirm.tpl?

Anyone help please!!! ???

User avatar
Newbie

Posts

Joined
Tue Sep 21, 2010 5:57 pm

Post by Xsecrets » Thu Mar 17, 2011 5:23 am

well that's not really the correct way to do it, but the error in your code is in the cart.tpl to make it work it would be

Code: Select all

$custom_val = $_POST['custom_val']; echo $custom_val;
that won't make it more correct, but should eliminate the error.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US
Who is online

Users browsing this forum: No registered users and 19 guests