Post by blocks1 » Mon Mar 18, 2019 7:45 pm

i added the following:

Code: Select all

{{ text_shipping_address }}
{{ shipping_firstname }}
{{ shipping_lastname }}
{{ shipping_company }}
{{ shipping_address_1 }}
{{ shipping_address_2 }}
{{ shipping_city }}
{{ shipping_postcode }}
{{ shipping_zone }}
{{ shipping_zone_code }}
{{ shipping_country }}

to
/catalog/view/theme/default/template/mail/order_alert.twig

but doesnt seem to do anything - the areas where i put the code show up as blank spaces

Code: Select all

<br>
on the email, is there something i am doing wrong?


thanks
A

New member

Posts

Joined
Thu Feb 08, 2018 11:14 am

Post by thekrotek » Mon Mar 18, 2019 9:12 pm

Yes, you do. You need to add the corresponding data to controller.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Expert Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by blocks1 » Mon Mar 18, 2019 10:26 pm

i took these from the controller file.. i was expecting they would just work?

New member

Posts

Joined
Thu Feb 08, 2018 11:14 am

Post by blocks1 » Fri Mar 29, 2019 7:05 pm

ok figured it out, but i cant seem to understand why the options associated with the product aren't being passed on in the admin order alert email?

surely these things should be setup by default in the latest opencart?

can any developer on here let me in on which is the best / most stable version of opencart where everything is running from default, paypal express etc..
really worrying as i spend so much time building my site to find out there are so many bugs and issues, as i am not a coder it is very difficult for me and takes 10 times the amount of time to fix the simplest of issues!!

New member

Posts

Joined
Thu Feb 08, 2018 11:14 am

Post by letxobnav » Fri Mar 29, 2019 7:18 pm

well, you started to change the twig file.
Why would you do that if you want everything to work as you require by default.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by xxvirusxx » Fri Mar 29, 2019 7:27 pm

Or you can use this extension (i think this is it), if you want to get same order data from customer mail to admin mail
https://www.opencart.com/index.php?rout ... n_id=35844

Opencart 2.3.0.2 Bugs fix added |Opencart 3.0.3.1 Bugs fix added | Opencart upgrade service


User avatar
Active Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - RO

Post by blocks1 » Fri Mar 29, 2019 9:09 pm

xxvirusxx wrote:
Fri Mar 29, 2019 7:27 pm
Or you can use this extension (i think this is it), if you want to get same order data from customer mail to admin mail
https://www.opencart.com/index.php?rout ... n_id=35844
tried that, just stops emails coming through altogether.. no errors either

New member

Posts

Joined
Thu Feb 08, 2018 11:14 am

Post by letxobnav » Fri Mar 29, 2019 9:33 pm

don't know if you want to do this but...

in catalog/controller/mail/order.php
there is the function:

Code: Select all

public function alert(&$route, &$args) {

in that function a call is made:

Code: Select all

$order_info = $this->model_checkout_order->getOrder($order_id);

that will result in an array $order_info containing all this data on the order:

Code: Select all

				'order_id'                => $order_query->row['order_id'],
				'invoice_no'              => $order_query->row['invoice_no'],
				'invoice_prefix'          => $order_query->row['invoice_prefix'],
				'store_id'                => $order_query->row['store_id'],
				'store_name'              => $order_query->row['store_name'],
				'store_url'               => $order_query->row['store_url'],
				'customer_id'             => $order_query->row['customer_id'],
				'firstname'               => $order_query->row['firstname'],
				'lastname'                => $order_query->row['lastname'],
				'email'                   => $order_query->row['email'],
				'telephone'               => $order_query->row['telephone'],
				'custom_field'            => json_decode($order_query->row['custom_field'], true),
				'payment_firstname'       => $order_query->row['payment_firstname'],
				'payment_lastname'        => $order_query->row['payment_lastname'],
				'payment_company'         => $order_query->row['payment_company'],
				'payment_address_1'       => $order_query->row['payment_address_1'],
				'payment_address_2'       => $order_query->row['payment_address_2'],
				'payment_postcode'        => $order_query->row['payment_postcode'],
				'payment_city'            => $order_query->row['payment_city'],
				'payment_zone_id'         => $order_query->row['payment_zone_id'],
				'payment_zone'            => $order_query->row['payment_zone'],
				'payment_zone_code'       => $payment_zone_code,
				'payment_country_id'      => $order_query->row['payment_country_id'],
				'payment_country'         => $order_query->row['payment_country'],
				'payment_iso_code_2'      => $payment_iso_code_2,
				'payment_iso_code_3'      => $payment_iso_code_3,
				'payment_address_format'  => $order_query->row['payment_address_format'],
				'payment_custom_field'    => json_decode($order_query->row['payment_custom_field'], true),
				'payment_method'          => $order_query->row['payment_method'],
				'payment_code'            => $order_query->row['payment_code'],
				'shipping_firstname'      => $order_query->row['shipping_firstname'],
				'shipping_lastname'       => $order_query->row['shipping_lastname'],
				'shipping_company'        => $order_query->row['shipping_company'],
				'shipping_address_1'      => $order_query->row['shipping_address_1'],
				'shipping_address_2'      => $order_query->row['shipping_address_2'],
				'shipping_postcode'       => $order_query->row['shipping_postcode'],
				'shipping_city'           => $order_query->row['shipping_city'],
				'shipping_zone_id'        => $order_query->row['shipping_zone_id'],
				'shipping_zone'           => $order_query->row['shipping_zone'],
				'shipping_zone_code'      => $shipping_zone_code,
				'shipping_country_id'     => $order_query->row['shipping_country_id'],
				'shipping_country'        => $order_query->row['shipping_country'],
				'shipping_iso_code_2'     => $shipping_iso_code_2,
				'shipping_iso_code_3'     => $shipping_iso_code_3,
				'shipping_address_format' => $order_query->row['shipping_address_format'],
				'shipping_custom_field'   => json_decode($order_query->row['shipping_custom_field'], true),
				'shipping_method'         => $order_query->row['shipping_method'],
				'shipping_code'           => $order_query->row['shipping_code'],
				'comment'                 => $order_query->row['comment'],
				'total'                   => $order_query->row['total'],
				'order_status_id'         => $order_query->row['order_status_id'],
				'order_status'            => $order_query->row['order_status'],
				'affiliate_id'            => $order_query->row['affiliate_id'],
				'commission'              => $order_query->row['commission'],
				'language_id'             => $order_query->row['language_id'],
				'language_code'           => $language_code,
				'currency_id'             => $order_query->row['currency_id'],
				'currency_code'           => $order_query->row['currency_code'],
				'currency_value'          => $order_query->row['currency_value'],
				'ip'                      => $order_query->row['ip'],
				'forwarded_ip'            => $order_query->row['forwarded_ip'],
				'user_agent'              => $order_query->row['user_agent'],
				'accept_language'         => $order_query->row['accept_language'],
				'date_added'              => $order_query->row['date_added'],
				'date_modified'           => $order_query->row['date_modified']
now, if you add any of that data to the $data array like:

Code: Select all

$data['payment_firstname'] = $order_info['payment_firstname'];
before it is passed to the view with:

Code: Select all

$mail->setText($this->load->view('mail/order_alert', $data));
then in the twig (view) file you can display that value with {{ payment_firstname }}

and you can do that with any of the order info values.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan
Who is online

Users browsing this forum: No registered users and 15 guests