The code of importance there is the second if section
Code:
// if the customer is not logged on, redirect them to the login page
if (!isset($_SESSION['customer_id']) || !$_SESSION['customer_id']) {
$_SESSION['navigation']->set_snapshot();
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
} else {
// validate customer
if (zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
$_SESSION['navigation']->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_SHIPPING));
zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
}
Which is what validates if the user is logged in and "active" with the site.
That said, if I understand correctly, if customer is not logged in/valid display picture A with link to login. Else if logged in and valid then display special product with link to it. (mind you there are other things that need to be done to prevent someone from tripping over or getting to the product specifically.)
So yeah, I used "broken" English to describe the situation, just trying to get rid of the fluff to provide the essentials.
Anyways, could go in many of different locations, but the concept at hand is something similar to the following based on my understanding described above:
Code:
// if the customer is not logged on, redirect them to the login page
if (!isset($_SESSION['customer_id']) || !$_SESSION['customer_id'] || zen_get_customer_validate_session($_SESSION['customer_id']) == false) {
// display "fake" image with login link.
// here could use code taken from tpl_modules_main_product_image.php but the nuts and bolts would be like:
echo '<a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . zen_image('/* relative path to image to replace this commented out text */', 'products_name', width, height) . '</a>';
} else {
//display product with product link.
}
With similar code from the first section put into the else area but instead to reference your special product.
Somewhat better than that is if you have a specific variable you plan to use on say your side box or category listing, then assign the above results to the variable and then echo the variable instead of having all that text in the applicable tpl_ file or similar for where you want it displayed.
Bookmarks