Show ShipStation Tracking Number in Order History

  • Posts: 206
  • Thank you received: 12
  • Hikashop Business
2 months 1 week ago #304650

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.9.3
-- PHP version -- : 7.2

Shipstation is sending the shipping number to the order history page.



How would i go about including the tracking number in order listing page in the customer cPanel? The idea would be for the customer to go to order listing in cPanel, click the tracking number and go to the carrier page with tracking info (or modal).

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 65692
  • Thank you received: 9588
  • MODERATOR
2 months 1 week ago #304652

HI,

In the cpanel_orders.php view file, that you can edit via the menu Display>Views, you would have to run a MySQL query to load the data from the hikashop_history table for the order based on $order->order_id.

We'll look at doing something on our end to be able to add that in the future. Thanks for the idea.

Please Log in or Create an account to join the conversation.

  • Posts: 206
  • Thank you received: 12
  • Hikashop Business
2 months 1 week ago #304811

This is probably not the most elegant solution, but it returns the tracking number, carrier and links to the respective carrier tracking page:

<?php 

              // Get a db connection.
              $db = JFactory::getDbo();

              // Create a new query object.
              $query = $db->getQuery(true);

              $query->select($db->quoteName(array('history_data')));
              $query->from($db->quoteName('jml_hikashop_history'));
              $query->where($db->quoteName('history_order_id') . ' = '. $db->quote($row->order_id));
              $query->where($db->quoteName('history_new_status') . ' = '. $db->quote('shipped'));


              // Reset the query using our newly populated query object.
              $db->setQuery($query);

              // Load the results as a list of stdClass objects (see later for more options on retrieving data).
              $row = $db->loadAssoc();
              // print_r($row['history_data']);
              $shipdata = explode('::', $row['history_data']);


              if ($shipdata[0] == 'USPS') {
              	$track_url = 'https://tools.usps.com/go/TrackConfirmAction?tLabels=' . $shipdata[2];}
              elseif ($shipdata[0] == 'Fedex'){
              	$track_url = 'http://www.fedex.com/Tracking?action=track&tracknumbers=' . $shipdata[2];}


              if($shipdata[2]){
              	echo '<span class=""> ' . $shipdata[1] . '<br/> Tracking Number: ' . '<a href="' . $track_url . '" target="_blank"> ' . $shipdata[2] . '</a></span>';
              }
              ?>

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.055 seconds
Powered by Kunena Forum