Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...