Jump to content

Setting up a new variable for mail template


Recommended Posts

Hey Community Members,

 

modul: Planning Delivery by Carrier Modul

Prestaversion: 1.6.09

 

I have installed the module above.

This module is creating a new database table that is called: ps_planning_delivery_carrier

Someone added a new column to it for me with a date.

 

What I need is to have a variable (for example: {shipping_date}) that I can use in my mail templates to send the date to my customer. Every order is getting a new line in that table. So my problem is how to read out that field for the respective order.

 

I have to add, I am not a programmer. But I think I found a part in the module where the date of this field is inserted into a variable:

 $store_query_ican = "SELECT * FROM `ps_planning_delivery_carrier` WHERE `id_order` = '".$_SESSION['orderid']."'";
 $execute_query_ican = mysql_query($store_query_ican);
 $write_array_ican = mysql_fetch_array($execute_query_ican);
 $_SESSION['date_delivery_ican'] = $write_variable_ican['date_delivery_ican'];

So I put this into AdminOrdersController.php at the part where the other variables were created:

// Send mail to customer
                        $store_query_ican = "SELECT * FROM `ps_planning_delivery_carrier` WHERE `id_order` = '".$_SESSION['orderid']."'";
                        $execute_query_ican = mysql_query($store_query_ican);
                        $write_array_ican = mysql_fetch_array($execute_query_ican);
                        $_SESSION['date_delivery_ican'] = $write_variable_ican['date_delivery_ican'];
                        
                        $customer = new Customer((int)$order->id_customer);
                        $carrier = new Carrier((int)$order->id_carrier, $order->id_lang);
                        if (!Validate::isLoadedObject($customer))
                            throw new PrestaShopException('Can\'t load Customer object');
                        if (!Validate::isLoadedObject($carrier))
                            throw new PrestaShopException('Can\'t load Carrier object');
                        $templateVars = array(
                            '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
                            '{firstname}' => $customer->firstname,
                            '{lastname}' => $customer->lastname,
                            '{id_order}' => $order->id,
                            '{shipping_number}' => $order->shipping_number,
                            '{order_name}' => $order->getUniqReference(),
                            '{shipping_date}' => $write_variable_ican
                        );

But anyway - it does not work. I guess the key to that file is the $_SESSION['date_delivery_ican'] Do you know what I do wrong?

 

Thank you very much in advance for your answer.

 

Mattie

Edited by Tupsta (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...