CdF-grafica Posted September 22, 2021 Share Posted September 22, 2021 Hi, I would like to show the customer his "customer group" in the account page (frontend). Example: Customer group: customer Can you help me? Thanks! Link to comment Share on other sites More sharing options...
hshaker Posted September 23, 2021 Share Posted September 23, 2021 C'est faisable, mais il y plus facile Le marchand regroupe ces clients. Il faut mettre un message si la personne est intéressée à passer dans un groupe revendeur par exemple Link to comment Share on other sites More sharing options...
CdF-grafica Posted September 23, 2021 Author Share Posted September 23, 2021 hshaker merci beaucoup pour ta réponse! I explain our need better. We apply a discount to those who subscribe to one of our printed magazines. Who is subscribed to our magazine, we insert him in the "Customer group" "Subscriber". Now the user, when he accesses his account, does not see the group he belongs to (so he cannot see if he is included in the "Subscribers" group). What I would like is that, as information, it is written (in the account page frontend) for example: You belong to the group: "Subscriber" (or "Customer", etc.). How can I show the assigned "Customer group"? Thanks again. Link to comment Share on other sites More sharing options...
hshaker Posted September 23, 2021 Share Posted September 23, 2021 Tray This go to my-account.tpl an add this code {assign var="defaultGroupID" value=Customer::getDefaultGroupId((int)$cookie->id_customer)} {if $defaultGroupID=="1"} {assign var="defaultGroupName" value="YourGroupName"} {elseif $defaultGroupID=="2"} {assign var="defaultGroupName" value="YourGroupName"} {elseif $defaultGroupID=="3"} {assign var="defaultGroupName" value="YourGroupName"} {/if} <h1 class="h1">{l s='My account'} <span id="GroupName" class="{$defaultGroupName|lower}">Partenaire {$defaultGroupName}</span></h1> Adapted $defaultGroupID=="" to your defaultGroupID value="YourGroupName" to your group name Link to comment Share on other sites More sharing options...
Knowband Plugins Posted September 23, 2021 Share Posted September 23, 2021 We want to tell you that it is possible to display customer groups on the account page by modifying the Prestashop core code. Images and File paths for your reference are mentioned below:https://nimbusweb.me/nimbus-screenshots/a5eed04b0c61821cb09f9c85f13cb3e6 File path: YOUR_PS_DIRECTORY/controllers/front/MyAccountController.phphttps://nimbusweb.me/nimbus-screenshots/438a733a0fb87246cfca5a010be68c6a File path: YOUR_PS_DIRECTORY/themes/YOUR_THEME/templates/customer/my-account.tplhttps://nimbusweb.me/nimbus-screenshots/f9c3245299b5c164cdecc654e0de8beb 1 Link to comment Share on other sites More sharing options...
CdF-grafica Posted September 23, 2021 Author Share Posted September 23, 2021 Thanks so much Knowband Plugins, it works perfectly! Thanks also to hshaker. You have been truly precious! Link to comment Share on other sites More sharing options...
salouso Posted May 9, 2022 Share Posted May 9, 2022 Hi Knowband Plugins That works perfectly! One question though: I would prefer to see the information on the "informations" section of "my account". Just putting the code into identity.tpl instead of my-account.tpl only gave me the result of Customer Group: (without an indication of the group name here). What am I missing? And also: this code only brings the default customer group over. How would you alter the code to show all customer groups a specific customer group is attached to? Kind Regards Link to comment Share on other sites More sharing options...
Knowband Plugins Posted March 23, 2023 Share Posted March 23, 2023 Please add the below code in the following files : 1. controllers\front\IdentityController.php $new_customer_obj = new Customer($this->context->customer->id); $customer_groups = ""; foreach($new_customer_obj->getGroups() as $key => $data){ $group = new group($data); $name = $group->name[$this->context->language->id]; $customer_groups .= $name.','; } $this->context->smarty->assign('groups_name', $customer_groups); Screenshot : https://nimb.ws/SpMdRq 2. \themes\{Your-theme}\templates\customer\_partials\customer-form.tpl <div class='form-group row' style="text-align: center;"> {l s='Customer Groups ' d='Shop.Theme.Actions'}: {$groups_name} </div> Screenshot : https://nimb.ws/Gw2dAn It look Like : https://nimb.ws/ZBPbiE 1 Link to comment Share on other sites More sharing options...
hogo20 Posted June 3 Share Posted June 3 hello @Knowband Plugins I test it on prestashop 8.1.5, and work prefect. although this section is not on prestashop 8.1.5 translation .... d='Shop.Theme.Actions' thankyou 1 Link to comment Share on other sites More sharing options...
Knowband Plugins Posted June 4 Share Posted June 4 Hi Hogo, We are pleased to know that we were able to help you. Kindly do not forget to react "Thanks" on our response😄 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