So...
Anyone able to help me with this?!
I'm running Opencart v1.5.3.1 and this is exactly how i do it:
In product.tpl added input
Code: Select all
<input type="hidden" name="design" size="2" value="666" />
In catalog/controller/checkout/cart.php
Find:
Code: Select all
$this->data['products'][] = array(
'key' => $product['key'],
'thumb' => $image,
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'stock' => $product['stock'],
'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
'price' => $price,
'total' => $total,
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']),
'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key']),
);
And add this to the bottom:
Then in the same file find:
Code: Select all
$this->cart->add($this->request->post['product_id'], $quantity, $option);
And add this on the line before:
Code: Select all
$option['design']=$this->request->post['design'];
Then open file system\library\cart.php
and find:
Code: Select all
$this->data[$key] = array(
'key' => $key,
'product_id' => $product_query->row['product_id'],
'name' => $product_query->row['name'],
'model' => $product_query->row['model'],
'shipping' => $product_query->row['shipping'],
'image' => $product_query->row['image'],
'option' => $option_data,
'download' => $download_data,
'quantity' => $quantity,
'minimum' => $product_query->row['minimum'],
'subtract' => $product_query->row['subtract'],
'stock' => $stock,
'price' => ($price + $option_price),
'total' => ($price + $option_price) * $quantity,
'reward' => $reward * $quantity,
'points' => ($product_query->row['points'] ? ($product_query->row['points'] + $option_points) * $quantity : 0),
'tax_class_id' => $product_query->row['tax_class_id'],
'weight' => ($product_query->row['weight'] + $option_weight) * $quantity,
'weight_class_id' => $product_query->row['weight_class_id'],
'length' => $product_query->row['length'],
'width' => $product_query->row['width'],
'height' => $product_query->row['height'],
'length_class_id' => $product_query->row['length_class_id'],
);
(There was no "$product_data[] = array(".. suppose this is another version of opencart).
In this I add (last):
Then in both catalog/view/theme/mytheme/template/checkout/cart.tpl and catalog/view/theme/mytheme/template/module/cart.tpl I try to output the value:
Code: Select all
<?php
if($product['design']){
echo $product['design'];
}
?>
inside the foreach-loop..
this is the error the cart module throws:
Notice: Undefined index: design in /home/boomwatch/domains/boomwatches.se/public_html/catalog/view/theme/boomwatches/template/module/cart.tpl on line 12
And this is the error the cart in checkout throws:
Notice: Undefined index: design in /home/boomwatch/domains/boomwatches.se/public_html/vqmod/vqcache/vq2-catalog_controller_checkout_cart.php on line 245
And this is the line which throws the error:
$this->data['products'][] = array(
'key' => $product['key'],
'thumb' => $image,
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'stock' => $product['stock'],
'reward' => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
'price' => $price,
'total' => $total,
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']),
'remove' => $this->url->link('checkout/cart', 'remove=' . $product['key']),
'design' => $product['design'],
);
VERY grateful for any light on this!