Jump to content

Bloquer l'envoi de l'email "Livraison en cours"


Recommended Posts

Bonjour,

Je souhaite bloquer l'envoi d'emails Prestashop pour des ventes marketplaces.

Pour cela, j'ai crée des états de commande spécifiques où j'ai désactivé l'envoi des emails et ça fonctionne :)

PAr contre, dès que je saisis un numéro de suivi dans la commande, un email est envoyé avec l'objet : 

[NOM DU SITE] Livraison en cours

 

Je ne trouve pas comment le désactiver, vous pourriez m'aider ?

J'utilise Prestashop  1.7.6.8

 

Merci par avance,

Prenez soin de vous,

 

Rémy

Share this post


Link to post
Share on other sites

Je pense que j'ai trouvé, mais dès que je commente la fonction, j'ai une erreur 500.

Est-ce que vous avez une idée de ce que je fais mal ?

Merci :)

 

// Update order_carrier
                    $order_carrier->tracking_number = pSQL($tracking_number);
                    if ($order_carrier->update()) {
                        //send mail only if tracking number is different AND not empty
                        if (!empty($tracking_number) && $old_tracking_number != $tracking_number) {
                          if ($order_carrier->sendInTransitEmail($order)) {
                              $customer = new Customer((int) $order->id_customer);
                               $carrier = new Carrier((int) $order->id_carrier, $order->id_lang);

                                Hook::exec('actionAdminOrdersTrackingNumberUpdate', array(
                                    'order' => $order,
                                    'customer' => $customer,
                                    'carrier' => $carrier,
                                ), null, false, true, false, $order->id_shop);

                                Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token);
                           } else {
                           $this->errors[] = $this->trans('An error occurred while sending an email to the customer.', array(), 'Admin.Orderscustomers.Notification');
                            }
                        }
                    } else {
                        $this->errors[] = $this->trans('The order carrier cannot be updated.', array(), 'Admin.Orderscustomers.Notification');
                    }
                }
            } else {
                $this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
            }
        } elseif (Tools::isSubmit('submitState') && isset($order)) {

 

Share this post


Link to post
Share on other sites

En effet, j'ai copié collé le code d'origine.

 

Voici les modifications que j'ai tenté :

// Update order_carrier
                    $order_carrier->tracking_number = pSQL($tracking_number);
                    if ($order_carrier->update()) {
                        //send mail only if tracking number is different AND not empty
                        if (!empty($tracking_number) && $old_tracking_number != $tracking_number) {
                        //  if ($order_carrier->sendInTransitEmail($order)) {
                           //   $customer = new Customer((int) $order->id_customer);
                            //   $carrier = new Carrier((int) $order->id_carrier, $order->id_lang);

                                Hook::exec('actionAdminOrdersTrackingNumberUpdate', array(
                                    'order' => $order,
                                    'customer' => $customer,
                                    'carrier' => $carrier,
                                ), null, false, true, false, $order->id_shop);

                                Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token);
                           } else {
                           $this->errors[] = $this->trans('An error occurred while sending an email to the customer.', array(), 'Admin.Orderscustomers.Notification');
                            }
                        }
                    } else {
                        $this->errors[] = $this->trans('The order carrier cannot be updated.', array(), 'Admin.Orderscustomers.Notification');
                    }
                }
            } else {
                $this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
            }
        } elseif (Tools::isSubmit('submitState') && isset($order)) {

 

Share this post


Link to post
Share on other sites

En effet c'est un peu n'importe quoi^^

Mettez ça à la place

// Update order_carrier
                    $order_carrier->tracking_number = pSQL($tracking_number);
                    if ($order_carrier->update()) {
                        //send mail only if tracking number is different AND not empty
                        /*if (!empty($tracking_number) && $old_tracking_number != $tracking_number) {
                          if ($order_carrier->sendInTransitEmail($order)) {
                              $customer = new Customer((int) $order->id_customer);
                               $carrier = new Carrier((int) $order->id_carrier, $order->id_lang);

                                Hook::exec('actionAdminOrdersTrackingNumberUpdate', array(
                                    'order' => $order,
                                    'customer' => $customer,
                                    'carrier' => $carrier,
                                ), null, false, true, false, $order->id_shop);

                                Tools::redirectAdmin(self::$currentIndex . '&id_order=' . $order->id . '&vieworder&conf=4&token=' . $this->token);
                           } else {
                           $this->errors[] = $this->trans('An error occurred while sending an email to the customer.', array(), 'Admin.Orderscustomers.Notification');
                            }
                        }*/
                    } else {
                        $this->errors[] = $this->trans('The order carrier cannot be updated.', array(), 'Admin.Orderscustomers.Notification');
                    }
                }
            } else {
                $this->errors[] = $this->trans('You do not have permission to edit this.', array(), 'Admin.Notifications.Error');
            }
        } elseif (Tools::isSubmit('submitState') && isset($order)) {

- Si vous commentez en mode ligne des if(....) {   il faut commenter les accolades fermantes }

- inutile de laisser tourner le hook si vous désirez que l'ajout du n° de suivi reste transparent.

Share this post


Link to post
Share on other sites

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More