Post by waitz » Wed Sep 30, 2015 12:43 am

Is it possible to add the Form Field Labels for the name and address that is in the email that the shop owner receives when there is a new order?

In the email You have received an order, it says:

For payment/shipping address:

John Doe
Rocket street 1
1234 Paradise City
Greenland

Instead I would like it to display:

First Name: John
Last Name: Doe
Street Address: Rocket Street 1
Post Code: 1234
City: Paradise City
Country: Greenland

Possible either by change or extension?

Opencart: 3.0.2.1 | Inside Mijoshop 4.0.8 in Joomla 3.9.5


New member

Posts

Joined
Tue Jan 10, 2012 12:22 am

Post by straightlight » Wed Sep 30, 2015 4:33 am

In catalog/model/checkout/order.php file,

find:

Code: Select all

$replace = array(
					'firstname' => $order_info['payment_firstname'],
					'lastname'  => $order_info['payment_lastname'],
					'company'   => $order_info['payment_company'],
					'address_1' => $order_info['payment_address_1'],
					'address_2' => $order_info['payment_address_2'],
					'city'      => $order_info['payment_city'],
					'postcode'  => $order_info['payment_postcode'],
					'zone'      => $order_info['payment_zone'],
					'zone_code' => $order_info['payment_zone_code'],
					'country'   => $order_info['payment_country']
				);
replace with:

Code: Select all

$replace = array(
					'firstname' => str_replace(array('{firstname}'), array($order_info['payment_firstname']), $this->language->get('text_firstname')),
					'lastname'  => str_replace(array('{lastname}'), array($order_info['payment_lastname']), $this->language->get('text_lastname')),
					'company'   => str_replace(array('{company}'), array($order_info['payment_company']), $this->language->get('text_company')),
					'address_1' => str_replace(array('{address_1}'), array($order_info['payment_address_1']), $this->language->get('text_address_1')),
					'address_2' => str_replace(array('{address_2}'), array($order_info['payment_address_2']), $this->language->get('text_address_2')),
					'city'      => str_replace(array('{city}'), array($order_info['payment_city']), $this->language->get('text_city')),
					'postcode'  => str_replace(array('{postcode}'), array($order_info['payment_postcode']), $this->language->get('text_postcode')),
					'zone'      => str_replace(array('{zone}'), array($order_info['payment_zone']), $this->language->get('text_zone')),
					'zone_code' => str_replace(array('{zone_code}'), array($order_info['payment_zone_code']), $this->language->get('text_zone_code')),
					'country'   => str_replace(array('{country}'), array($order_info['payment_country']), $this->language->get('text_country')),
				);
Then, find:

Code: Select all

$replace = array(
					'firstname' => $order_info['shipping_firstname'],
					'lastname'  => $order_info['shipping_lastname'],
					'company'   => $order_info['shipping_company'],
					'address_1' => $order_info['shipping_address_1'],
					'address_2' => $order_info['shipping_address_2'],
					'city'      => $order_info['shipping_city'],
					'postcode'  => $order_info['shipping_postcode'],
					'zone'      => $order_info['shipping_zone'],
					'zone_code' => $order_info['shipping_zone_code'],
					'country'   => $order_info['shipping_country']
				);
replace with:

Code: Select all

$replace = array(
					'firstname' => str_replace(array('{firstname}'), array($order_info['shipping_firstname']), $this->language->get('text_firstname')),
					'lastname'  => str_replace(array('{lastname}'), array($order_info['shipping_lastname']), $this->language->get('text_lastname')),
					'company'   => str_replace(array('{company}'), array($order_info['shipping_company']), $this->language->get('text_company')),
					'address_1' => str_replace(array('{address_1}'), array($order_info['shipping_address_1']), $this->language->get('text_address_1')),
					'address_2' => str_replace(array('{address_2}'), array($order_info['shipping_address_2']), $this->language->get('text_address_2')),
					'city'      => str_replace(array('{city}'), array($order_info['shipping_city']), $this->language->get('text_city')),
					'postcode'  => str_replace(array('{postcode}'), array($order_info['shipping_postcode']), $this->language->get('text_postcode')),
					'zone'      => str_replace(array('{zone}'), array($order_info['shipping_zone']), $this->language->get('text_zone')),
					'zone_code' => str_replace(array('{zone_code}'), array($order_info['shipping_zone_code']), $this->language->get('text_zone_code')),
					'country'   => str_replace(array('{country}'), array($order_info['shipping_country']), $this->language->get('text_country')),
				);
In catalog/language/english/mail/order.php file,

Find:

Code: Select all

$_['text_update_footer']
add below:

Code: Select all

$_['text_firstname'] = 'First name: {firstname}';
$_['text_lastname'] = 'Last name: {lastname}';
$_['text_company'] = 'Company: {company}';
$_['text_address_1'] = 'Address 1: {address_1}';
$_['text_address_2'] = 'Address 2: {address_2}';
$_['text_city'] = 'City: {city}';
$_['text_postcode'] = 'Postcode: {postcode}';
$_['text_zone'] = 'Zone: {zone}';
$_['text_zone_code'] = 'Zone Code: {zone_code}';
$_['text_country'] = 'Country: {country}';
This should return the results you expect in your text email.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by waitz » Wed Sep 30, 2015 5:03 am

WOW, thanks. I'll test it.

Opencart: 3.0.2.1 | Inside Mijoshop 4.0.8 in Joomla 3.9.5


New member

Posts

Joined
Tue Jan 10, 2012 12:22 am
Who is online

Users browsing this forum: No registered users and 83 guests