论坛风格切换
  • 3313阅读
  • 0回复

zen cart获取生产商信息的函数 [复制链接]

上一主题 下一主题
ben
 

发帖
119
大洋
5222
贡献值
91
只看楼主 正序阅读 使用道具 楼主  发表于: 2011-08-07

 
zen_get_products_manufacturers_name($product_id) 
该函数返回商品生产商名字,输入参数为商品的ID;如果没有则返回空。 
主要查询了 products, manufacturers 表。在includes/database_tables.php中定义: 
define('TABLE_PRODUCTS', DB_PREFIX . 'products'); 
define('TABLE_MANUFACTURERS', DB_PREFIX . 'manufacturers'); 
函数源代码: 

  1. function zen_get_products_manufacturers_name($product_id) {
  2.     global $db;
  3.     $product_query = "select m.manufacturers_name
  4.                       from " . TABLE_PRODUCTS . " p, " .
  5.                             TABLE_MANUFACTURERS . " m
  6.                       where p.products_id = '" . (int)$product_id . "'
  7.                       and p.manufacturers_id = m.manufacturers_id";
  8.     $product =$db->Execute($product_query);
  9.     return ($product->RecordCount() > 0) ? $product->fields['manufacturers_name'] : "";
  10.   }
 
zen_get_products_manufacturers_image($product_id) 
该函数返回生产商的图标,输入参数为商品的ID。 
主要查询了 products, manufacturers 表。在includes/database_tables.php中定义: 
define('TABLE_PRODUCTS', DB_PREFIX . 'products'); 
define('TABLE_MANUFACTURERS', DB_PREFIX . 'manufacturers'); 
函数源代码: 
  1. function zen_get_products_manufacturers_image($product_id) {
  2.     global $db;
  3.     $product_query = "select m.manufacturers_image
  4.                       from " . TABLE_PRODUCTS . " p, " .
  5.                             TABLE_MANUFACTURERS . " m
  6.                       where p.products_id = '" . (int)$product_id . "'
  7.                       and p.manufacturers_id = m.manufacturers_id";
  8.     $product =$db->Execute($product_query);
  9.     return $product->fields['manufacturers_image'];
  10.   }
 
zen_get_products_manufacturers_id($product_id) 
该函数通过商品的ID来返回该商品的生产商ID。 
主要查询了 products 表。在includes/database_tables.php中定义: 
define('TABLE_PRODUCTS', DB_PREFIX . 'products'); 
函数源代码: 
  1. function zen_get_products_manufacturers_id($product_id) {
  2.     global $db;
  3.     $product_query = "select p.manufacturers_id
  4.                       from " . TABLE_PRODUCTS . " p
  5.                       where p.products_id = '" . (int)$product_id . "'";
  6.     $product =$db->Execute($product_query);
  7.     return $product->fields['manufacturers_id'];
  8.   }

欢迎来到zen-cart论坛,这里将是你迈进zen-cart世界的起点
有问题到求助版块提问。
快速回复
限80 字节
批量上传需要先选择文件,再选择上传(---删除纯表情和无意义内容,扣1分---)
 
上一个 下一个