Jump to content

Bulk Order Change - Send Erronous Shipped Emails


PrestashopEnthu

Recommended Posts

I am currently having problem with bulk order change as it is sending "Shipped" emails without replacing the variables {followup} and {code_traking}.

It is fine with single status change and email is sent in order. Unfortunately, email triggered for bulk order status but variables are not replaced well.

Here are the codes below:

     elseif (Tools::isSubmit('submitState') && isset($order)) {
        if ($this->tabAccess['edit'] === '1') {
            $order_state = new OrderState(Tools::getValue('id_order_state'));

            if (!Validate::isLoadedObject($order_state)) {
                $this->errors[] = Tools::displayError('The new order status is invalid.');
            } else {
                $current_order_state = $order->getCurrentOrderState();
                if ($current_order_state->id != $order_state->id) {
                    // Create new OrderHistory
                    $history = new OrderHistory();
                    $history->id_order = $order->id;
                    $history->id_employee = (int)$this->context->employee->id;

                    $use_existings_payment = false;
                    if (!$order->hasInvoice()) {
                        $use_existings_payment = true;
                    }
                    $history->changeIdOrderState((int)$order_state->id, $order, $use_existings_payment);

                    $carrier = new Carrier($order->id_carrier, $order->id_lang);
                    $templateVars = array();
                    $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
                                            '{url_traking}' => $carrier->url,
                                            '{shipping_number}' => $order->shipping_number,
                                            '{code_traking}' => $order->shipping_number);

May I know where can I troubleshoot or locate the codes to check on bulk order status change as I am only having with that now.

Thank you.

Edited by Enthu86 (see edit history)
Link to comment
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
×
×
  • Create New...