Post by VotreEspace » Fri Mar 04, 2011 5:37 am

Simple : informations pages that will be readable only if logged

to make an information page protected, I've decided to go the easy way :
make the sort order of the page negative (like -2)

then open catalog/controller/information/information.php

find this line (~ #23):

Code: Select all

$information_info = $this->model_catalog_information->getInformation($information_id);
then, ad after it :

Code: Select all

/************** if sort_order is netative and user is not logged, we redirect him to be logged *********/
if (!$this->customer->isLogged() && ($information_info['sort_order'] <0)) {
	$this->session->data['redirect'] = HTTPS_SERVER . 'index.php?route='.$this->request->get['route'];
	if (isset($this->request->get['information_id'])) {
		$this->session->data['redirect'] = $this->session->data['redirect'].'&information_id='.$this->request->get['information_id'];
	}
	  
	  $this->redirect(HTTPS_SERVER . 'index.php?route=account/login');
} 
/**************** end mod ************/
and that's it...

still in the information menu, but you'll be redirect to login...

VotreEspace Services Internet (Français)
VotreEspace Services Internet (english)


Newbie

Posts

Joined
Tue May 25, 2010 3:30 am
Location - Quebec city, Quebec, Canada

Post by tim21701 » Mon Mar 07, 2011 7:18 pm

in 1.4.9.3 - not working

User avatar
Newbie

Posts

Joined
Fri Feb 25, 2011 5:46 pm
Location - Russia, Murmansk

Post by mystifier » Sat Mar 12, 2011 8:22 am

It works fine with 1.4.9.3!

I would make a couple of small suggestions though: '<0' should be replaced with '<-1' because a sort order of -1 is already used to exclude Information Pages from the Information sidebox, and the Information sort order of the information box should use abs(sort_order) otherwise all restricted pages have to appear at the top.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by peteVA » Sun Mar 13, 2011 3:17 am

Actually, after playing with this some, I found that using the < always placed the page link at the top of the Information block, and I have one page that I specifically want to always be #1.

So I changed the <-1 to >10 and numbered the pages I wanted to have them log in for as 11 and above. Seems to work just fine.

A Trusted Wholesale Dropshipper
Web Hosting Under $ 5.00 Month! FREE Shopping Carts!
25,000+ Real Wholesale & Dropship Sources!


User avatar
Active Member

Posts

Joined
Mon Jul 20, 2009 8:25 am
Who is online

Users browsing this forum: No registered users and 18 guests