贴心
全国7×24小时客服热线
安全
病毒杀除率高于99%
稳定
网站可用性高于99.9%
实力
服务68家上市企业及集团公司
点击数:11332015-07-31 09:38:11 来源: 外贸网站建设,深圳外贸网站建设,深圳网站建设,外贸商城网站制作-亿恩科技
ZenCart的zen_get_products_price_is_free 函数是判断产品是否是免费的商品,该函数的实现功能其实很简单,主要就是获取产品表products 的product_is_free 字段,如果该字段的值为1说明该产品是属于免费产品。该值的设置是在添加产品的时候有设置。默认该值为0,即不是免费商品。函数的参数为产品的ID值。
函数原型如下,函数定义位于includesfunctionsfunctions_prices.php 文件中
function zen_get_products_price_is_free($products_id) {
global $db;
$product_check = $db->Execute(“select product_is_free from ” .
TABLE_PRODUCTS . ” where products_id = ‘” . (int)$products_id . “‘” . ”
limit 1″);
if ($product_check->fields['product_is_free'] == ’1′) {
$the_free_price = true;
} else {
$the_free_price = false;
}
return $the_free_price;
}