3

ここに Ubercart の第一人者がいるかどうかはわかりませんが、私の質問は次のとおりです。

同じ商品を複数注文するお客様に割引を適用したいです。

価格は次のとおりです。

1 製品 - 各 $5
製品 < 10 製品 - 各 $4.50
< 100 製品 - 各 $4

これを実現する方法を知っている人はいますか?独自のカスタム価格フィールドを追加することを考えましたが、カート/チェックアウトでそれらを呼び出す方法がわかりません。

4

2 に答える 2

0

uc_bulk_discountモジュールはどうですか?

于 2010-11-10T18:23:05.033 に答える
0

私は達人ではありませんが、いくつかのグーグルで hook_uc_price_handler を指摘されました。

価格を処理するハンドラを設定できます。

「example」という名前のカスタム モジュールがある場合は、次のことができます。

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

于 2010-11-10T18:03:02.953 に答える