Post by gerstavros » Thu Nov 21, 2019 6:29 am

Hello. I ve created a new variable and put it when adding/editing an order from admin panel. while this variable reads properly the new varchar from the order table, it only erases the column when saving.
I ve put

Code: Select all

myvariable = '" . $this->db->escape($data['myvariable']) . "'
in public function addOrder and editOrder at catalog/model/checkout/order.php.
If i change it to

Code: Select all

myvariable = '" . $this->db->escape($data['telephone']) . "'
it saves properly the phone into myvariable. However $data['myvariable'] seems properly connected as

Code: Select all

$data['myvariable'] = $order_info['myvariable'];
in admin controller. Probably need to be assigned to a cataloge controller file but can't find which. Any help please?

New member

Posts

Joined
Mon Apr 04, 2016 12:44 am

Post by kestas » Thu Nov 21, 2019 2:39 pm

gerstavros wrote:
Thu Nov 21, 2019 6:29 am
Hello. I ve created a new variable and put it when adding/editing an order from admin panel. while this variable reads properly the new varchar from the order table, it only erases the column when saving.
I ve put

Code: Select all

myvariable = '" . $this->db->escape($data['myvariable']) . "'
in public function addOrder and editOrder at catalog/model/checkout/order.php.
If i change it to

Code: Select all

myvariable = '" . $this->db->escape($data['telephone']) . "'
it saves properly the phone into myvariable. However $data['myvariable'] seems properly connected as

Code: Select all

$data['myvariable'] = $order_info['myvariable'];
in admin controller. Probably need to be assigned to a cataloge controller file but can't find which. Any help please?
Where and how

Code: Select all

$data['myvariable']
is declared?

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by gerstavros » Sat Nov 23, 2019 5:14 am

kestas wrote:
Thu Nov 21, 2019 2:39 pm
Where and how

Code: Select all

$data['myvariable']
is declared?
Hello. in admin/model/sale/order.php as
return array(
'myvariable' => $order_query->row['myvariable'],

New member

Posts

Joined
Mon Apr 04, 2016 12:44 am

Post by kestas » Sat Nov 23, 2019 4:52 pm

gerstavros wrote:
Sat Nov 23, 2019 5:14 am
kestas wrote:
Thu Nov 21, 2019 2:39 pm
Where and how

Code: Select all

$data['myvariable']
is declared?
Hello. in admin/model/sale/order.php as
return array(
'myvariable' => $order_query->row['myvariable'],
To retrieve your data in model file for adding or editing, you should declare this data in corresponding controller file.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by gerstavros » Sun Nov 24, 2019 8:28 pm

yes, i have already declared the variable in admin/controller/sale/order.php

Code: Select all

            $data['myvariable'] = $order_info['myvariable'];
may should i add to system library like older oc versions? can't see anything relevant there.

New member

Posts

Joined
Mon Apr 04, 2016 12:44 am

Post by kestas » Tue Nov 26, 2019 3:44 pm

gerstavros wrote:
Sun Nov 24, 2019 8:28 pm
yes, i have already declared the variable in admin/controller/sale/order.php

Code: Select all

            $data['myvariable'] = $order_info['myvariable'];
may should i add to system library like older oc versions? can't see anything relevant there.
Wrong.
If you need add to DB your data you must,
In catalog/controller/checkout/confirm.php file find this:

Code: Select all

     $this->load->model('checkout/order');

			$this->session->data['order_id'] = $this->model_checkout_order->addOrder($order_data);
"$order_data" Here are all your data which goes to model file. Above in this file you can find what are declared under "$order_data". So this data goes to model and can be added/edited to DB. The similar with catalog/controller/api/order.php file.
But if you do not have coding skils, better ask for the help in commercial support forum.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by gerstavros » Wed Nov 27, 2019 4:49 am

Thanks for your info.
I have already done everything you wrote, except declaring the data in catalog/controller/checkout/confirm.php .
However i am using the admin panel order function, and the above file declares the data from the front side (or not only?).
I added there too the $order_data['myvariable'] = $this->session->data['myvariable']; . Of course data declaring is added in api functions for sql.
Doesn't work either. I will try adding the custom code to all front side pages too, although they are not used.

New member

Posts

Joined
Mon Apr 04, 2016 12:44 am
Who is online

Users browsing this forum: No registered users and 206 guests