Post by davetoff » Tue Apr 21, 2015 7:57 pm

Hi

This is my first post but I've been using this website for some time and it has been a life saver. I'm trying to make sense of a module I'm building in Opencart 1.5.6.4. Customers come to the website make their own design and then go to the cart at the end. The price of the design is dependent on the size of the design. My question is how do I parse all the design data/ and variable cost to the cart? I've tried $this->data->add($product_id, $qty, $options) but whenever I post the data I get the message undefined data, even though I have specified it on that page please see code:

design.tpl
<form name="f2" method="POST" action="module/design>">
<input type="hidden" id="options" name="options" value="<?=$options?>">
<input type="hidden" id="product_id" name="product_id" value="<?=$product_id?>">
<input type="hidden" id="price" name="price" value="<?=$totalcust?>">

<input type="submit" name="submit" class= "button" Value="<?=$button_checkout?>" />

design.php
if (($this->request->server['REQUEST_METHOD'] == 'POST') && isset($this->request->post['product_id'])) {

$this->data['input_height1'] = ($this->request->post['size_height']);
$this->data['input_width1'] = ($this->request->post['size_width']);
$this->data['text_height'] = ($this->request->post['size_text']);
$this->data['text'] = ($this->request->post['text']);

$options = array(
'scale' => $scale,
'textheight' => $text_height,
'text' => $text,
'size_height' => $input_height1,
'size_width' => $input_width1,
);

$this->data['qty'] = 1;
$this->data['price'] = ($this->request->post['price']);
$this->data['product_id'] = 66;

$this->cart->add($product_id, $qty, $options);

$this->redirect($this->url->link('checkout/cart')); //need to direct to cart

}

As you can see from the above I'm getting a little confused, have tried lots of different ways of doing this but all I'm managed to do is confuse myself even more. Help really really appreciated.
D

Newbie

Posts

Joined
Mon Apr 13, 2015 8:35 pm

Post by IP_CAM » Mon Apr 27, 2015 10:37 pm

Just to inform you, I would post such matters strictly in the COMMERCIAL OC-Forum Section, you have a much better chance of beeing replied to. Nobody will work hours, to assist, just for the fun of it, or give away programmer-knowledge, for such CUSTOM Work, probably even able to be sold, in some quantities, if it would exist. But I did not even check, if one does.
Hopefully you'll understand, but we're talking business here, when it comes to Custom Mod's!
Good Luck
Ernie
bigmax.ch/shop/

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 1 guest