jiro Posted May 29, 2014 Share Posted May 29, 2014 Hello, I need to be able to add some variables to the order conf email and if it is possible to the order detail in orders history. I need to get "preferedMachineBoxName" and "alternativeMachineBoxName" values for each order. Those are in ps_carrier_paczkomaty table. You can see this in the attachment. Link to comment Share on other sites More sharing options...
vekia Posted May 29, 2014 Share Posted May 29, 2014 classes/paymentModule.php add there function: public function getpreferedMachineBoxName($id_cart){ return Db::getInstance()->getRow('SELECT preferedMachineBoxName `'._DB_PREFIX_.'carrier_paczkomaty` WHERE id_cart = '.(int)$id_cart); } then to: '{delivery_company}' => $delivery->company, '{delivery_firstname}' => $delivery->firstname, '{delivery_lastname}' => $delivery->lastname, '{delivery_address1}' => $delivery->address1, '{delivery_address2}' => $delivery->address2, '{delivery_city}' => $delivery->city, '{delivery_postal_code}' => $delivery->postcode, '{delivery_country}' => $delivery->country, '{delivery_state}' => $delivery->id_state ? $delivery_state->name : '', '{delivery_phone}' => ($delivery->phone) ? $delivery->phone : $delivery->phone_mobile, '{delivery_other}' => $delivery->other, '{invoice_company}' => $invoice->company, '{invoice_vat_number}' => $invoice->vat_number, '{invoice_firstname}' => $invoice->firstname, '{invoice_lastname}' => $invoice->lastname, '{invoice_address2}' => $invoice->address2, '{invoice_address1}' => $invoice->address1, '{invoice_city}' => $invoice->city, '{invoice_postal_code}' => $invoice->postcode, '{invoice_country}' => $invoice->country, '{invoice_state}' => $invoice->id_state ? $invoice_state->name : '', '{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile, '{invoice_other}' => $invoice->other, '{order_name}' => $order->getUniqReference(), '{date}' => Tools::displayDate(date('Y-m-d H:i:s'),null , 1), '{carrier}' => $virtual_product ? Tools::displayError('No carrier') : $carrier->name, '{payment}' => Tools::substr($order->payment, 0, 32), '{products}' => $this->formatProductAndVoucherForEmail($products_list), '{discounts}' => $this->formatProductAndVoucherForEmail($cart_rules_list), '{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false), '{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $this->context->currency, false), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $this->context->currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false), '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $this->context->currency, false), '{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $this->context->currency, false)); add: '{preferedMachineBoxName}' => $this->getpreferedMachineBoxName($order->id_cart) do the same for second variable (create function + add variable to template) and what if someone will use different delivery method? Link to comment Share on other sites More sharing options...
jiro Posted May 29, 2014 Author Share Posted May 29, 2014 I don't know why but this doesnt work... In order conf mail there is nothing (even {preferedMachineBoxName} doesnt show). When I add {preferedMachineBoxName} to the order-detail.tpl then i cannot show the details of order in customers accout. Link to comment Share on other sites More sharing options...
vekia Posted May 29, 2014 Share Posted May 29, 2014 its a variable to mail, not a variable to tpl file it's huge difference between variables in mail and variables for .tpl file these two parts of shop aren't connected! Link to comment Share on other sites More sharing options...
jiro Posted May 29, 2014 Author Share Posted May 29, 2014 (edited) its a variable to mail, not a variable to tpl file it's huge difference between variables in mail and variables for .tpl file these two parts of shop aren't connected! ok, but this variable doesn't work in mail. Nothing is shown when i add {preferedMachineBoxName} to the mail template I tried something like in here: http://www.prestashop.com/forums/topic/175029-solved-get-a-sagepay-value-from-database-for-mailalert-module/ but doesn't work too... Edited May 29, 2014 by jiro (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 29, 2014 Share Posted May 29, 2014 i made mistake there is no preferedMachineBoxName field in db tehre is preferedBoxMachineName change it in SELECT preferedMachineBoxName sql query Link to comment Share on other sites More sharing options...
jiro Posted May 29, 2014 Author Share Posted May 29, 2014 i made mistake there is no preferedMachineBoxName field in db tehre is preferedBoxMachineName change it in SELECT preferedMachineBoxName sql query i know that there was mistake, i change this by myself... but this changes nothing. I've placed all like You said, but there is nothing in confimration mail. Link to comment Share on other sites More sharing options...
vekia Posted May 29, 2014 Share Posted May 29, 2014 okay so we have to check what function returns change function: public function getpreferedMachineBoxName($id_cart){ return Db::getInstance()->getRow('SELECT preferedMachineBoxName `'._DB_PREFIX_.'carrier_paczkomaty` WHERE id_cart = '.(int)$id_cart); } to: public function getpreferedMachineBoxName($id_cart){ print_r(Db::getInstance()->getRow('SELECT preferedMachineBoxName `'._DB_PREFIX_.'carrier_paczkomaty` WHERE id_cart = '.(int)$id_cart)); die(); } after order you will see blank page with return value of function can you show it, please? Link to comment Share on other sites More sharing options...
jiro Posted May 29, 2014 Author Share Posted May 29, 2014 only blank page shows... without any return value 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