I was wondering if someone could help me with a query i have...
I have 3 Customer Groups:
-Public
-Student
-Trade
I would like the account.tpl page to show only certain links to specified customer groups
I.E. when Public are logged in they can only see a link to "page ABC"
When Student are logged in they can see a link to "page XYZ" only
And when Trade are logged in they can see a link to "page XXX" only
How would i go about editing the code to do this?
Appreciate any help anyone can provide
---
Customer Group Restrictions paid, OC v.1.5.1 - v.2.2.0:
http://www.opencart.com/index.php?route ... n_id=25295
---
Extra Pages Based On Customer Group paid, OC v.2.x:
http://www.opencart.com/index.php?route ... n_id=23821
---
Restricted Access Documents & Downloads paid, OC v.1.5.4 - v.2.2.0:
http://www.opencart.com/index.php?route ... n_id=23981
---
Information Pages-Customer Group Wise, attach download to pages paid, OC v.1.5.4 - v.2.2.0:
http://www.opencart.com/index.php?route ... on_id=9681
---
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
I have so far tried adding the below to controller/account.php:
Code: Select all
$this->data['customer_group_id'] = $this->customer->getCustomerGroupId();
Code: Select all
<?php if($customer_group_id != 2) { ?>
<a href="ABC.html">PAGE ABC</a>
<?php } ?>
tell's you, where about to look! Just let me know, in private, it you've got it made, I could
not do it, without spending ages on such...
User Account Welcome with Customer Group ID Title or Logo
http://www.opencart.com/index.php?route ... n_id=27046
Good Luck !
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
In your account.php file,kiaraaliano wrote:Thanks Ernie, though I would prefer not to purchase an extension as after much searching online, i feel like it would only be a few lines of code required, i just am not 100% sure which lines.
I have so far tried adding the below to controller/account.php:And then added this to account.tpl:Code: Select all
$this->data['customer_group_id'] = $this->customer->getCustomerGroupId();
No luck so far but i think i could be close?Code: Select all
<?php if($customer_group_id != 2) { ?> <a href="ABC.html">PAGE ABC</a> <?php } ?>
Code: Select all
if ($this->customer->isLogged()) {
$this->data['customer_group_id'] = $this->customer->getGroupId();
} elseif ($this->config->get('config_customer_group_id')) {
$this->data['customer_group_id'] = $this->config->get('config_customer_group_id');
}
Code: Select all
<?php if ((int)$customer_group_id == 2) { ?>
<a href="ABC.html">PAGE ABC</a>
<?php } ?>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I wonder if i am placing the code in the wrong part of controller/account/account.php file - is there a specific line i need to put the code so it follows another code and works properly? I have tried a few positions but nothing works...
This is the standard code:
Code: Select all
<?php
class ControllerAccountAccount extends Controller {
public function index() {
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL');
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
}
Code: Select all
<?php
class ControllerAccountAccount extends Controller {
public function index() {
if (!$this->customer->isLogged()) {
$this->session->data['redirect'] = $this->url->link('account/account', '', 'SSL');
$this->response->redirect($this->url->link('account/login', '', 'SSL'));
$this->data['customer_group_id'] = $this->customer->getGroupId();
} elseif ($this->config->get('config_customer_group_id')) {
$this->data['customer_group_id'] = $this->config->get('config_customer_group_id');
}
}
This could be used, linked internally with custom information Pages, or then regular html/php pages, placed in the Shop Root Section, as well. Sample Information Page Links are included, more or less href-Links and/or Customer Group Sections could be placed, if required !
Good Luck !
Ernie
---
custom_links_customer_group_account_oc_156.xml VqMod, tested on OC v.1.5.6.4+ only!
custom_links_customer_group_account_oc_22.xml VqMod, tested on OC v.2.2.x only!
can be found here to download:
http://www.opencart.com/index.php?route ... n_id=27146
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Based on the code you pasted, i got it to work!
For anyone else looking to solve this issue, look for this line in controller/account/account.php:
Code: Select all
$this->load->language('account/account');
Code: Select all
if ($this->customer->isLogged()) {
$data['customer_group_id'] = $this->customer->getGroupId();
} elseif ($this->config->get('config_customer_group_id')) {
$data['customer_group_id'] = $this->config->get('config_customer_group_id');
}
Code: Select all
<?php if ((int)$customer_group_id == 1) { ?>
<a href="URL HERE">PUBLIC</a><br>
<?php } ?>
<?php if ((int)$customer_group_id == 2) { ?>
<a href="URL HERE">TRADE</a>
<?php } ?>
<?php if ((int)$customer_group_id == 3) { ?>
<a href="URL HERE">STUDENT</a>
<?php } ?>
An aside note to indicate that ... I did posted this block of code in the first place.kiaraaliano wrote:Thanks so much Ernie!! That code helped me crack it and it works perfectly
Based on the code you pasted, i got it to work!
For anyone else looking to solve this issue, look for this line in controller/account/account.php:
Paste this code below it:Code: Select all
$this->load->language('account/account');
Then customise the below code as needed and add it to your account.tpl file:Code: Select all
if ($this->customer->isLogged()) { $data['customer_group_id'] = $this->customer->getGroupId(); } elseif ($this->config->get('config_customer_group_id')) { $data['customer_group_id'] = $this->config->get('config_customer_group_id'); }
Code: Select all
<?php if ((int)$customer_group_id == 1) { ?> <a href="URL HERE">PUBLIC</a><br> <?php } ?> <?php if ((int)$customer_group_id == 2) { ?> <a href="URL HERE">TRADE</a> <?php } ?> <?php if ((int)$customer_group_id == 3) { ?> <a href="URL HERE">STUDENT</a> <?php } ?>
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
I was in such a flurry and so excited to have the code work i forgot to give all thanks where they were due! I feel terrible
Your assistance has been much appreciated, thank you very much
http://www.opencart.com/index.php?route ... n_id=27146
---
And to find out, if the VqMod works, or if it produces any Errors, or Missings, and where,
you could download my nice little free OpenShop Tweak VqMod-Manager 156, if you don't have
such a VqMod-Tool installed in your Shop already. I assume, it should function in v.1.5.4 as well.
It does not need to be activated, and it's linked to the Header Menu by a VqMod. And if it don't work,
it's only 4 files, to remove again...
Good Luck !
Ernie
http://www.openshop.li/downloads/Ernies_Tweaks.zip
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
not working 2.1.0.2 can you help me ? pleasestraightlight wrote: ↑Wed Jun 29, 2016 7:06 pmAn aside note to indicate that ... I did posted this block of code in the first place.kiaraaliano wrote:Thanks so much Ernie!! That code helped me crack it and it works perfectly
Based on the code you pasted, i got it to work!
For anyone else looking to solve this issue, look for this line in controller/account/account.php:
Paste this code below it:Code: Select all
$this->load->language('account/account');
Then customise the below code as needed and add it to your account.tpl file:Code: Select all
if ($this->customer->isLogged()) { $data['customer_group_id'] = $this->customer->getGroupId(); } elseif ($this->config->get('config_customer_group_id')) { $data['customer_group_id'] = $this->config->get('config_customer_group_id'); }
Code: Select all
<?php if ((int)$customer_group_id == 1) { ?> <a href="URL HERE">PUBLIC</a><br> <?php } ?> <?php if ((int)$customer_group_id == 2) { ?> <a href="URL HERE">TRADE</a> <?php } ?> <?php if ((int)$customer_group_id == 3) { ?> <a href="URL HERE">STUDENT</a> <?php } ?>
Users browsing this forum: Bing [Bot] and 165 guests