Originally Posted by
Ajeh
What is your code that you use to make sure something is entered currently?
Thanks Ajeh
This file is loaded by the various checkout pages:
PHP Code:
<?php
/**
* practitioner_alert.php
* Loaded automatically by index.php?main_page=shopping_cart, index.php?main_page=checkout_shipping
* and index.php?main_page=checkout_payment
*
* Checks if restricted practitioner only items are in cart
*
* @package essential part of plug-in for Zen Cart - all versions
* @copyright Copyright 2012 Frank Riegel (frank18) www.isonetwork.net.au
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: practitioner_alert.php 2012-11-05 06:19:52Z frank18 $
* @developed by: Frank Riegel (frank18) www.isonetwork.net.au
*/
// check if restricted practitioner only items are in cart
// change the next lines to suit the ID's of your manufacturers
// to add more manufacturers simply clone a line and add it to the script
global $cart;
$chk_single_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','2');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','4');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','5');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','8');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','13');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','14');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','15');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','22');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','23');
$chk_multi_manufacturers += $_SESSION['cart']->in_cart_check('manufacturers_id','38');
?>
Then, in includes/modules/pages/checkout_payment/header_php.php the following changes were applied:
PHP Code:
// if cart contains restricted products and comments box is empty, redirect the customer to the shipping method selection page
require(DIR_WS_INCLUDES . 'practitioner_alert.php');
if ($chk_single_manufacturer) {
$prac_details = '1';
} elseif ($chk_multi_manufacturers) {
$prac_details = '2';
} else {
$prac_details = '0';
}
if (!$_SESSION['comments'] && $prac_details != '0') {
$messageStack->add_session('checkout_shipping', ERROR_NO_PRACTITIONER_DETAILS, 'error');
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
}
// avoid hack attempts during the checkout procedure by checking the internal cartID..... etc etc etc
And in includes/templates/bentley_classic/templates/tpl_checkout_payment_default.php the customer is getting some alerts / messages depending of what is the cart.
Code:
// ** END PAYPAL EXPRESS CHECKOUT ** ?>
<!--bof prescriptive advice required alert -->
<div>
<?php
require(DIR_WS_INCLUDES . 'practitioner_alert.php');
if ($chk_single_manufacturer) {
echo TEXT_PRESCRIPTIVE_ADVICE_REQUIRED;
} elseif ($chk_multi_manufacturers) {
echo TEXT_PRACTITIONER_ONLY_CHECKOUT;
} else {
echo TEXT_NO_PRACTITIONER_DETAILS_REQUIRED;
}
?>
</div>
<fieldset>
<legend>
<?php if ($chk_single_manufacturer) {
echo TABLE_HEADING_PRAC_DETAILS;
} elseif ($chk_multi_manufacturers) {
echo TABLE_HEADING_PRAC_DETAILS;
} else {
echo TABLE_HEADING_COMMENTS;
}
?>
</legend>
<!--eof prescriptive advice required alert -->
<?php echo zen_draw_textarea_field('comments', '45', '3'); ?>
</fieldset>
I have not included the various language defines in this post .....
Has been working well except for the 'blanks'
Thanks / Frank
Bookmarks