函数zen_get_product_is_always_free_shipping 是判断一个商品是否为免运费商品。函数实现原理很简单。主要通过商品的ID来获取products表字段product_is_always_free_shipping的值,如果为1则表示刚商品为免运费商品,函数返回true,反之false;
商品免运费设置是在添加一个商品的时候设置的。
函数原型代码:[code]function zen_get_product_is_always_free_shipping($lookup) {
global $db;
$sql = “select p.product_is_always_free_shipping from " . TABLE_PRODUCTS . " p where p.products_id='” . (int)$lookup . “'”;
$look_up = $db->Execute($sql);
if ($look_up->fields['product_is_always_free_shipping'] == '1') {
return true;
} else {
return false;
}
} [/code]