Hi guys,
Is there any way to force visitors to either register or login to view the site? I have a little knowledge of PHP and know that it can be done via sessions? I'm just not sure how abouts to go about achieving this.
Thanks,
HJ
Is there any way to force visitors to either register or login to view the site? I have a little knowledge of PHP and know that it can be done via sessions? I'm just not sure how abouts to go about achieving this.
Thanks,
HJ
This is a quick way which works for me…
Put this in line 1 of your layout.tpl (view/theme/default/template/common/layout.tpl)
Cheers
Put this in line 1 of your layout.tpl (view/theme/default/template/common/layout.tpl)
Code: Select all
<?php
if (!$this->customer->isLogged()
&& $this->url->http('account/login') != $breadcrumbs[1]['href']) {
$this->redirect($this->url->https('account/login'));
}
?>
Thanks for getting back to me, I've added the code and now end up with a redirect loop in FF:
Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.
I'm not fully clued up on PHP so aren't sure whats going on here.
Thanks for your help,
HJ
Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.
I'm not fully clued up on PHP so aren't sure whats going on here.
Thanks for your help,
HJ
Can you post your layout.tpl code please.
A loop should not be created, as the code breaks when
or check whether changing from to (just 'http')makes a difference…
A loop should not be created, as the code breaks when
Code: Select all
$this->url->http('account/login') == $breadcrumbs[1]['href']
Code: Select all
$this->redirect($this->url->https('account/login'))
Code: Select all
$this->redirect($this->url->http('account/login'))
You need:
Regards tronics
Code: Select all
<?php
if (!$this->customer->isLogged()
&& $this->url->http('account/login') != $breadcrumbs[2]['href']) {
$this->redirect($this->url->https('account/login'));
}
?>
Regards tronics
Even better:
Code: Select all
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'));
}
I did try removing the "s" from the https first off, but that had no effect, but the above code works perfectly.tronics wrote:Even better:
Code: Select all
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')); }
Thanks so much!
Just one final thing, after login/registration is there a way of forwarding to the homepage (catalog) rather than the account page?
Thanks once again,
HJ
Easyafter login/registration is there a way of forwarding to the homepage (catalog) rather than the account page?

Code: Select all
$this->redirect($this->url->https('common/home'));
Code: Select all
$this->data['continue'] = $this->url->http('common/home');
It is! In the template file for each module, make the very first line:Is it possible to hide all the side column as well (categories, brands, shopping cart etc) if the customer is not logged in?
Code: Select all
<?php if ($this->customer->isLogged()) { ?>
Code: Select all
<?php } ?>
hello, i used your solution, it works perfectly!!!
just one thing, i can't to open the privacy windows
i added this string
but it do not work, how can i do?
thanks
just one thing, i can't to open the privacy windows
i added this string
Code: Select all
&& $this->url->http('information/information') != $breadcrumbs[2]['href']
thanks
Hello,
I am looking for a solution for v1.4.6 and up where the user, after registering or login to his account, he is then redirected to a specific page of my choice. For example, a redirection to index.php?route=product/category&path=134
I followed instructions here (based on older OC versions - so I wasnt able to fix this)...
I did some testing and I encountered I some problems after making some changes to the files catalog/controller/account/login.php and catalog/controller/account/success.php.
Obviously, I made some mistakes when changing the script.
I would appreciate some help on this matter.
Thank you
Giannis
I am looking for a solution for v1.4.6 and up where the user, after registering or login to his account, he is then redirected to a specific page of my choice. For example, a redirection to index.php?route=product/category&path=134
I followed instructions here (based on older OC versions - so I wasnt able to fix this)...
I did some testing and I encountered I some problems after making some changes to the files catalog/controller/account/login.php and catalog/controller/account/success.php.
Obviously, I made some mistakes when changing the script.
I would appreciate some help on this matter.
Thank you
Giannis
Last edited by i2Paq on Sun Apr 11, 2010 6:40 pm, edited 1 time in total.
Reason: Merged
Reason: Merged
GxG Web Design Greece
Κατασκευή Ιστοσελίδων
Βελτιστοποίηση Ιστοσελίδων
Who is online
Users browsing this forum: Google [Bot] and 61 guests