No Guests : Customer Login required like Admin Login
-
Nigel
- Contributor
- Posts: 114
- Joined: Mon Jan 11, 2021 1:39 am
- Phoenix Version:
- Has thanked: 29 times
- Been thanked: 8 times
No Guests : Customer Login required like Admin Login
No Guests : Customer Login required like Admin Login
I would like the customer landing page to be a login like the admin.
I have spent the past few hours trying to find info on the forum and also looking through the files.
Can a customer go straight to the login.php like an Admin does and all areas of the cart require a successful login ?
Customers are current active customers whose online accounts would be initially created for them and their login details issued to them. This is normal practise in my industry.
I'm looking to create an ordering portal for trade customers who we currently contact via telesales.
Thanks for any advice / input.
Nigel
I would like the customer landing page to be a login like the admin.
I have spent the past few hours trying to find info on the forum and also looking through the files.
Can a customer go straight to the login.php like an Admin does and all areas of the cart require a successful login ?
Customers are current active customers whose online accounts would be initially created for them and their login details issued to them. This is normal practise in my industry.
I'm looking to create an ordering portal for trade customers who we currently contact via telesales.
Thanks for any advice / input.
Nigel
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: No Guests : Customer Login required like Admin Login
Code: Select all
class hook_shop_siteWide_loginRequired {
public function listen_siteWideStart() {
$page = basename(Request::get_page());
if (('create_account.php' !== $page) && !Text::is_prefixed_by($page, 'log')) {
Login::require();
}
}
}-
Nigel
- Contributor
- Posts: 114
- Joined: Mon Jan 11, 2021 1:39 am
- Phoenix Version:
- Has thanked: 29 times
- Been thanked: 8 times
Re: No Guests : Customer Login required like Admin Login
My site is set to override on the templates section.
does the hook still go into default or overrides ?
Am I right in thinking a copy of the htaccess in the templates/default should also exist in templates/override ?
does the hook still go into default or overrides ?
Am I right in thinking a copy of the htaccess in the templates/default should also exist in templates/override ?
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: No Guests : Customer Login required like Admin Login
The only time it would matter would be if there were two hooks, one in each place. Then override should defeat default. But if there's only one, then either place should work.
If only there were a reference implementation, then you could just look there: Core provides three files inside the override directory tree, and all three should exist in your installation.
-
Nigel
- Contributor
- Posts: 114
- Joined: Mon Jan 11, 2021 1:39 am
- Phoenix Version:
- Has thanked: 29 times
- Been thanked: 8 times
Re: No Guests : Customer Login required like Admin Login
My version didn't have the htaccess in there.ecartz wrote: ↑Tue Aug 10, 2021 10:56 amThe only time it would matter would be if there were two hooks, one in each place. Then override should defeat default. But if there's only one, then either place should work.If only there were a reference implementation, then you could just look there: Core provides three files inside the override directory tree, and all three should exist in your installation.
Is it recommended to use the github as a reference, if that's what you're implying ?
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: No Guests : Customer Login required like Admin Login
They should have been added in the 1.0.7.13 update, which is what created the override folder.
Yes. In a normal install, the only files that should change from the GitHub versions are the configure.php files. All other modified files should be in one of the override places:
- admin/includes/classes/override
- includes/system/override
- templates/override
Note that English language files used to be modified in place but now should go under templates/override/includes/languages in catalog. Hopefully you don't have any reason to modify the language files under admin or install. This is covered at How to Change Text
Modules don't really work well with that system, so should generally be copied and renamed. The ot_shipping module is an exception, as it won't override all the behavior if renamed. One of these days, I should probably fix that.
-
Nigel
- Contributor
- Posts: 114
- Joined: Mon Jan 11, 2021 1:39 am
- Phoenix Version:
- Has thanked: 29 times
- Been thanked: 8 times
Re: No Guests : Customer Login required like Admin Login
I created a php file called loginRequired.php
I placed it in templates/default/includes/hooks/shop/siteWide with no success. Just error 500.
I then tried by adding hooks/shop/siteWide to the override section as that's how it's set in myStore. Still no joy.
I've watched Zipurman's video many times and still can't see what I'm missing.
Code: Select all
<?php
class hook_shop_siteWide_loginRequired() {
public function listen_siteWideStart() {
$page = basename(Request::get_page());
if (('create_account.php' !== $page) && !Text::is_prefixed_by($page, 'log')) {
Login::require();
}
}
}I then tried by adding hooks/shop/siteWide to the override section as that's how it's set in myStore. Still no joy.
I've watched Zipurman's video many times and still can't see what I'm missing.
- zipurman
- Builder
- Posts: 540
- Joined: Tue Oct 13, 2020 5:20 pm
- Phoenix Version: v
- Has thanked: 93 times
- Been thanked: 162 times
Re: No Guests : Customer Login required like Admin Login
What version of Phoenix are you running?
What version of PHP are you using?
What does the error log say, as with a 500 error you should have some log entries?
zipurman
-----------
-----------
-
Nigel
- Contributor
- Posts: 114
- Joined: Mon Jan 11, 2021 1:39 am
- Phoenix Version:
- Has thanked: 29 times
- Been thanked: 8 times
Re: No Guests : Customer Login required like Admin Login
Installed Version: CE Phoenix v1.0.8.5
PHP Version 7.3.27 (Zend 3.3.27)
[Tue Aug 10 23:52:38 2021] [error] [client xxx.xxx.xxx.133:0] PHP Parse error: syntax error, unexpected '(', expecting '{' in /home/sites/blahblah.com/public_html/top/templates/override/includes/hooks/shop/siteWide/loginRequired.php on line 3
PHP Version 7.3.27 (Zend 3.3.27)
[Tue Aug 10 23:52:38 2021] [error] [client xxx.xxx.xxx.133:0] PHP Parse error: syntax error, unexpected '(', expecting '{' in /home/sites/blahblah.com/public_html/top/templates/override/includes/hooks/shop/siteWide/loginRequired.php on line 3