Jump to content

Edit History

pujionodk

pujionodk

On 3/24/2019 at 2:53 PM, cosmoll said:

 

 

 

I found this solution  - https://stackoverflow.com/questions/53057852/prestashop-1-7-4-x-missing-variables-values-when-using-order-conf-as-new-email

but it not work for me (prestashop 1.7.5.1)

maybe someone found a working solution....??

Thank you
The solution works for me. I'm using presta 1.7.5.1
but I use my own code only to get order date_add

1. I copy OrderHistory.php to /override/classes/order
Then I add {TanggalJT} into $data array which get from $results fields

public function sendEmail($order, $template_vars = false)
    {   
        // I added query for date_add column in orders table
        $result = Db::getInstance()->getRow('
            SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery`, o.`date_add` 
            FROM `' . _DB_PREFIX_ . 'order_history` oh
                LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order`
                LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer`
                LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state`
                LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`)
            WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1');
        if (isset($result['template']) && Validate::isEmail($result['email'])) {
            ShopUrl::cacheMainDomainForShop($order->id_shop);

            $topic = $result['osname'];
            $data = array(
                '{lastname}' => $result['lastname'],
                '{firstname}' => $result['firstname'],
                '{id_order}' => (int) $this->id_order,
                '{order_name}' => $order->getUniqReference(),
				'{TanggalJT}' => date('d M Y H:i:s', strtotime($result['date_add']. ' + 1 days'))  // this I use date_add column for query
            );

 

2. Then I insert {tanggalJT} to bankwire.html email template, it works

image.png.92ccfebf5e26f169b420b6fae7a45adb.png

 

 

pujionodk

pujionodk

On 3/24/2019 at 2:53 PM, cosmoll said:

 

 

 

I found this solution  - https://stackoverflow.com/questions/53057852/prestashop-1-7-4-x-missing-variables-values-when-using-order-conf-as-new-email

but it not work for me (prestashop 1.7.5.1)

maybe someone found a working solution....??

Thank you
The solution works for me

I copy OrderHistory.php to /override/classes/order
Then I add {TanggalJT} into $data array which get from $results column

public function sendEmail($order, $template_vars = false)
    {   
        // I added query for date_add column in orders table
        $result = Db::getInstance()->getRow('
            SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`, os.`pdf_invoice`, os.`pdf_delivery`, o.`date_add` 
            FROM `' . _DB_PREFIX_ . 'order_history` oh
                LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oh.`id_order` = o.`id_order`
                LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON o.`id_customer` = c.`id_customer`
                LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON oh.`id_order_state` = os.`id_order_state`
                LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = o.`id_lang`)
            WHERE oh.`id_order_history` = ' . (int) $this->id . ' AND os.`send_email` = 1');
        if (isset($result['template']) && Validate::isEmail($result['email'])) {
            ShopUrl::cacheMainDomainForShop($order->id_shop);

            $topic = $result['osname'];
            $data = array(
                '{lastname}' => $result['lastname'],
                '{firstname}' => $result['firstname'],
                '{id_order}' => (int) $this->id_order,
                '{order_name}' => $order->getUniqReference(),
				'{TanggalJT}' => date('d M Y H:i:s', strtotime($result['date_add']. ' + 1 days'))  // this I use date_add column for query
            );

 

Then I insert {tanggalJT} to bankwire.html email template, it works

image.png.92ccfebf5e26f169b420b6fae7a45adb.png

 

 

×
×
  • Create New...