Post by newtread » Mon Jan 18, 2021 5:08 am

I need to restrict access to an information page in order to block unregistered users or the wrong customer group from viewing it. Basically I need to only allow approved members to access a file that has wholesale price data. I can not use VQMOD or I would buy an extension. I tried using the code below but it will not work with SSL enabled. How can I modify the code to work with SSL.

Code: Select all

if (isset($this->request->get['information_id']) && $this->request->get['information_id'] == '{ID}') {
    //If the information_id is provided and it matches the ID you wish to protect
    if (!$this->customer->isLogged()) {
        //If the customer is not logged in already, redirect them to the login page
        //Use $this->session->data['redirect'] to redirect them back to this page after logging in
        $this->session->data['redirect'] = $this->url->link('information/information', 'information_id=' . $this->request->get['information_id']);
        //Do the redirect
        $this->redirect($this->url->link('account/login', '', 'SSL'));
    }
}

Newbie

Posts

Joined
Mon Sep 30, 2013 12:02 am

Post by IP_CAM » Mon Jan 18, 2021 8:39 pm

Just in case, you can find paid solutions on this here: ;)
https://www.opencart.com/index.php?rout ... h=restrict
like this one:
https://www.opencart.com/index.php?rout ... n_id=14256

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.


User avatar
Legendary Member

Posts

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

Post by johnp » Tue Jan 19, 2021 1:03 am


Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk


User avatar
Active Member

Posts

Joined
Fri Mar 25, 2011 10:25 am
Location - Surrey, UK
Who is online

Users browsing this forum: Amazon [Bot] and 122 guests