Try membership mod..
http://www.zen-cart.com/index.php?ma...roducts_id=492
Then create ezpages that can only be seen by members
or certain group of members that are logged in..
Try membership mod..
http://www.zen-cart.com/index.php?ma...roducts_id=492
Then create ezpages that can only be seen by members
or certain group of members that are logged in..
Thanks misty - I think all customers have to be members with this mod. I require customers categorised into members and non-members.
thanks fairestcape once again for the offer of releasing some of Scott's work should he be in agreement. I may pursue this route, but I have made some progress with the php coding.
This the code:
<?php
$custID = $_SESSION['customer_id'];
if ($custID > 0)
{
$host="localhost";
$user="username";
$password="password";
$database="database name";
$connection = mysql_connect($host, $user, $password)
or die ("Could not connect");
$db = mysql_select_db($database, $connection)
or die ("Could not connect");
$query = "SELECT customers_firstname, customers_lastname, customers_id, customers_newsletter from customers WHERE customers_id=$custID";
$result = mysql_query($query)
or die ("couldn't execute query");
$row = mysql_fetch_array($result,MYSQL_BOTH);
$newlettercode = $row[3];
if ($newlettercode == 0)
{echo "non member - please purchase membership subscription above";}
else
{echo "link to members section";}
}
else
{ echo "<br>Please log in if you are a member<br> ";}
?>
If it of use to anyone - please copy
Basically it checks the sesion variable $_SESSION['customer_id']; which is null if no-one is signed in - or contains the customer_id if signed in.
The program also checks the newsletter field for that customer and if set to 1 allows entry to the members area, if set to 0 suggests buying a members subscription and disallows access.
I've checked it out a few times with my dummy database and it seems to work ok.
I have used this on the Define Pages Editor/define_main_page.php
file - I now need to look at combining the graphics with the code
thanks again
Derek
Tried your code, added to define_main page...works but on logging in as member,
see message but all products disappear from main
page??
Hi Misty
Do you mean the new products banners? Mine does the same
Is this a normal funcion of Zen Cart when you log-in?
I'm trying to find a way of checking it out
I haven't altered any zen code - only added the code on the define_main_page
Derek
Yes, removes centre boxes for new,featured,special products
and no, normally this is not supposed to happen..
thanks
I've really used the main_page to check out the php coding for the members only area. Don't know why it has this effect, but the actual code will be attached as a behaviour to some sort of membership area button, so hopefully, it shouldn't effect things.
Thanks for pointing it out.
Derek
I think I've cracked it!
If you comment out the lines :
$connection = mysql_connect($host, $user, $password)
or die ("Could not connect");
$db = mysql_select_db($database, $connection)
or die ("Could not connect");
everything seems ok - the database/user connection is probably set up in an .ini file
Derek
Yes that fixed problem with disappearing centre boxes..am assuming
that you will be placing link in code to replace text
link to members section
The plan is to have a members section entry button on the front page. This code will be activated upon "depression" of this button.
I really wanted to check out the functionality of the code with Zen, before looking at the graphics and implementation.
Derek
![]()
If anyone is interested in this thread, I have made some more progress.
The site in question is www.baitworks.co.uk
I had to write some php code to set all customers_newsletter fields = 0 in the database.
Other php code appears at the top of the membership define pages to check membership validity, i.e. whether this field has been (manually) set to 1 on receipt of membership subscription.
Most probably going to use the date of birth field to show membership end.
Hope this is clear - please contact me for and help/clarification