Post by kiaraaliano » Wed Jun 29, 2016 8:24 am

Hello everyone,

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 :)
Last edited by kiaraaliano on Wed Jun 29, 2016 11:40 am, edited 1 time in total.

New member

Posts

Joined
Thu Jan 29, 2015 8:22 am

Post by IP_CAM » Wed Jun 29, 2016 9:20 am

chck on this here:
---
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
Last edited by IP_CAM on Wed Jun 29, 2016 9:48 am, edited 1 time in total.

For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

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

Post by kiaraaliano » Wed Jun 29, 2016 9:31 am

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:

Code: Select all

$this->data['customer_group_id'] = $this->customer->getCustomerGroupId();
And then added this to account.tpl:

Code: Select all

<?php if($customer_group_id != 2) { ?>
<a href="ABC.html">PAGE ABC</a>
<?php } ?>
No luck so far but i think i could be close?

New member

Posts

Joined
Thu Jan 29, 2015 8:22 am

Post by IP_CAM » Wed Jun 29, 2016 9:53 am

Well, let me give you a hint, at least, since you seem to have some knowledge on such, it at least
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

For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

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

Post by straightlight » Wed Jun 29, 2016 10:03 am

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:

Code: Select all

$this->data['customer_group_id'] = $this->customer->getCustomerGroupId();
And then added this to account.tpl:

Code: Select all

<?php if($customer_group_id != 2) { ?>
<a href="ABC.html">PAGE ABC</a>
<?php } ?>
No luck so far but i think i could be close?
In your account.php file,

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');
}
In your account.tpl file, you could add as you demonstrated:

Code: Select all

<?php if ((int)$customer_group_id == 2) { ?>
    <a href="ABC.html">PAGE ABC</a>
<?php } ?>
Note: If you wish to load a local page from your site, it would be best to load it from a specific controller file as you cannot locate a template file directly without using the route on the URL towards the same or another controller file.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

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

Post by kiaraaliano » Wed Jun 29, 2016 10:28 am

Thank you so much for your replies...

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'));
			
			
		}
This is where i have placed it with no luck:

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');
}

		}

New member

Posts

Joined
Thu Jan 29, 2015 8:22 am

Post by IP_CAM » Wed Jun 29, 2016 10:58 am

Great Code, straightlight, thank you!
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

Attachments

user_group_custom_links.jpg

Customer Group specific Custom Information Page Links on Account Page OC v.2.2.0.0 - user_group_custom_links.jpg (68.23 KiB) Viewed 1680 times

Last edited by IP_CAM on Mon Jul 04, 2016 6:48 am, edited 12 times in total.

For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

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

Post by kiaraaliano » Wed Jun 29, 2016 11:39 am

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:

Code: Select all

		$this->load->language('account/account');
Paste this code below it:

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');
      }
Then customise the below code as needed and add it to your account.tpl file:

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 } ?>

New member

Posts

Joined
Thu Jan 29, 2015 8:22 am

Post by straightlight » Wed Jun 29, 2016 7:06 pm

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:

Code: Select all

		$this->load->language('account/account');
Paste this code below it:

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');
      }
Then customise the below code as needed and add it to your account.tpl file:

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.

The most generated errors being found on Opencart forum originates from contributed programming. The increased counters are caused by posted redundancies of the same solutions that were already provided prior.

F. Rules:

- viewtopic.php?f=176&t=200480
- viewtopic.php?f=176&t=200804


Regards,
Straightlight


Legendary Member

Posts

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

Post by kiaraaliano » Thu Jun 30, 2016 9:29 am

My apologies Straightlight, you sure did!

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

New member

Posts

Joined
Thu Jan 29, 2015 8:22 am

Post by Forcer » Thu Aug 25, 2016 5:29 pm

What should be done to code to work on 1.5.4?

Newbie

Posts

Joined
Thu Aug 25, 2016 5:13 pm

Post by IP_CAM » Fri Aug 26, 2016 11:29 am

just find out, why not just testing the.1.5.6 Version VqMod !?
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... :D

Good Luck ! ;)
Ernie

http://www.openshop.li/downloads/Ernies_Tweaks.zip

Attachments

ernies_tweaks_156.jpg

ernies_tweaks_156.jpg (89.36 KiB) Viewed 1396 times


For Sale: Top URL's, including an OpenCart V-Pro Shop!
A wide range of matching Designs can be seen here: http://www.opencart.li
For Information on URL's offered, please contact me at: jti@jacob.ch
Hundreds of Mods in 380+ Repositories for OC v.1.5.x - v.2.3.x
to be found on my Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

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

Post by saliverdim » Tue Aug 14, 2018 1:38 am

straightlight wrote:
Wed Jun 29, 2016 7:06 pm
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:

Code: Select all

		$this->load->language('account/account');
Paste this code below it:

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');
      }
Then customise the below code as needed and add it to your account.tpl file:

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.
not working 2.1.0.2 can you help me ? please

Active Member

Posts

Joined
Wed Oct 07, 2015 12:15 am
Who is online

Users browsing this forum: No registered users and 13 guests