zencart商品页面显示浏览次数

2012-06-19 15:24 来源:www.chinab4c.com 作者:zencart专家

    zencart商品页面显示浏览次数,这个是非常重要的。我们可以通过对zen cart数据库进行调整,来达到显示zencart商品页面浏览次数的目的.

     1:修改zen cart数据库商品表
alter table zen_products add column click_count int(1) default 0;

2:includes/modules/pages/product_info/header_php.php
$db->Execute("update ".TABLE_PRODUCTS." set click_count=click_count+1 where products_id = '".intval($_GET

['products_id'])."'");

3:includes/modules/pages/product_info/main_template_vars.php

$sql = "select p.products_id,p.click_count, pd.products_name,
                  pd.products_description, p.products_model,
                  p.products_quantity, p.products_image,
                  pd.products_url, p.products_price,
                  p.products_tax_class_id, p.products_date_added,
                  p.products_date_available, p.manufacturers_id, p.products_quantity,
                  p.products_weight, p.products_priced_by_attribute, p.product_is_free,
                  p.products_qty_box_status,
                  p.products_quantity_order_max,
                  p.products_discount_type, p.products_discount_type_from, p.products_sort_order,

p.products_price_sorter
           from   " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
           where  p.products_status = '1'
           and    p.products_id = '" . (int)$_GET['products_id'] . "'
           and    pd.products_id = p.products_id
           and    pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

4:tpl_product_info_display.php
<li><? echo TEXT_CLICK_COUNT.$product_info->fields['click_count'];?></li>

5:languages/xxx/product_info.php
define('TEXT_CLICK_COUNT', '浏览次数: ');
define('TEXT_CLICK_COUNT', 'Click count: ');
 

来源:http://www.chinab4c.com