Ecommerce Templates > PHP Version Help > Customer login and retail / wholesale pricing

Customer login and wholesale pricing

The customer login feature allows for wholesale pricing / tax / shipping exemption for logged customers and page protection. This means it is possible to offer retail and wholesale pricing without the need for a second database as well as offering tax and shipping exemption to particular users. You can also restrict access to certain pages of your site. Customers can create their own account, view their order history and save billing and shipping addresses. It is an optional feature so if you don't require customers to log in to check out, there's no need to do so.

Enabling customer login

To enable the login you will then need to go to vsadmin/includes.php and add the line (if it's not already present)
Please note these parameters are case sensitive.

To allow customers to sign up for an account you will need this addition to vsadmin/includes.php
To force customers to login before purchasing add this to vsadmin/includes.php
To remove the prompt on cart.asp to login then add this to your vsadmin/includes.php file

Customers will be prompted on checkout if they would like to log in or set up an account unless you have added the setting above.

There are more settings available on our parameters page.

Mini login box

If you would like to have a login status box on each page you will need to add one line of code where you would like the login box to appear. The code you need is the following:

<?php include "vsadmin/inc/incminilogin.php"?>

Paste that into HTML / code view exactly where the login box should appear and make sure that it comes somewhere after the include lines:

<?php include "vsadmin/db_conn_open.php"?>
<?php include "vsadmin/inc/languagefile.php"?>
<?php include "vsadmin/includes.php"?>
<?php include "vsadmin/inc/incfunctions.php"?>

You should now be able to see the login box on your store.

Login Box

Login Box after successful login

Login Box if enableclientlogin=true
hasn't been set in vsadmin/includes.php

There is also a one line minilogin available as well as a css based status box. Both are available in the css widgets package from our Ecommerce Tools page.

These are the screens you will see when the client login feature has been enabled.

Login Dialogue on clientlogin.php

Once you click on login you will be taken to a screen to enter your email address and password

Login screen

Once logged in and viewing clientlogin.php customers can:

... view their account details

Account details

... edit their shipping and billing addresses

address management

... as well as look up past orders.

order management

Setting up a client for wholesale pricing, discounts and shipping / tax exemption

In your home admin page there should be a link client login admin, click to set up your clients' options.

Client login admin

Click on new client login to add the details and parameters available for each particular customer or use the search feature to modify an existing client.

Customer login settings

Enter the client login name, email address, password, the relevant action (You can use CTRL + Click to select more than one choice) and finally the login level if applicable.

If you need to add up to 2 extra fields to the customer login account (URL and Mobile in our example), that can be achieved through vsadmin/includes.php

When done, click on submit and your client will have been set up with the parameters you have assigned. The promotional email box if checked will write the client's email address to the database and can be used for mail shots.

Login level

You can assign different levels of login permissions on any page to say that a particular page is restricted to anyone below the login level assigned in the login admin section. For example, if you set $requiredloginlevel=4; then only people who you have set up with a login value of 4 or above can view the page when logged on. Only place the code on the pages where you need to restrict access, for example, it should not go on clientlogin.php

To add the level of restriction to individual pages you will need to add the line:

<?php $requiredloginlevel=4;?>

...where 4 is the threshold of permission for that page. This needs to come anywhere before the line

<?php include "vsadmin/inc/incfunctions.php"?>

The last thing you need to do is find the code at the top of your page that looks like this:

session_start(); ?><html>

...and change it to:

ob_start(); ?><html>

..making sure there is no space before the code and you just have the one opening <html> tag.

Payment methods

It is possible to limit certain payment methods to logged in customers if required. Just select from the "Login Level" drop down in the payment provider admin page.

Reward / loyalty points

Increase the number of returning customers to your store by implementing the loyalty points system introduced in Version 6.1. Customers will be given a number of points depending on the value of items purchased and the points / cash ratio set by the store owner. These can be redeemed on subsequent orders or saved up for larger purchases. They can also be used to give store credit as the total points are editable through the control panel more details more details


If you want to hide pricing and add to cart options from non logged in customers, add this to vsadmin/includes.php

$noprice = (@$_SESSION['clientUser'] != '') ? false: true;
$nobuyorcheckout = (@$_SESSION['clientUser'] != '') ? false: true;

That means only logged in customers will see the price and buy / checkout buttons and those will be hidden from regular visitors.

This tweak is available for any of the parameters in includes.php that you only want to apply to customers who are not logged into the store.