代码之家  ›  专栏  ›  技术社区  ›  Paul

订购超过200500的产品时给予特定折扣

  •  3
  • Paul  · 技术社区  · 14 年前

    我不知道这里有没有Ubercart大师,但我的问题是:

    我想给订购一件以上同一产品的顾客打折。

    假设价格如下:


    <10种产品-每种4.50美元
    <100种产品-每种4美元

    2 回复  |  直到 14 年前
        1
  •  0
  •   Dave DeLong    14 年前

    那个怎么样 uc_bulk_discount 模块?

        2
  •  0
  •   Simon Quentin    14 年前

    您可以设置一个处理程序来处理价格。

    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