zen-cart网站,模版,采集,二次开发

首页 » ZenCart » ZenCart教程 » 阅读文章

ZenCart分类数量打折Category Quantity Discount插件

2012-05-29 04:00 126384 24 发表评论
标签:


此插件功能是从lightinthebox模板中扣出来的,此模块可以和zencart默认的数量打折功能混合使用,优先级上高于这个插件

效果图

后台效果

下载

安装方法

1.将update.sql导入到数据库

2.将YOUR_TEMPLATES文件夹改为自己的模板名,然后上传到网站根目录

3.在includes/database_tables.php 在末尾添加代码

define('TABLE_CATEGORIES_DISCOUNT_QUANTITY', DB_PREFIX . 'categories_discount_quantity');

4.在includes/functions/functions_prices.php查找

$display_price = zen_get_products_base_price($product_id);

在其上添加(2012-8-1更正)

    $products_query_discount_type = $products_query->fields['products_discount_type'];
	  if ($products_discounts_query->RecordCount() <=0 and $products_query_discount_type == 0) {
        	$products_query2 = $db->Execute("select categories_discount_type, categories_discount_type_from FROM " . TABLE_CATEGORIES . " c , ". TABLE_PRODUCTS_TO_CATEGORIES ." pc where c.categories_id = pc.categories_id AND products_id='" . (int)$product_id . "'");
            $products_query_discount_type = $products_query2->fields['categories_discount_type'];
            $products_discounts_query = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES_DISCOUNT_QUANTITY ." cd,". TABLE_PRODUCTS_TO_CATEGORIES." pc WHERE cd.categories_id = pc.categories_id AND products_id = " . (int)$product_id. " AND discount_qty <= '" .(float)$check_qty. "' ORDER BY discount_qty DESC");
}

查找

switch ($products_query->fields['products_discount_type']) {

替换为

switch ($products_query_discount_type) {

5.在includes/classes/shopping_cart.php查找

// discount qty pricing

在其下添加(有2处,2处都添加)

$categories_query = $db->Execute("SELECT categories_discount_type FROM ". TABLE_CATEGORIES ." WHERE categories_id = ". zen_get_products_category_id($products_id));

在查找

if ($products->fields['products_discount_type'] != '0') {

修改为

if ($products->fields['products_discount_type'] != '0' || $categories_query->fields['categories_discount_type'] != '0') {

在查找

if ($product->fields['products_discount_type'] != '0') {

修改为

if ($product->fields['products_discount_type'] != '0' || $categories_query->fields['categories_discount_type'] != '0') {

6.在includes/modules/pages/product_info/main_template_vars.php查找

  $products_discount_type = $product_info->fields['products_discount_type'];
  $products_discount_type_from = $product_info->fields['products_discount_type_from'];

修改为

$categories_discount = $db->Execute("SELECT * FROM ".TABLE_CATEGORIES." WHERE categories_id = ".$current_category_id);
if( $product_info->fields['products_discount_type']!=0 ){
	$products_discount_type = $product_info->fields['products_discount_type'];
	$products_discount_type_from = $product_info->fields['products_discount_type_from'];
}else{
	$products_discount_type = $categories_discount->fields['categories_discount_type'];
	$products_discount_type_from = $categories_discount->fields['categories_discount_type_from'];
}

7.在includes/modules/products_quantity_discounts.php中查找

$discount_col_cnt = DISCOUNT_QUANTITY_PRICES_COLUMN;

在其上添加

if ($products_discounts_query->RecordCount() <=0 ) {
  	$products_discounts_query = $db->Execute("SELECT * FROM " . TABLE_CATEGORIES_DISCOUNT_QUANTITY ." WHERE categories_id = " . (int)$current_category_id . " AND discount_qty !=0" . " ORDER BY discount_qty" );
}

附修改样本:金山快盘下载,如果以前没对以上文件做过修改,可以直接覆盖使用

8.在includes\templates\YOUR_TEMPLATE\templates\tpl_product_info_display.php查找

if ($products_discount_type != 0) {

修改为

if ($products_discount_type != 0 || $categories_discount_type != 0) {
相关日志:

评论 共24条 (RSS 2.0) 发表评论

  1. zhuanqiannan 说道:

    安装失败。。。错误(HTTP 500 内部服务器错误)意味着您正在访问的网站出现了服务器问题,此问题阻止了该网页的显示。

    • E-zencart 说道:

      开启程序的报错提示,插件的错误不会提示500错误的,一般要么空白页,要么报什么什么文件有错误

      • handan 说道:

        我安装也会出现空白页面,错误好像在 functions_prices.php

        • ezencart 说道:

          1.5版我没有测试,我是在1.39版上测试的,然后开启报错,看具体的报错信息

  2. zhuanqiannan 说道:

    111.jpg

  3. zhuanqiannan 说道:

    你看我上传的图片,我安装好怎么成这样子了?

  4. derek 说道:

    我装了也空白。大侠求救啊!我的zencart 是1.39h 英文原版的

  5. derek 说道:

    [01-Aug-2012 11:59:40] PHP Parse error: syntax error, unexpected $end in D:\www\ziji\zencart2\includes\functions\functions_prices.php on line 1373

    提示是functions_prices.php错误

    • E-zencart 说道:

      :evil: Sorry 复制代码时掉了个 } 了,文中已更正

      • John 说道:

        我用这种修改方法在zencart1.50版本上做修改,后台catalog目录下不显示,好心的楼主可不可以说明一下在1.5上 的修改方法。

        • E-zencart 说道:

          1.5版没测试,这几天忙着找房子,等清闲下来了,看看否移植到1.5上

  6. juen 说道:

    在购物车里无法打折啊

  7. 赚钱难 说道:

    monster diesel
    $75.00 $65.00
    Model: monster diesel
    Shipping Weight: 1.5kg
    Please Choose:
    Color
    Qty Discounts Off Price
    Qty.Range(unit) Price(per unit) Discount
    1-2 $65.00
    3-6 $72.75 -11.9230769231%
    7-8 $69.75 -7.30769230769%
    9+ $68.25 -5%
    * Discounts may vary based on options above
    博主你看,特价产品打折时候出错!能不能限制特价产品不能再打折?

  8. 赚钱难 说道:

    博主,特价产品再分类数量打折 用这个插件后, 如果原价90特价80 1-2个是80无折扣,3-5个是95折76,在商品页面显示是正常的,但是我选择3个产品进购物车要付款的时候发现 3个产品的价格90*95%=85.5这样子。希望博主测试下,有空修复这个BUG。

  9. 赚钱难 说道:

    为了用这个插件,我把我网站所有特价都删除了。。。这样购物车显示出来的价格就正常了。

    • xiao_min 说道:

      我的情況和你的一樣,配合Quantity Discount模塊用了,但是不能按特價打折,是按原價打折的額,還有一種方法就是,怎麼本身有帶的,Products Price Manager,但是這個只能一個個添加,不能批量,會累死人啊,但是這個是按特價打折的.

  10. 赚钱难 说道:

    还有,后台我也选择了从特价处 再百分比打折的。设置正确。

  11. 赚钱难 说道:

    1.50我测试了不能用。

  12. xiao_min 说道:

    我的购物车不显示折扣,是不是还要装什么插件啊,还有装了这个,shopping_chart这个页面有折扣的链接错误了

  13. 土药激情 说道:

    折扣价格只对基准价有效。。对其他属性价格无效,请博主更正,期待更新谢谢。

  14. 缘指环 说道:

    在产品页面正常打折,但在购物车里无法打折啊

发表评论

  • 
  • 插入代码

联系我 Contact Me

回到页首