Zen_get_products_name函数详解

zen_get_products_name($product_id, $language = ‘’)
该函数通过输入一个商品ID来获取该商品的名字,如果没有指定所返回的语言类型,默认使用当前网站设置的语言类型。
主要查询了 products 表。在includes/database_tables.php中定义:
define(‘TABLE_PRODUCTS’, DB_PREFIX . ‘products’);
*/ function zen_get_products_name($product_id, $language = '') { global $db; if (empty($language)) $language = $_SESSION['languages_id']; $product_query = "select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'"; $product = $db->Execute($product_query); return $product->fields['products_name']; }