Post by kate_brightman » Thu Aug 18, 2016 10:48 am

Hi,
I want to add registered customer level,says,vip,golden,silver, etc on the account page,when customer login his account,he will know his level,and to be polite,generally we prefer show up the welcome words,like hey,welcome John,beside it,show his level.
Shop owner can know in backend,but how to let frontend customer know about it?

Anyone can help?

New member

Posts

Joined
Mon Jul 25, 2016 5:52 pm

Post by IP_CAM » Thu Aug 18, 2016 11:34 am

There was a Discussion on this, you should use the user_group Setup, to make such in an easy way.
And then, I made a Mod for this, but I removed it again from the OC Extension Section, to avoid unpleasant
Subversion -Problems and -Discussions, for the time beeing, at least... ::)

It did work on an OC-2.2.0.0, but I cannot be of help, if it won't work with your Theme.
Ernie

PS:Download and image removed and added in my Post below!
Last edited by IP_CAM on Fri Aug 19, 2016 11:23 pm, edited 3 times in total.

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by kate_brightman » Thu Aug 18, 2016 12:47 pm

Thanks Ernie,that' s what i wanted ,but im not sure if can work it out by writing some codes in the account relevant pages to obtain the backend data--the first name,level set by admin, and make them shown up in frontend page?

New member

Posts

Joined
Mon Jul 25, 2016 5:52 pm

Post by IP_CAM » Fri Aug 19, 2016 11:21 pm

Well, I did not really understand the meaning of your Post, but you sure don't have to modify SOURCE,
just to make it work as planned.
---
Only this VQMOD LINE CONTENT below would have to be changed, possibly a little, in addition to the
USER_GROUP NAME, wich you define in the ADMIN User-Group Section, by example, as:
VIP - Gold - Silver - e.t.c., or whatever you decide on, naming the different User-Groups !
---
Line to adapt to your needs:

Code: Select all

<h3><strong>Welcome <?php echo $customer_group; ?> Group Member <?php echo $text_hello; ?></h3>
---
Therefore, just copy this VqMod below, and upload it into your
vqmod/xml/...
Section, to find out, how it works.

Good Luck ;)
Ernie
---
account_welcome_customer_group.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
<id><![CDATA[Account Welcome plus Customer Group ID]]></id>
<version><![CDATA[OC v.2.2.0]]></version>
<vqmver><![CDATA[2.6.1]]></vqmver>
<author><![CDATA[Ernie - IP_CAM]]></author>
	
    <file name="catalog/controller/account/account.php">
	<operation error="log">
    <search position="before"><![CDATA[$this->load->language('account/account');]]></search>
	<add trim="true"><![CDATA[
    $this->load->model('account/customer');
    $this->load->model('account/customer_group');
    $customer_info =  $this->model_account_customer->getCustomer($this->customer->getId());
    $data['customer_name'] = ($customer_info) ?  $customer_info['firstname'].' '.$customer_info['lastname'] : '';

    if ($this->customer->isLogged()) {
    $customer_group_info = $this->model_account_customer_group->getCustomerGroup($customer_info['customer_group_id']);

    if ($customer_group_info) {
    $data['customer_group'] = $customer_group_info['name'];
    } else {
    $data['customer_group'] = '';
    }
    }
    ]]></add>
    </operation>

	<operation error="log">
    <search position="after"><![CDATA[$data['newsletter'] = $this->url->link('account/newsletter', '', true);]]></search>
	<add trim="true"><![CDATA[
    $this->load->model('account/customer');
    $customer_info = $this->model_account_customer->getCustomer($this->customer->getId());
    $data['text_hello'] = sprintf($this->language->get('text_hello'), $customer_info['firstname']);
    ]]></add>
    </operation>
    </file>
	
	<file name="catalog/language/*/account/account.php">
	<operation error="log">
	<search position="after"><![CDATA[<?php]]></search>
	<add trim="true"><![CDATA[
	$_['text_hello']= '%s</strong>';
	]]></add>
	</operation>
	</file>

	<file name="catalog/view/theme/*/template/account/account.tpl">
	<operation error="log">
    <search position="before"><![CDATA[<h2><?php echo $text_my_account; ?></h2>]]></search>
	<add trim="true"><![CDATA[
    <h3><strong>Welcome <?php echo $customer_group; ?> Group Member <?php echo $text_hello; ?></h3>
    ]]></add>
    </operation>
    </file>
	
</modification>
---

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by kate_brightman » Wed Aug 24, 2016 10:16 am

Nice try bro,one question,will the modification overwrite files?

New member

Posts

Joined
Mon Jul 25, 2016 5:52 pm

Post by IP_CAM » Thu Aug 25, 2016 4:29 am

VqMod's never overwrite SOURCE CODE Files, they just use them, to create and
then place a modified Copy of this File into the VqMod/VqCache/... Sub, from where it
is then called, instead of the DEFAULT OC File. That's the way, VqMod works! :D
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 8 guests