I`m trying change minimal amount in cart different for one country. I`m using module advancedcheckous so i`m doing modifications not in orderOpcController.php I`m found code in advancedcheckout.php
I`ve added for country that I need:
$id_country = Tools::GetValue('id_country');
if ($id_country = 216){
$minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);}
For other countries I need Increase minimal amount up to 1.66667
Please check my code why it not working:
public function cartListErrors()
{
$err = array();
$errors = array();
$arr = array();
$arr = $this->checkQuantitiesAlt();
$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
$id_country = Tools::GetValue('id_country');
if ($id_country = 216){
$minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);}
else {
$minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM')*1.6666667, $currency);}
if ($this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS) < $minimal_purchase) {
$err[] = sprintf(
$this->l(
'A minimum purchase total of %1s (tax excl.) is required to validate'.
' your order, current purchase total is %2s (tax excl.).'
),
Tools::displayPrice($minimal_purchase, $currency),
Tools::displayPrice(
$this->context->cart->getOrderTotal(true, Cart::ONLY_PRODUCTS),
$currency
)
);
}