本文介绍了Opencart最低订购价格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从此处在catalog/view/theme/default/template/checkout/confirm.tpl中实现以下代码
I am trying to implement below code from here in catalogue/view/theme/default/template/checkout/confirm.tpl
<?php if ($this->cart->getSubtotal() >= 1000) { ?>
<div id="payment"><?php echo $payment; ?></div>
<?php } else { ?>
<div class="warning">Minimum 10 Euro to checkout</div>
<?php } ?>
但是我遇到错误
Notice: Undefined property: Loader::$cart in C:\xampp\htdocs\optest\catalog\view\theme\default\template\checkout\confirm.tpl on line 51
Fatal error: Call to a member function getSubtotal() on null in C:\xampp\htdocs\optest\catalog\view\theme\default\template\checkout\confirm.tpl on line 51
参考已获得
http://forum.opencart.com/viewtopic.php?t=53810
推荐答案
方法不一样,但您可以这样做:
Not the same way but you can do it like this:
将此行添加到checkout.php控制器文件中.
Add this line in your checkout.php controller file.
if ($this->cart->getSubtotal() < 1000) {
$this->session->data['error'] = 'Your warning message';
$this->response->redirect($this->url->link('checkout/cart'));
}
之后
if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
$this->response->redirect($this->url->link('checkout/cart'));
}
就这样.
这篇关于Opencart最低订购价格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!