Page 1 of 1

[1.5.0.2]Restricted access to product page or sub category

Posted: Wed Jun 08, 2011 3:00 am
by bobpour
Hello Ladies and gents,
I’m very new to OpenCart as well as PHP (computer bachelor but hardware :( and now in handbag business ??? !)
I Setup the OC 1.5.0.2 few days back (on localhost, IIS 7 and Vista) and playing around with it. I am coming from .ASP and .ASPX world so the whole thing is very exciting and loved what I learned so far.
I’m setting up the site to sell to our existing customers and our bags are TOP SECRET :joker: (we are selling to stores and not consumer) so I have to block the Anonymous user from accessing part of the site (Entire Product pages or at least some of the categories like New Arrival and…)
I did some research on forum and found few posts for previous versions but can’t get the codes to work on 1.5.0.x
I was wondering if anyone here can guide me to a right direction to How to check to see if the user is logged in, Which files has to be protected and…
Thanks in advance.

Re: [1.5.0.2]Restricted access to product page or sub catego

Posted: Mon Jun 13, 2011 4:01 am
by bobpour
I play around with category.tpl and tried using tronics solution from earlier posts.
I got some results (so far…)
I added below code to my category.tpl

Code: Select all

<?php
if (!$this->customer->isLogged() &&  
            (
            $this->url->http('account/login') != $breadcrumbs[2]['href'] 
            && $this->url->http('account/forgotten') != $breadcrumbs[2]['href']
            && $this->url->http('account/create') != $breadcrumbs[2]['href']
            )
) {
    $this->redirect($this->url->http('account/login'));
}
?>
Now if the customer is logged in then they can browse the site and there is no problem
But if they are not logged in then I get a blank screen, I think I am sending the NOT logged customers to a wrong location.
Obviously the code above need to be adjusted I just can’t figure out what part!
Any help/suggestion?