mtblanche Posted December 10, 2013 Share Posted December 10, 2013 Hi, I would like to integrate Customer ID into one of the templates. It is the Order Confirmation email, that starts with: Hi {firstname} {lastname}, Thank you for shopping with {shop_name}! So I have tried: Hi {firstname} {lastname} {id_customer}, Thank you for shopping with {shop_name}! But it didn't work. I guess I imagined it too simple. Am I using a wrong variable? How can I make this work? Thank you Link to comment Share on other sites More sharing options...
Bill Dalton Posted December 10, 2013 Share Posted December 10, 2013 (edited) This thread is a very good one. http://www.prestashop.com/forums/topic/252825-variables-in-the-email-templates/ But wait ... there is more to it, turns out mail.php isn't the only file and that sometimes it may depend on which module you may have in use, this thread provide a great example, http://www.prestashop.com/forums/topic/284556-solved-email-variables/ Edited December 10, 2013 by Bill Dalton (see edit history) Link to comment Share on other sites More sharing options...
mtblanche Posted December 10, 2013 Author Share Posted December 10, 2013 Hi Bill, thank you for a quick reply. do you suggest I do this? (based on the links up) I am not sure how the variable is defined. Is the below correct please? in the file: classes/order/OrderHistory.php Locate lines below: $data = array( '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{order_name}' => $order->getUniqReference() ); Now replace for this below: $data = array( '{id_customer}' => $result['id_customer'], '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{order_name}' => $order->getUniqReference() ); Link to comment Share on other sites More sharing options...
mtblanche Posted December 10, 2013 Author Share Posted December 10, 2013 Any ideas on this one? It didn't work Link to comment Share on other sites More sharing options...
Bill Dalton Posted December 10, 2013 Share Posted December 10, 2013 First thing you should know is that I have never tried what you want to do. That said, looking at those 2 threads it seemed that Mail.php was the file that you would update unless you were using a module that used its own process. So have you tried playing with mail.php? Anyone reading this thread is more than welcome to jump in here ... Link to comment Share on other sites More sharing options...
mtblanche Posted December 15, 2013 Author Share Posted December 15, 2013 I was advised to use this: It still din't work though, any ideas why? SELECT osl.`template`, c.`lastname`, c.`firstname`, osl.`name` AS osname, c.`email`, os.`module_name`, os.`id_order_state`,c.`id_customer` 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( '{id_customer}' => $result['id_customer'], '{lastname}' => $result['lastname'], '{firstname}' => $result['firstname'], '{id_order}' => (int)$this->id_order, '{order_name}' => $order->getUniqReference() ); Link to comment Share on other sites More sharing options...
mtblanche Posted December 17, 2013 Author Share Posted December 17, 2013 Assuming it is PS v1.5, there is no need to change OrderHistory class. Just edit/override the PaymentModule class and add the id_customer as $data = array('{id_customer}' => $this->context->customer->id, '{firstname}' => $this->context->customer->firstname,'{lastname}' => $this->context->customer->lastname,'{email}' => $this->context->customer->email,... } 1 Link to comment Share on other sites More sharing options...
mtblanche Posted February 25, 2014 Author Share Posted February 25, 2014 Would anyone happen to know what class file to change if one wants the id_customer to be integrated in the registration confirmation email. (account.html) 1 Link to comment Share on other sites More sharing options...
Mihas05 Posted May 6, 2014 Share Posted May 6, 2014 (edited) Would anyone happen to know what class file to change if one wants the id_customer to be integrated in the registration confirmation email. (account.html) Did you find the solution? I have the same problem. Edited May 6, 2014 by Mihas05 (see edit history) Link to comment Share on other sites More sharing options...
rave Posted October 15, 2014 Share Posted October 15, 2014 In version 1.6 I have done as follows:In controllers/front/AuthController.phpsearch: '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, add: '{id_customer}' => $customer->id, Ex: '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{id_customer}' => $customer->id, '{passwd}' => Tools::getValue('passwd')), In email template use: {id_customer} 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now