Page 1 of 1

Passing New Value To Cart

Posted: Thu Mar 17, 2011 4:59 am
by Web-developer
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!!! ???

Re: Passing New Value To Cart

Posted: Thu Mar 17, 2011 5:23 am
by Xsecrets
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.