ここに Ubercart の第一人者がいるかどうかはわかりませんが、私の質問は次のとおりです。
同じ商品を複数注文するお客様に割引を適用したいです。
価格は次のとおりです。
1 製品 - 各 $5
製品 < 10 製品 - 各 $4.50
< 100 製品 - 各 $4
これを実現する方法を知っている人はいますか?独自のカスタム価格フィールドを追加することを考えましたが、カート/チェックアウトでそれらを呼び出す方法がわかりません。
uc_bulk_discountモジュールはどうですか?
私は達人ではありませんが、いくつかのグーグルで 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