Jump to content

Add tracking number before status "Shipped"


Recommended Posts

I guess i need to edit this field in adminfolder/tabs/AdminOrders.php, start line 63

/* Update shipping number */
       if (Tools::isSubmit('submitShippingNumber') AND ($id_order = intval(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order)))
       {
           if ($this->tabAccess['edit'] === '1')
           {
               if (!$order->hasBeenShipped())
                   die(Tools::displayError('The shipping number can only be set once the order has been shipped!'));
               $_GET['view'.$this->table] = true;

               $shipping_number = pSQL(Tools::getValue('shipping_number'));
               $order->shipping_number = $shipping_number;
               $order->update();
               if ($shipping_number)
               {
                   global $_LANGMAIL;
                   $customer = new Customer(intval($order->id_customer));
                   $carrier = new Carrier(intval($order->id_carrier));
                   if (!Validate::isLoadedObject($customer) OR !Validate::isLoadedObject($carrier))
                       die(Tools::displayError());
                   $templateVars = array(
                       '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
                       '{firstname}' => $customer->firstname,
                       '{lastname}' => $customer->lastname,
                       '{id_order}' => intval($order->id)
                   );
                   $subject = 'Package in transit';
                   Mail::Send(intval($order->id_lang), 'in_transit', ((is_array($_LANGMAIL) AND key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname);
               }
           }
           else
               $this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
       }




I want to be able to add the trackingnumber when the status is in "Preparation" so I can include the tracking no. in the shipped mail to my customer. Any ideas? Did find a post for earlier version of Prestashop that I coulnd not fit.

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 1 month later...

You'll have to update AdminOrders.php.

To show the Tracking number field at any stage, comment off this line:
// if ($carrier->url && $order->hasBeenShipped())

To allow the Tracking number field to be updated at any stage, comment off this line:
// if (!$order->hasBeenShipped())
// die(Tools::displayError('The shipping number can only be set once the order has been shipped!'));

Hope this helps.

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

I want to be able to add the trackingnumber when the status is in "Preparation" so I can include the tracking no. in the shipped mail to my customer. Any ideas? Did find a post for earlier version of Prestashop that I coulnd not fit.

I think that the easiest way to do this, is the following:

Go to the "Order statuses" at the "Orders" tab of the Back Office. Edit the "Order shipped" status and disable the "Send e-mail to customer when order is changed to this status" option. By doing this, no mail will be sent but tracking number box will appear when you change an order's status to "Shipped". Then, you can add the track number and click on "Set shipping number" and you will send only one (instead of two) e-mails.

You should edit the "in_transit.html" (or "in_transit.txt") mail template, so that it looks more like the "shipped.html" template that is sent when an order is set to "Shipped" status.
  • Like 1
Link to comment
Share on other sites

  • 8 months later...

 

I think that the easiest way to do this, is the following:

Go to the "Order statuses" at the "Orders" tab of the Back Office. Edit the "Order shipped" status and disable the "Send e-mail to customer when order is changed to this status" option. By doing this, no mail will be sent but tracking number box will appear when you change an order's status to "Shipped". Then, you can add the track number and click on "Set shipping number" and you will send only one (instead of two) e-mails.

You should edit the "in_transit.html" (or "in_transit.txt") mail template, so that it looks more like the "shipped.html" template that is sent when an order is set to "Shipped" status.

 

I tried it, but I still see no track number box. Help me please :(

 

Using prestashop 1.4.4.1

Link to comment
Share on other sites

Hey Guys,

Can the shipping numbers be entered directly into the database? If so, which table.

Thanks

 

Found it :

- It is in a table called 'orders' in a field called shipping.

- I updated my carriers from the admin to include tracking numbers

- It created a new carrier with the tracking enabled

- Went to table called 'orders' and sql statement set all 'carrier' to the new carrier id

- Then sql statement updated all required order_id with shipping numbers

- Works for all orders (before and after enabling tracking)

 

Bada Bing !! it worked

Now i gotta figure how to trigger sending the email, after i set the above and order status via the database

Link to comment
Share on other sites

  • 3 months later...
  • 3 years later...

Hi, my version of presta is 1.6.0.14

 

I have to update manually my orders. I did that and it works like a charm :

 

require_once('../config/config.inc.php');
$id_order=8;
$order = new Order($id_order);
$order->setCurrentState(4);

 

Now i would like to update the tracking number. Wath is the best way to do that ? I think i've to update the two tables : ps_order_carrier qnd ps_orders. Is there anything else to do to considere the order as "shipped" ? I've seen a field "is shipped" but i don't remenber where.

 

Thanks for your help !

 

Mathieu

Edited by kek83 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...