Hi David. I am looking for a small variation of tapestry_applyVoucherCodes function (using config_useVoucherCodes = 1).
I just want to know, if any voucher code exists and it is valid for a given normalised name.
So, for example, a function called tapestry_anyVoucherCodesForProductName($normalised_name) would return TRUE or FALSE if for that given name, there is any coupon code. It doesn't matter the price, or the merchant, just true or false.
Hi,
This function will do the trick..
function anyVoucherCodesFor($normalised_name)
{
global $config_databaseTablePrefix;
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products`
WHERE normalised_name = '".database_safe($normalised_name)."'";
if (database_querySelect($sql,$products))
{
$products = tapestry_applyVoucherCodes($products);
foreach($products as $product)
{
if ($product["voucher_code"]) return TRUE;
}
}
return FALSE;
}
Cheers,
David.
--
PriceTapestry.com