同じ商品まとめて購入割引機能
ShoppingController.phpの修正
/src/Eccube/Controller/ShoppingController.phpのindex confirm関数の// form作成の上に下記追加。
// 同じ商品5個まとめて購入、5%割引 $discount = 0 ; foreach ($cartService->getCart()->getCartItems() as $CartItem) { if ($CartItem[ 'quantity' ] > 4 ) { $discount = $discount + ( int )($CartItem[ 'quantity' ] * $CartItem[ 'price' ] * 0.05 ); } } if ($discount > 0 ) { $total = $Order->getTotalPrice() - $discount; $Order->setDiscount($discount); $Order->setTotal($total); } // form作成 $builder = $app[ 'eccube.service.shopping' ]->getShippingFormBuilder($Order); |
他の修正
カード決済の場合、Plugin直下のカードControllerを以上のように修正する必要ある。
以上