Post by domivin » Mon Mar 28, 2016 10:56 pm

Hi

Can we resricted categorie page ( cameras ) by login

Thanks
Michel

Version 2.1.0.1
Hébergement LWS
Template default modified
Multimerch modified


New member

Posts

Joined
Thu Nov 13, 2014 3:06 am

Post by abxweb » Tue Mar 29, 2016 12:19 am

You can use this function to check if user is logged in:

Code: Select all

$this->customer->isLogged()
Since you want specific category, than you can do something like this :

Code: Select all

edit /catalog/controller/product/category.php, just above $product_total = $this->model_catalog_product->getTotalProducts($filter_data); 
Add:

Code: Select all

if(!$this->customer->isLogged() && $category_id == YOURID) {
//do something here
}
Where YOURID is the category's ID you want to hide.

Check my FREE extension - Frontend Admin Toolbar
http://www.opencart.com/index.php?route ... n_id=26059

For any inquiry or questions contact me at: abxweb[at]outlook[dot]com


User avatar
New member

Posts

Joined
Fri Mar 04, 2016 5:47 pm
Location - Serbia

Post by domivin » Tue Mar 29, 2016 1:04 am

Hy

I add this code and I get fatal error

if(!$this->customer->isLogged() && $category_id == 71) {
$this->redirect($this->url->link('account/login', '', 'SSL'));
}

Michel

Version 2.1.0.1
Hébergement LWS
Template default modified
Multimerch modified


New member

Posts

Joined
Thu Nov 13, 2014 3:06 am

Post by abxweb » Tue Mar 29, 2016 3:24 am

My friend, you need to use

Code: Select all

$this->response->redirect() 
That is the function for redirecting in Opencart 2.x

Cheers.

Check my FREE extension - Frontend Admin Toolbar
http://www.opencart.com/index.php?route ... n_id=26059

For any inquiry or questions contact me at: abxweb[at]outlook[dot]com


User avatar
New member

Posts

Joined
Fri Mar 04, 2016 5:47 pm
Location - Serbia
Who is online

Users browsing this forum: No registered users and 12 guests