Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Create A Login Page When First Loaded Website Rate Topic   - - - - -

 
  • Andry MIS
  • Advanced Member
  • Members
  • Join Date: 13-Aug 14
  • 141 posts

Posted 19 August 2014 - 07:53 AM #1

Hi All,

I plan to create a login page when first opened website (like admin login page), only registered customers can view my website (storefront). I've managed to connect to the database and retrieve user data. The problem is in session, I do not know how to set a session when a successful login. I tried setting $ _SESSION ['auth'] variable, but cannot. Please help.

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 19 August 2014 - 08:51 AM #2

If $_SESSION['auth']['user_id'] is not empty, it means that the user is logged in

Hope that helps.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Andry MIS
  • Advanced Member
  • Members
  • Join Date: 13-Aug 14
  • 141 posts

Posted 19 August 2014 - 09:10 AM #3

Thank you for your informastion, i tried but still cannot.
I modify the index.php page, such as the following:

if(!empty($_SESSION['auth']['user_id'])) {
$php_value = phpversion();
if (version_compare($php_value, '5.3.0') == -1) {
echo 'Currently installed PHP version (' . $php_value . ') is not supported. Minimal required PHP version is 5.3.0.';
die();
}

define('AREA', 'C');
require dirname(__FILE__) . '/init.php';

fn_dispatch();

}


My logic is make a login form on index.php page, if login successful, I did set the $_SESSION['auth'].
Are there any other better way?

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 19 August 2014 - 01:08 PM #4

We can offer you to try our new free Login Redirect module which is available through the following link:

http://www.ecom-labs...ect-add-on.html

If you have any questions, please let me know.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11266 posts

Posted 19 August 2014 - 08:25 PM #5

You should use a hook for 'fill_auth'. The logic would be something like
if( empty($_SESSION['auth']['user_id']) ) && Registry::get('runtime.controller') != 'auth'  && AREA == 'C')
 fn_redirect("auth.login_form');

So this would equate to
User comes to customer site and is not logged in
redirect them to the 'auth' controller with mode 'login_form'

If Ecomm's addon does it for you, then it's certainly always better to use a commercial and supported piece of code. But it doesn't appear that their module does what you're looking for.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11266 posts

Posted 20 August 2014 - 04:52 AM #6

Give this free addon a try. Note that this will prevent robots from crawling your site too....
http://ez-ms.com/pri..._login_v4.2.tgz

P.S. It allows you to enable it on a store by store basis in multi-store environments. So x.site.com could require a login and y.site.com would not.

Edited by tbirnseth, 20 August 2014 - 04:59 AM.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 20 August 2014 - 07:59 AM #7

If Ecomm's addon does it for you, then it's certainly always better to use a commercial and supported piece of code. But it doesn't appear that their module does what you're looking for.


Why do you think so? Our module shows Sign in page for the unlogged customers. More other it allows to specify a page to which the customer will be redirected after he logs in. For example, you can use promotion page instead of the home page.

Give this free addon a try. Note that this will prevent robots from crawling your site too....
http://ez-ms.com/pri..._login_v4.2.tgz

P.S. It allows you to enable it on a store by store basis in multi-store environments. So x.site.com could require a login and y.site.com would not.


Thank you. We have checked the code. Note that your module kills callbacks from the payment systems.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11266 posts

Posted 20 August 2014 - 10:02 PM #8

When I read the description on your site I had thought it indicated that it was setup for specific products/pages. Re-reading, it does in fact indicate that un-logged-in users can be redirected. So either it's been rewritten or I miss-read.

I've excluded payment_notifications controller as well as profiles and auth controllers from the 5 lines of code that were written to address this.

I would recommend that merchants use ecomm's addon since it has more functionality and is also free. I didn't intend to try to undercut another developer. Was just trying to get the merchant's problem addressed. I'll remove remove reference to the code I put together.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Andry MIS
  • Advanced Member
  • Members
  • Join Date: 13-Aug 14
  • 141 posts

Posted 21 August 2014 - 01:56 AM #9

We can offer you to try our new free Login Redirect module which is available through the following link:

http://www.ecom-labs...ect-add-on.html

If you have any questions, please let me know.



Thank you for free add on, enough to help me but it did not suit my needs. My plan is to create their own login page to enter the storefront page (such as admin login page). Is such a thing allowed to be done in CS Cart? I am new to CS Cart, please help.

 
  • SwimShady
  • Advanced Member
  • Members
  • Join Date: 05-Aug 14
  • 87 posts

Posted 21 August 2014 - 02:29 AM #10

Thank you for free add on, enough to help me but it did not suit my needs. My plan is to create their own login page to enter the storefront page (such as admin login page). Is such a thing allowed to be done in CS Cart? I am new to CS Cart, please help.


I wanted the same feature that you are looking for, since I run a distributor website. I only sell to specific stores, hence why I need a login to view and buy my products. I didn't get it from eCom labs, but I paid $45 for it and it works great. But honestly, I don't want to remove a sale from eCom, so I would go with him/her since they were the first to try to help you. Plus from what I can see on their website, it's exactly the same thing I have, plus they let you name your price it looks like. It's an small investment that's worth it.

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 21 August 2014 - 11:06 AM #11

I wanted the same feature that you are looking for, since I run a distributor website. I only sell to specific stores, hence why I need a login to view and buy my products. I didn't get it from eCom labs, but I paid $45 for it and it works great. But honestly, I don't want to remove a sale from eCom, so I would go with him/her since they were the first to try to help you. Plus from what I can see on their website, it's exactly the same thing I have, plus they let you name your price it looks like. It's an small investment that's worth it.


Thank you for the kind words. BTW, please check the new version of the module

[DELETED]

Note: the installation package is not updated on our website yet

Edited by eComLabs, 21 August 2014 - 02:55 PM.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 21 August 2014 - 03:00 PM #12

We have updated the installation package. The Disable account registration setting was added. If this setting is enabled, the own Sign in page to enter the storefront page will be displayed.

Posted Image

In other case the customer will see default Sign in page with the ability to register new account

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • becomarius
  • Senior Member
  • Members
  • Join Date: 09-Feb 12
  • 154 posts

Posted 29 August 2014 - 09:49 AM #13

This addon must to be included in to default Cscart :)
Thanks for addon

CS Cart lovers


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19161 posts

Posted 29 August 2014 - 11:08 AM #14

This addon must to be included in to default Cscart :)
Thanks for addon



You are welcome!

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • dishathemes
  • Newbie
  • Trial users
  • Join Date: 31-Oct 17
  • 2 posts

Posted 03 May 2019 - 01:12 PM #15

We have updated the installation package. The Disable account registration setting was added. If this setting is enabled, the own Sign in page to enter the storefront page will be displayed.

login_redirect3.png

In other case the customer will see default Sign in page with the ability to register new account

 

 

Hi,

i installed your addon and its works fine.

 

i am wondering that is it possible to redirect unlogged customer to "login PopUp" not to login page.

 

the same login pop that open when we click on singin Under My account link.

 

 

Is that possible ?

Please help me



 
  • xeoto
  • Newbie
  • Trial users
  • Join Date: 30-Apr 19
  • 2 posts

Posted 20 May 2019 - 08:41 AM #16

This addon must to be included in to default Cscart smile.png
Thanks for addon