Zen Cart Logo
Forums / Managing Customers and Orders / Force registration/login prior to adding to cart

Force registration/login prior to adding to cart

Locked

Views: 3,253

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
27 Nov 2010, 2:35 PM
#1
jaymot avatar

jaymot

New Zenner

Join Date:
Aug 2010
Location:
Cebu, Philippines
Posts:
21
Plugin Contributions:
0

Force registration/login prior to adding to cart

Hello. What I want to do is rather different from the easy checkout/COWA mods that allow users to place orders without registering first. Zen Cart's default behavior is to allow guests to add items to a shopping cart then, when they click the checkout button, it prompts them to register or log in. I want to make Zen Cart do that when guests first try to add a product to the cart. Basically so only registered and logged in users are allowed to shop. I still want guests to be able to browse my store's products though. Is there a setting or existing mod to do this?

I'm using ZC version 1.39h with Super Orders mod among a few others.

27 Nov 2010, 3:18 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Force registration/login prior to adding to cart

You could use in the Configuration ... Customers ...

Customer Shop Status - View Shop and Prices
Customer must be approved to shop
0= Not required
1= Must login to browse
2= May browse but no prices unless logged in
3= Showroom Only

It is recommended that Option 2 be used for the purposes of Spiders if you wish customers to login to see prices.

where 2 would let the customer browse without prices and must login to see prices or add to cart ...

28 Nov 2010, 2:59 AM
#3
jaymot avatar

jaymot

New Zenner

Join Date:
Aug 2010
Location:
Cebu, Philippines
Posts:
21
Plugin Contributions:
0

Re: Force registration/login prior to adding to cart

Yes, I thought of that, but I think that would annoy potential customers and drive them away. Forcing people to jump through hoops just to get basic information such as prices: not good. By the time they click on the add item to cart button they've already decided to buy: they've changed from being lookie-loos to actual customers. That's the time to make them have to register or log in, not before.

I've tested all permutations of the Customer Shop Status and none of them give me what I want, which is that the default behavior of requesting login/registration when they click check-out be changed to happen when they click add to cart instead. I was hoping someone has already made that modification and could tell me how so I wouldn't have to reinvent the wheel. :)

28 Nov 2010, 3:27 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Force registration/login prior to adding to cart

You could use the Customer Authorization and set to 3 ... :

Customer Approval Status - Authorization Pending
Customer must be Authorized to shop
0= Not required
1= Must be Authorized to Browse
2= May browse but no prices unless Authorized
3= Customer May Browse and May see Prices but Must be Authorized to Buy

It is recommended that Option 2 or 3 be used for the purposes of Spiders

then change the code in the file:
/includes/modules/create_account.php

using your templates and overrides:
/includes/modules/your_template_dir/create_account.php

and change the code to read:

    $sql_data_array = array('customers_firstname' => $firstname,
                            'customers_lastname' => $lastname,
                            'customers_email_address' => $email_address,
                            'customers_nick' => $nick,
                            'customers_telephone' => $telephone,
                            'customers_fax' => $fax,
                            'customers_newsletter' => (int)$newsletter,
                            'customers_email_format' => $email_format,
                            'customers_default_address_id' => 0,
                            'customers_password' => zen_encrypt_password($password),
//                            'customers_authorization' => (int)CUSTOMERS_APPROVAL_AUTHORIZATION
                            'customers_authorization' => 0
    );

now you have the Add to Cart buttons and Buy Now buttons make the customer Login/Create an Account to add to cart ... but when they do create an account, instead of making the customer have to wait for approval, customers are automatically set to approved ...

Crafty eh? :cool:

28 Nov 2010, 9:55 AM
#5
jaymot avatar

jaymot

New Zenner

Join Date:
Aug 2010
Location:
Cebu, Philippines
Posts:
21
Plugin Contributions:
0

Re: Force registration/login prior to adding to cart

THANK YOU! That does exactly what I want! Now to figure out how to replace the "Login to Shop" text with a button. :clap:

28 Nov 2010, 2:26 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Force registration/login prior to adding to cart

Using your templates and overrides, you can find the current definition for the:
Login to Shop

with the Tools ... Developers Tool Kit ... and in the bottom input box enter the text you are looking for:
login to shop

and select Catalog and click SEARCH ...

Then change the existing text define to be an image:

//  define('TEXT_LOGIN_TO_SHOP_BUTTON_REPLACE','Login to Shop');
  define('TEXT_LOGIN_TO_SHOP_BUTTON_REPLACE',zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . 'button_next.gif'));

this example would pull the existing image for the Next button, just so that you can see the change ...

What is the real path for that? Well of course we all know just click right on an image to find out its properties which would include its path ... :cool:

28 Nov 2010, 6:15 PM
#7
jaymot avatar

jaymot

New Zenner

Join Date:
Aug 2010
Location:
Cebu, Philippines
Posts:
21
Plugin Contributions:
0

Re: Force registration/login prior to adding to cart

Ja sure, you betcha! That works like a champ! Thanks a million.

28 Nov 2010, 6:32 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Force registration/login prior to adding to cart

You are most welcome ... glad that these customizations worked for you ... :smile:

15 Dec 2010, 1:42 AM
#9
tobindonal avatar

tobindonal

New Zenner

Join Date:
Oct 2010
Location:
ireland
Posts:
23
Plugin Contributions:
0

Re: Force registration/login prior to adding to cart

i'm seriously impressed...knowledge is wonderful, dude you have the knowledge...

23 Dec 2010, 3:51 PM
#10
abaco avatar

abaco

New Zenner

Join Date:
Nov 2010
Posts:
21
Plugin Contributions:
0

Re: Force registration/login prior to adding to cart

Sorry, I made the change of the code but nothing happens to me, do not see the button "Add to Car. "
In what is wrong? :dontgetit

I use v1.3.9f

30 Dec 2010, 9:02 AM
#11
byronnz avatar

byronnz

New Zenner

Join Date:
Nov 2010
Posts:
3
Plugin Contributions:
0

Re: Force registration/login prior to adding to cart

Hi, I am a newbie using Zen Cart. I have made the changes suggested above and have successfully got the Customer registration happening after the Add Cart button however I can't get the customer to follow on to the checkout after the Account created successfully screen. When the Customer clicks on the continue button they are directed back to the main page. Where do I find the code behind the continue button and what code do I place there. Your help would be much appreciated.