私のショップはすべての商品を で販売しています$ 25
。次に、顧客のチェックアウト時に製品の合計数量に基づいて割引を行いたいと考えています。
顧客が合計数量が 50 を超えて購入した場合、各製品の価格は各製品の から$25
まで$22
に上書きされます。
以下のようなもの:
if (total_quantity > 80) {
price for each product is $19
}
elseif (total_quantity > 50) {
price for each product is $22
}
else {
normal price
}
$this->cart->countProducts()
現在、顧客のチェックアウト時に使用して合計数量を検出できますが、価格を上書きする方法がわかりません(これはファイル controller\checkout\confirm.php に関連していると確信しています)。
誰かがこれについて私を案内してくれることを願っています。
アップデート :
これで、合計数量に基づいてすべての製品の価格をフィルタリングできます。
if ($this->cart->countProducts() > 3) {
$product_price = '24.00';
}
elseif ($this->cart->countProducts() > 2) {
$product_price = '23.00';
}
else {
$product_price = $product['price'];
}
$this->data['products'][] = array(
'product_id' => $product['product_id'],
'name' => $product['name'],
'model' => $product['model'],
'option' => $option_data,
'quantity' => $product['quantity'],
'subtract' => $product['subtract'],
'price' => $this->currency->format($this->tax->calculate($product_price, $product['tax_class_id'], $this->config->get('config_tax'))),
'total' => $this->currency->format($this->tax->calculate($product_price, $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']),
'href' => $this->url->link('product/product', 'product_id=' . $product['product_id'])
);
しかし、小計と合計をどこでオーバーライドするかわかりません。
p/s: すべての製品価格は $25 に固定されています
OC バージョン: 最新バージョン