PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] How can i find responsible code for "resend email " in order view page admin in prestashop?

 June 30, 2022     prestashop     No comments   

Issue

i am trying to implement dynamic order email template mapping based on order status when order status is changed from a custom grid, i am trying to find the controller or code which is responsible for the "resend email" button or send order email functionality which is in admin view order page.

Any idea where would be that code for send mail ? Take a look at this picture for better understanding enter image description here


Solution

This is this code:

} elseif (Tools::isSubmit('sendStateEmail') && Tools::getValue('sendStateEmail') > 0 && Tools::getValue('id_order') > 0) {
    if ($this->tabAccess['edit'] === '1') {
        $order_state = new OrderState((int)Tools::getValue('sendStateEmail'));

        if (!Validate::isLoadedObject($order_state)) {
            $this->errors[] = Tools::displayError('An error occurred while loading order status.');
        } else {
            $history = new OrderHistory((int)Tools::getValue('id_order_history'));

            $carrier = new Carrier($order->id_carrier, $order->id_lang);
            $templateVars = array();
            if ($order_state->id == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number) {
                $templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
            }

            if ($history->sendEmail($order, $templateVars)) {
                Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&conf=10&token='.$this->token);
            } else {
                $this->errors[] = Tools::displayError('An error occurred while sending the e-mail to the customer.');
            }
        }
    } else {
        $this->errors[] = Tools::displayError('You do not have permission to edit this.');
    }
}

It's from controllers/admin/AdminOrdersController.php



Answered By - Krystian Podemski
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing