Hiding prices isn't the problem, it's hiding the viewing of products.
I've had a go at this problem; I've allready got it to work in OsCommerce but with the different file structure in zencart i'ts not working. If any one can see the flaw in my syntax or reasoning.
I'm using
Zen Cart 1.3.8a
Patch: 1::
Version de la Base de Données: 1.3.8
In brief, I added a pass word field PW to categories.
I modifed includes/functions/function_categories.php
added files entry-form.php and pass-good.php
the script is failing at the query I'm getting "No row" message.
although the query works in a separate file with the variables predefined.
The query works when I put it in a stand alone php script with the variables provided, but not in Zencart.
I have five categories set up and one has an entry in the PW field.
the modifictation to function_categories.php
after return 'cPath=' . $cPath_new;
}
line 55
Code:
Code:
/* check for pass word and cookie */
$query = "select PW from categories where categories_id = '" . (int)$current_category_id . "'";
$result = mysql_query($query) ;
if (!$result)
{
die('No result: ' . mysql_error());
}
$row = mysql_fetch_array($result) ;
if (!$row)
{
die('No row: ' . mysql_error());
}
$mot_pass=$row["PW"];
$go ="YES";
if(isset($_COOKIE["look"]) && $_COOKIE["look"]==$mot_pass)
{
$go="YES";
}
if($mot_pass !=NULL && !isset($_COOKIE["look"]))
{
$go="NO";
}
if ($go=="NO")
{
include('entry_form.php');
}
the file entry_form.php
Code:
Code:
<td>
enter the password for this section<BR>
<BR>
<form method="POST" action="pass_good.php">
<INPUT TYPE="text" NAME="given_word" VALUE="">
<INPUT TYPE="hidden" NAME="pass_word" VALUE=<?php echo $mot_pass; ?>>
<button type="submit" name="submit">Submit</button>
</td>
the file pass_good.php
Code:
Code:
<?php
$given_word = $_POST['given_word'];
$mot_pass=$_POST['pass_word'];
switch ($mot_pass)
{
case "vague":
if ($given_word == "vague")
{
setcookie("look", "vague", time()+360000);
}else{
$mot_pass="wrong";
}
break;
default:
$mot_pass="wrong";
}
?>
<html>
<body>
<?php
echo $given_word . "<BR>";
echo $mot_pass ."<BR>";
?>
<a href="javascript:history.go(-1)">Continuer</a>
</body>
</html>