6

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?

Triyugi Narayan Mani
  • 3,039
  • 8
  • 36
  • 56

1 Answers1

1

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.

Jtuck
  • 300
  • 4
  • 7