![](/img/trans.png)
[英]how to calculate discount based on category of products on shopping cart page in opencart?
[英]Display a custom message if there are more than 25 products in shopping cart (OpenCart)
我有一個用於 CD 的 OpenCart 在線市場。 我希望當您將一些產品添加到購物車並轉到購物車頁面時,如果您購買超過 (>=) 25 個產品(CD),顯示消息“請聯系我們獲取超過 25 個 CD 的交貨價格。”。
是否有一些插件可以用於它或其他方式?
我感謝您的所有建議。 提前致謝!
這並不難,創建一個函數:
public function countProducts() {
return array_sum($this->session->data['cart']);
}
並在您的購物車模板中添加以下代碼(您要顯示警告的位置):
<?php
if($this->cart->countProducts()>25){
//ofc add your html tags for nice error, this will come ugly :)
echo "Please contact us for Delivery Price of more than 25 CD's."
}
?>
類似的問題可以在這里找到
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.