Post by 3antz » Fri Nov 29, 2013 1:25 pm

Hi there,

Does anyone know how to return the customer group name on the checkout email (sent to customer)? I know for sure to edit the .tpl but im not sure the exact command to include.

Can anyone please help?

Thank you

Active Member

Posts

Joined
Sun Oct 02, 2011 6:52 pm

Post by 3antz » Fri Nov 29, 2013 10:10 pm

Hi, I still can't seem to figure this out. I've included <?php echo $text_customer_group; ?><?php echo $customer_group; ?> in order.tpl but I can't seem to get it to display on the confirmation email. Can anyone please help this newbie? :) Thanks.

Active Member

Posts

Joined
Sun Oct 02, 2011 6:52 pm

Post by robertoliver » Sat Feb 06, 2016 8:24 am

i would like to get this too. let me know if you have found the solution.
thanks,
robert

Newbie

Posts

Joined
Sun Sep 20, 2015 4:30 pm

Post by ocart777 » Sat Feb 06, 2016 1:45 pm

catalog/language/your_language/mail/order.php
search for

Code: Select all

$_['text_new_email']  			= 'Email:';
add after

Code: Select all

$_['text_customer_group']  		= 'Customer Group:';
catalog/model/checkout/order.php
search for

Code: Select all

$subject = sprintf($language->get('text_new_subject'), $order_info['store_name'], $order_id);
add before

Code: Select all

$this->load->model('account/customer_group');
$customer_info = $this->model_account_customer->getCustomer($order_info['customer_id']);
$customer_group = $this->model_account_customer_group->getCustomerGroup($customer_info['customer_group_id']);
search for

Code: Select all

$template->data['text_email'] = $language->get('text_new_email');
add after

Code: Select all

$template->data['text_customer_group'] = $language->get('text_customer_group');
$template->data['customer_group'] = $customer_group['name'];
catalog/view/theme/your_theme_name/template/mail/order.tpl
search for

Code: Select all

<b><?php echo $text_email; ?></b> <?php echo $email; ?><br />
add after

Code: Select all

<b><?php echo $text_customer_group; ?></b> <?php echo $customer_group; ?><br />
ONLY APPLIED TO OC1520 - OC1521
Create new file and name it customer_group.php this file content should be:

Code: Select all

<?php
class ModelAccountCustomerGroup extends Model {
	public function getCustomerGroup($customer_group_id) {
		$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer_group cg LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (cg.customer_group_id = cgd.customer_group_id) WHERE cg.customer_group_id = '" . (int)$customer_group_id . "' AND cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
		
		return $query->row;
	}

	public function getCustomerGroups() {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "customer_group cg LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (cg.customer_group_id = cgd.customer_group_id) WHERE cgd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY cg.sort_order ASC, cgd.name ASC");
		
		return $query->rows;
	}
}
?>
and this file should be placed into public_html/catalog/model/account/ folder

ONLY APPLIED TO OC1530 - OC1531
catalog/model/account/customer_group.php
search for

Code: Select all

$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer_group WHERE customer_group_id = '" . (int)$customer_group_id . "'");
replace with

Code: Select all

$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "customer_group cg LEFT JOIN " . DB_PREFIX . "customer_group_description cgd ON (cg.customer_group_id = cgd.customer_group_id) WHERE cg.customer_group_id = '" . (int)$customer_group_id . "' AND cgd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
Last edited by ocart777 on Sun Feb 07, 2016 7:15 pm, edited 2 times in total.

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by ocart777 » Sat Feb 06, 2016 1:48 pm

Clipboard02.jpg

Clipboard02.jpg (14.79 KiB) Viewed 2069 times


You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by robertoliver » Sun Feb 07, 2016 9:44 am

Thank you for the time to help this.
I am using OC 1.5.3.1 with four customer groups: ASIA, AUSTRALIA, AMERICA and EUROPE.
I have followed your instructions, but still no luck (the customer group remains empty).
Would you please check if there any additional scripts/codes to be added?
Again, I really appreciate for your help!

Thanks,
Robert

Attachments

customer_group.jpg

customer_group.jpg (42.57 KiB) Viewed 2055 times


Newbie

Posts

Joined
Sun Sep 20, 2015 4:30 pm

Post by ocart777 » Sun Feb 07, 2016 7:18 pm

robertoliver wrote:Thank you for the time to help this.
I am using OC 1.5.3.1 with four customer groups: ASIA, AUSTRALIA, AMERICA and EUROPE.
I have followed your instructions, but still no luck (the customer group remains empty).
Would you please check if there any additional scripts/codes to be added?
Again, I really appreciate for your help!

Thanks,
Robert
hi, i've edited my post, you can refer there.. but still you need to start over because the previous code will not working as its use the customer_id instead of customer_group_id to search for customer_group in model file

You can't control the weather, but you can change your mood.
You can't modify the visage, but you can show your smile.
You can't command someone else, but you can hold yourself.
You can't forecast tomorrow, but you can using today.
You can't obtain thanks, but you can exert yourself in everything.


OCEXTENSION.COM - YOUR PROFESSIONAL OPENCART EXTENSION STORE


User avatar
Active Member

Posts

Joined
Mon Jun 10, 2013 4:57 pm
Location - Malaysia

Post by robertoliver » Mon Feb 08, 2016 2:59 pm

Hi,
It works great !!!
Thank you so much..

Robert

Newbie

Posts

Joined
Sun Sep 20, 2015 4:30 pm

Post by gtphotography » Wed Dec 02, 2020 11:05 pm

I have done all these in opencart 1.5.6.4 but in mail order customer group is empty.. is there any difference for 1.5.6.4?

User avatar
Newbie

Posts

Joined
Fri Oct 09, 2020 7:11 pm

Who is online

Users browsing this forum: Bing [Bot] and 15 guests