tebdilikiyafet Posted August 21, 2013 Share Posted August 21, 2013 (edited) Hi everybody; When I enter a tracking number, an email is sent to customer. After that when I change status to "shipped" also an email is sent. I think one of them is not necessary. I want to use "shipped" status mail. How can I disable sending tracking email? Edited August 21, 2013 by tebdilikiyafet (see edit history) 1 Link to comment Share on other sites More sharing options...
El Patron Posted August 21, 2013 Share Posted August 21, 2013 assuming 1.5 ps back office-->orders-->statuses set 'send email to customer' to no for whichever status you do not want an email sent Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted August 21, 2013 Author Share Posted August 21, 2013 I know that but there is no status like "in transit", "tracking" or etc. Link to comment Share on other sites More sharing options...
El Patron Posted August 21, 2013 Share Posted August 21, 2013 sorry about that... you would need to update (assuming again 1.5) controllers/admin/AdminOrdersControllers to not send the email. here is the code in a 1.5.4.1, you would need to find the same/similar code for your version and eliminate the mail send /* Update shipping number */ if (Tools::isSubmit('submitShippingNumber') && isset($order)) { if ($this->tabAccess['edit'] === '1') { $order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier')); if (!Validate::isLoadedObject($order_carrier)) $this->errors[] = Tools::displayError('The order carrier ID is invalid.'); elseif (!Validate::isTrackingNumber(Tools::getValue('tracking_number'))) $this->errors[] = Tools::displayError('The tracking number is incorrect.'); else { // update shipping number // Keep these two following lines for backward compatibility, remove on 1.6 version $order->shipping_number = Tools::getValue('tracking_number'); $order->update(); // Update order_carrier $order_carrier->tracking_number = pSQL(Tools::getValue('tracking_number')); if ($order_carrier->update()) { // Send mail to customer $customer = new Customer((int)$order->id_customer); $carrier = new Carrier((int)$order->id_carrier, $order->id_lang); if (!Validate::isLoadedObject($customer)) throw new PrestaShopException('Can\'t load Customer object'); if (!Validate::isLoadedObject($carrier)) throw new PrestaShopException('Can\'t load Carrier object'); $templateVars = array( '{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => $order->id, '{shipping_number}' => $order->shipping_number, '{order_name}' => $order->getUniqReference() ); if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); } else $this->errors[] = Tools::displayError('The order carrier cannot be updated.'); } } else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted August 21, 2013 Author Share Posted August 21, 2013 My version is 1.5.4.1 too. Which row should I remove? Link to comment Share on other sites More sharing options...
El Patron Posted August 21, 2013 Share Posted August 21, 2013 try this (untested) find if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); change to this: // if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, // $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, // _PS_MAIL_DIR_, true, (int)$order->id_shop)) // { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); // } // else // $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); 2 Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted August 21, 2013 Author Share Posted August 21, 2013 Okay it worked, thank you so much. Do you have any idea how can we add tracking url variable to "shipped" mail template? Link to comment Share on other sites More sharing options...
El Patron Posted August 21, 2013 Share Posted August 21, 2013 Okay it worked, thank you so much. Do you have any idea how can we add tracking url variable to "shipped" mail template? I'd suggest opening a new post for that question. Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted August 21, 2013 Author Share Posted August 21, 2013 Okay. The new topic : http://www.prestashop.com/forums/topic/269324-how-can-we-add-tracking-url-variable-to-shipped-mail-template/ Link to comment Share on other sites More sharing options...
asadahmedbe Posted October 2, 2013 Share Posted October 2, 2013 HI friends, I'm using stamps pro to print the labels. When i print a label the tracking number is not updated in the webstore. The stamps.com doc says "Stamps.com will automatically post back to your web store and shopping cart account information data like tracking number and shipping cost. This allows you to easily let your customers know that an order has shipped." All i want to know is how can i insert the tracking number in my webstore after i print the label frm the stamps pro software automatically Link to comment Share on other sites More sharing options...
asadahmedbe Posted October 2, 2013 Share Posted October 2, 2013 @Watt-Wilson, I didn't understand ur question. Link to comment Share on other sites More sharing options...
BoKr Posted February 3, 2014 Share Posted February 3, 2014 Would be very superb if some expert could put this in an override. PS: I would like to have a sticky or wiki like db for all avaible overrrides Link to comment Share on other sites More sharing options...
Roby42 Posted March 28, 2014 Share Posted March 28, 2014 (edited) Dear El Patron, Thanks for providing this solution here. I would also like to disable the automatically sent e-mail after filling in a tracking number. I am using 1.5.5.0 tried to edit AdminOrdersController.php , but I can't find the exact text which you specifiy in this topic. However, I do see this code, can you point me in the right direction how to change this ? /* Update shipping number */ if (Tools::isSubmit('submitShippingNumber') && isset($order)) { if ($this->tabAccess['edit'] === '1') { $order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier')); if (!Validate::isLoadedObject($order_carrier)) $this->errors[] = Tools::displayError('The order carrier ID is invalid.'); elseif (!Validate::isTrackingNumber(Tools::getValue('tracking_number'))) $this->errors[] = Tools::displayError('The tracking number is incorrect.'); else { // update shipping number // Keep these two following lines for backward compatibility, remove on 1.6 version $order->shipping_number = Tools::getValue('tracking_number'); $order->update(); // Update order_carrier $order_carrier->tracking_number = pSQL(Tools::getValue('tracking_number')); if ($order_carrier->update()) { // Send mail to customer $customer = new Customer((int)$order->id_customer); $carrier = new Carrier((int)$order->id_carrier, $order->id_lang); if (!Validate::isLoadedObject($customer)) throw new PrestaShopException('Can\'t load Customer object'); if (!Validate::isLoadedObject($carrier)) throw new PrestaShopException('Can\'t load Carrier object'); $templateVars = array( '{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => $order->id, '{shipping_number}' => $order->shipping_number, '{order_name}' => $order->getUniqReference() ); if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit'), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); } else $this->errors[] = Tools::displayError('The order carrier cannot be updated.'); } } else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } Edited March 28, 2014 by Roby42 (see edit history) Link to comment Share on other sites More sharing options...
shubbing Posted April 27, 2014 Share Posted April 27, 2014 Dear El Patron, Thanks for providing this solution here. I would also like to disable the automatically sent e-mail after filling in a tracking number. I am using 1.5.5.0 tried to edit AdminOrdersController.php , but I can't find the exact text which you specifiy in this topic. However, I do see this code, can you point me in the right direction how to change this ? /* Update shipping number */ if (Tools::isSubmit('submitShippingNumber') && isset($order)) { if ($this->tabAccess['edit'] === '1') { $order_carrier = new OrderCarrier(Tools::getValue('id_order_carrier')); if (!Validate::isLoadedObject($order_carrier)) $this->errors[] = Tools::displayError('The order carrier ID is invalid.'); elseif (!Validate::isTrackingNumber(Tools::getValue('tracking_number'))) $this->errors[] = Tools::displayError('The tracking number is incorrect.'); else { // update shipping number // Keep these two following lines for backward compatibility, remove on 1.6 version $order->shipping_number = Tools::getValue('tracking_number'); $order->update(); // Update order_carrier $order_carrier->tracking_number = pSQL(Tools::getValue('tracking_number')); if ($order_carrier->update()) { // Send mail to customer $customer = new Customer((int)$order->id_customer); $carrier = new Carrier((int)$order->id_carrier, $order->id_lang); if (!Validate::isLoadedObject($customer)) throw new PrestaShopException('Can\'t load Customer object'); if (!Validate::isLoadedObject($carrier)) throw new PrestaShopException('Can\'t load Carrier object'); $templateVars = array( '{followup}' => str_replace('@', $order->shipping_number, $carrier->url), '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => $order->id, '{shipping_number}' => $order->shipping_number, '{order_name}' => $order->getUniqReference() ); if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit'), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order, 'customer' => $customer, 'carrier' => $carrier)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); } else $this->errors[] = Tools::displayError('The order carrier cannot be updated.'); } } else $this->errors[] = Tools::displayError('You do not have permission to edit this.'); } Check the codes in line 309 to 317? They look the same as what El Patron pointed out. 1 Link to comment Share on other sites More sharing options...
Roby42 Posted April 28, 2014 Share Posted April 28, 2014 Many thanks for your reply Shubbing, I will check. Thanks Roby Link to comment Share on other sites More sharing options...
applecart_girl Posted June 30, 2014 Share Posted June 30, 2014 Thanks El Patron for sharing this quick fix. I too don't see the point in having 2 emails going out basically saying the same thing. Thanks for the fix! It was easy to do. I'm running PS 1.6.0.7 Link to comment Share on other sites More sharing options...
lovemyseo Posted March 3, 2015 Share Posted March 3, 2015 I'd suggest opening a new post for that question. When we manually add tracking number using add tracking option on oreser page PS 1.6.0.11 then how can we display Tracking number in email transit email currently its appearing as {shipping_number} i changed to {trascking_number} but still same trascking URl is displaying as Ia dded to carrier setup page. Thanks Link to comment Share on other sites More sharing options...
nickosn Posted November 27, 2015 Share Posted November 27, 2015 try this (untested) find if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int)$order->id_shop)) { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); } else $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); change to this: // if (@Mail::Send((int)$order->id_lang, 'in_transit', Mail::l('Package in transit', (int)$order->id_lang), $templateVars, // $customer->email, $customer->firstname.' '.$customer->lastname, null, null, null, null, // _PS_MAIL_DIR_, true, (int)$order->id_shop)) // { Hook::exec('actionAdminOrdersTrackingNumberUpdate', array('order' => $order)); Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=4&token='.$this->token); // } // else // $this->errors[] = Tools::displayError('An error occurred while sending an email to the customer.'); Hi, How do I fix this on 1.6.0.14? Your code does not seem to work there. Either the submit button does not work or I get a blank page Thank you Link to comment Share on other sites More sharing options...
Recommended Posts