Post by serkanc » 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

Newbie

Posts

Joined
Wed Feb 27, 2019 3:02 am

Post by straightlight » Sat Mar 09, 2019 11:36 pm

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by serkanc » Sun Mar 10, 2019 3:13 am

Thanks for your kindly reply. I'm using 2.3.0.2 version. Do you have any suggestion for beginning for major changes?

Newbie

Posts

Joined
Wed Feb 27, 2019 3:02 am

Post by straightlight » Sun Mar 10, 2019 4:08 am


Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by serkanc » 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...

Newbie

Posts

Joined
Wed Feb 27, 2019 3:02 am

Post by straightlight » Sun Mar 10, 2019 11:06 pm

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by serkanc » 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 } ?

Newbie

Posts

Joined
Wed Feb 27, 2019 3:02 am

Post by straightlight » Tue Mar 12, 2019 5:15 am

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 } ?

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by serkanc » Tue Mar 12, 2019 5:06 pm

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... ???

Newbie

Posts

Joined
Wed Feb 27, 2019 3:02 am

Post by straightlight » Wed Mar 13, 2019 5:18 am

Pls paste me the topic related to my question...
Absolutely, here: viewforum.php?f=88

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Arnold626 » 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 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?
Last edited by Arnold626 on Thu Apr 15, 2021 12:38 pm, edited 1 time in total.

Newbie

Posts

Joined
Wed Apr 14, 2021 12:07 pm

Post by straightlight » Thu Apr 15, 2021 12:00 am

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Kieran528 » Mon Jul 25, 2022 9:42 pm

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.

Newbie

Posts

Joined
Mon Jul 25, 2022 9:35 pm
Who is online

Users browsing this forum: No registered users and 6 guests