Page 1 of 1

Problem writing to new variable on admin order form

Posted: Thu Nov 21, 2019 6:29 am
by gerstavros
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?

Re: Problem writing to new variable on admin order form

Posted: Thu Nov 21, 2019 2:39 pm
by kestas
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?

Re: Problem writing to new variable on admin order form

Posted: Sat Nov 23, 2019 5:14 am
by gerstavros
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'],

Re: Problem writing to new variable on admin order form

Posted: Sat Nov 23, 2019 4:52 pm
by kestas
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.

Re: Problem writing to new variable on admin order form

Posted: Sun Nov 24, 2019 8:28 pm
by gerstavros
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.

Re: Problem writing to new variable on admin order form

Posted: Tue Nov 26, 2019 3:44 pm
by kestas
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.

Re: Problem writing to new variable on admin order form

Posted: Wed Nov 27, 2019 4:49 am
by gerstavros
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.