Page 1 of 1
How to add addOrderHistroy function to order_list.tpl
Posted: Sat Mar 09, 2019 9:33 pm
by serkanc
I have made a script, which checks the status of the tracking code of orders on order list page and if it's delivered I can write instead of tracking number, "delivered". I want also change the status shipped to completed, but I cannot access addOrderHistory function. I looked at the order_info.tpl ajax codes ( I have no knowledge about ajax ) I have to put a button. Is there any other way to use the function in order_list.tpl.
Thanks
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Sat Mar 09, 2019 11:36 pm
by straightlight
Better to use more recent OC versions, in this case. With the use of local APIs throughout Opencart, it has become easier to access the order histories from the catalog end without major code changes.
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Sun Mar 10, 2019 3:13 am
by serkanc
Thanks for your kindly reply. I'm using 2.3.0.2 version. Do you have any suggestion for beginning for major changes?
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Sun Mar 10, 2019 4:08 am
by straightlight
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Sun Mar 10, 2019 4:37 pm
by serkanc
I’m using already this extention
Also updated xml files to check the shipping status via curl. I will check it again. But i need advice, how to access addOrderHistory function...
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Sun Mar 10, 2019 11:06 pm
by straightlight
serkanc wrote: ↑Sun Mar 10, 2019 4:37 pm
I’m using already this extention Also updated xml files to check the shipping status via curl. I will check it again. But i need advice, how to access addOrderHistory function...
Not mentioned on your first post. Then, contact the extension developer to resolved this issue.
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Mon Mar 11, 2019 7:32 pm
by serkanc
This is not the issue of this extention. I added the lines below to order_list.tpl. It checks the carrier shipping information, if the packaged delivered. If it's delivered than It writes instead of tracking number, "Delivered"... I want also update the status from Shipped to Delivered...
I can update status via extention... Below the code I can add
Code: Select all
if($order['order_status_id'] == 5)
to update the order_status_id to 11....
Code: Select all
$ch = curl_init();
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
);
curl_setopt($ch, CURLOPT_URL, $order['tracking_url']);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$authToken = curl_exec($ch);
if(strpos($authToken, "Teslim Edildi")!=0){
strpos($authToken, "Teslim Edildi");
$konum = strpos($authToken, "Teslim Edildi");
$konumfark = $konum +13;
$konum2 = strpos($authToken, "Teslim Edildi",$konumfark);
$fark = $konum2-$konum-13;
$teslimat = substr($authToken,$konumfark,$fark);
echo "Teslim edildi";
}
else {
echo $order['tracking_no'];
} ?></a></td><?php } ?
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Tue Mar 12, 2019 5:15 am
by straightlight
serkanc wrote: ↑Mon Mar 11, 2019 7:32 pm
This is not the issue of this extention. I added the lines below to order_list.tpl. It checks the carrier shipping information, if the packaged delivered. If it's delivered than It writes instead of tracking number, "Delivered"... I want also update the status from Shipped to Delivered...
I can update status via extention... Below the code I can add
Code: Select all
if($order['order_status_id'] == 5)
to update the order_status_id to 11....
Code: Select all
$ch = curl_init();
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
);
curl_setopt($ch, CURLOPT_URL, $order['tracking_url']);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$authToken = curl_exec($ch);
if(strpos($authToken, "Teslim Edildi")!=0){
strpos($authToken, "Teslim Edildi");
$konum = strpos($authToken, "Teslim Edildi");
$konumfark = $konum +13;
$konum2 = strpos($authToken, "Teslim Edildi",$konumfark);
$fark = $konum2-$konum-13;
$teslimat = substr($authToken,$konumfark,$fark);
echo "Teslim edildi";
}
else {
echo $order['tracking_no'];
} ?></a></td><?php } ?
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Tue Mar 12, 2019 5:06 pm
by serkanc
I can update the STATUS manual, but I want to update with code. I googled it but didn't find any solution. So I decided to ask to this group. Pls paste me the topic related to my question...
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Wed Mar 13, 2019 5:18 am
by straightlight
Pls paste me the topic related to my question...
Absolutely, here:
viewforum.php?f=88
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Wed Apr 14, 2021 12:13 pm
by Arnold626
serkanc wrote: ↑Sat Mar 09, 2019 9:33 pm
I have made a script, which checks the status of the tracking code of orders on order list page and if it's delivered I can write instead of tracking number, "delivered". I want also change the status shipped to completed, but I cannot access addOrderHistory function. I looked at the order_info.tpl ajax codes ( I have no knowledge about ajax ) I have to put a button. Is there any other way to use the function in order_list.tpl
telldunkin.
Thanks
I might want to alter the orders page format, adding a segment, however I can't discover the tpl document. Could somebody help me?
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Thu Apr 15, 2021 12:00 am
by straightlight
Arnold626 wrote: ↑Wed Apr 14, 2021 12:13 pm
serkanc wrote: ↑Sat Mar 09, 2019 9:33 pm
I have made a script, which checks the status of the tracking code of orders on order list page and if it's delivered I can write instead of tracking number, "delivered". I want also change the status shipped to completed, but I cannot access addOrderHistory function. I looked at the order_info.tpl ajax codes ( I have no knowledge about ajax ) I have to put a button. Is there any other way to use the function in order_list.tpl.
Thanks
I might want to alter the orders page format, adding a segment, however I can't discover the tpl document. Could somebody help me?
The solution has been provided above.
Re: How to add addOrderHistroy function to order_list.tpl
Posted: Mon Jul 25, 2022 9:42 pm
by Kieran528
Just remove (int) from your insert query. If your tracking number is in alphanumeric form. Your insert query should look like
mywakehealth :
Code: Select all
$this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int)$order_id . "', order_status_id = '" . (int)$order_status_id . "', notify = '" . (int)$notify . "', comment = '" . $this->db->escape($comment) . "', tracking_number = '" . $this->db->escape($tracking_number) . "', date_added = NOW()");
That's it.