I am using Opencart 2.0.1.1
. There is hidden text field on product page that I want to post on cart page. I am following this tutorial but getting Undefined index
issue.
<input type="hidden" name="design" value="12">
I have done the following coding so for:
In catalog/controller/checkout/cart.php
$option['design']=$this->request->post['design'];
$this->cart->add($this->request->post['product_id'],$quantity,$option);
Then in $data['products'][] = array(
added 'design' => $product['design'],
Then in system/library/cart.php
In $this->data[$key] = array(
added 'design' => $options['design'],
Then in cart.tpl in view\theme\template-name\template\checkout\cart.tpl
echo $product['design'];
Can anyone please help me on this issue?
If you are getting a null or invalid index your variable isn't being passed, I would make sure your input is inside the form being submitted and make sure you have it spelled right just in case. Also use php
print _r($_POST);
To verify if its posting the data. If you see it listed then double check your class method.
You would need to provide us with more content so that we could troubleshoot the issue more accurately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With