# 检查商品是否免运费

**URL:** <https://www.isharkfly.com/t/topic/5575>\
**Category:** PHP\
**Created:** [August 9, 2012, 5:44am UTC](https://www.isharkfly.com/t/topic/5575 "2012-08-09T05:44:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [August 9, 2012, 5:44am UTC](https://www.isharkfly.com/t/topic/5575/1 "2012-08-09T05:44:28Z")

</div>

zen\_get\_product\_is\_always\_free\_shipping($lookup)  
该函数通过商品的ID返回该商品是否免运费的。如果是则返回true,否则返回false;  
主要查询了 products 表。在includes/database\_tables.php中定义：  
define(‘TABLE\_PRODUCTS’, DB\_PREFIX . ‘products’);  
函数源代码：` [color=#000000] function zen_get_product_is_always_free_shipping($lookup) {[/color]
        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;
        }
      }`
