订购超过 200,500 件商品时给予指定折扣
Posted
技术标签:
【中文标题】订购超过 200,500 件商品时给予指定折扣【英文标题】:Giving a specified discount on a product when ordering more then 200,500 【发布时间】:2011-05-07 19:29:19 【问题描述】:我不知道这里是否有任何 Ubercart 大师,但这是我的问题:
我想为订购超过 1 件相同产品的客户提供折扣。
假设价格如下:
1 件产品 - 每件 5 美元
任何人都知道如何实现这一点?我想添加我自己的自定义价格字段,但我想知道如何在购物车/结帐中调用它们。
【问题讨论】:
【参考方案1】:uc_bulk_discount 模块怎么样?
【讨论】:
【参考方案2】:我不是专家,但一些谷歌搜索将我指向 hook_uc_price_handler。
您可以设置一个处理程序来处理价格。
如果您有一个名为“示例”的自定义模块,您可以执行以下操作;
function example_uc_price_handler()
return array(
'alter' => array(
'title' => t('Quantity price discount handler'),
'description' => t('Discounts the price based on quantity ordered'),
'callback' => 'example_price_alterer',
),
);
function example_price_alterer(&$price_info, $context, $options = array())
if($price_info['qty'] > 200)
$price_info['price'] *= 0.8; //we're reducing the price by 20% as a demo - add your logic here
这是我的资料来源;
http://www.ubercart.org/docs/developer/11375/price_api http://www.ubercart.org/forum/development/14381/price_alteration_hook http://api.ubercart.org/api/function/hook_uc_price_handler/2
【讨论】:
谢谢西蒙,我会调查的!以上是关于订购超过 200,500 件商品时给予指定折扣的主要内容,如果未能解决你的问题,请参考以下文章