Opencart最低订货价
Opencart minimum order price
我正在尝试在 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
引用:
Opencart minimum order price exclude one category
方法不一样,但你可以这样做:
将此行添加到您的 checkout.php 控制器文件中。
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'));
}
就是这样。
下面的代码对我有用:
<?php if($this->session->data['currency'] == 'USD') : ?>
<?php if($this->cart->getSubtotal() < 2enter code here0) : ?>
<div class="warning"><center><?php echo $text_comandamin_eur; ?></center></div>
<?php endif; ?>
<?php } elseif($this->session->data['currency'] == 'INR') : ?>
<?php if($this->cart->getSubtotal() < 1000) : ?>
<div class="warning"><center><?php echo $text_comandamin_ron; ?></center></div>
<?php endif; ?>
<?php endif; ?>
我正在尝试在 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
引用:
Opencart minimum order price exclude one category
方法不一样,但你可以这样做:
将此行添加到您的 checkout.php 控制器文件中。
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'));
}
就是这样。
下面的代码对我有用:
<?php if($this->session->data['currency'] == 'USD') : ?>
<?php if($this->cart->getSubtotal() < 2enter code here0) : ?>
<div class="warning"><center><?php echo $text_comandamin_eur; ?></center></div>
<?php endif; ?>
<?php } elseif($this->session->data['currency'] == 'INR') : ?>
<?php if($this->cart->getSubtotal() < 1000) : ?>
<div class="warning"><center><?php echo $text_comandamin_ron; ?></center></div>
<?php endif; ?>
<?php endif; ?>