Make a file in the functions extra directory:
/includes/functions/extra_functions/myfunctions.php
Add to it:
PHP Code:
<?php
// extra functions
function zen_get_specials_start($product_id) {
global $db;
$sql = "SELECT specials_date_available from " . TABLE_SPECIALS . "
WHERE products_id = '" . (int)$product_id . "'";
$check_specials_start = $db->Execute($sql);
return $check_specials_start->fields['specials_date_available'];
}
function zen_get_specials_end($product_id) {
global $db;
$sql = "SELECT expires_date from " . TABLE_SPECIALS . "
WHERE products_id = '" . (int)$product_id . "'";
$check_specials_start = $db->Execute($sql);
return $check_specials_start->fields['expires_date'];
}
?>
Now you can get the special start and end dates ...
Something like this in the product _info template:
PHP Code:
<?php echo 'Special for Product: ' . $_GET['products_id'] . ' is ' . zen_date_short(zen_get_specials_start($_GET['products_id'])) . ' - ' . zen_date_short(zen_get_specials_end($_GET['products_id'])); ?>
Would give you for products_id 42:
Special for Product: 42 is 11/07/2007 - 11/14/2007
Now just figure out how to utilize it for your code where you really want it ...