获取商品处理类型的函数

zen_get_info_page($zf_product_id)
该函数通过商品ID返回该商品类型的处理类型。例如,如果该商品的类型为普通商品,而zencart里设置处理普通商品的类型是product,那么该函数
将返回product_inf,对应的处理方式就是在includes/modules/pages/product_info/目录下面。
主要查询了 products,product_types 表。在includes/database_tables.php中定义:
define(‘TABLE_PRODUCTS’, DB_PREFIX . ‘products’);
define(‘TABLE_PRODUCT_TYPES’, DB_PREFIX . ‘product_types’);
函数源代码:function zen_get_info_page($zf_product_id) { global $db; $sql = "select products_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$zf_product_id . "'"; $zp_type = $db->Execute($sql); if ($zp_type->RecordCount() == 0) { return 'product_info'; } else { $zp_product_type = $zp_type->fields['products_type']; $sql = "select type_handler from " . TABLE_PRODUCT_TYPES . " where type_id = '" . (int)$zp_product_type . "'"; $zp_handler = $db->Execute($sql); return $zp_handler->fields['type_handler'] . '_info'; } }