Jump to content

Minimum Amount free for virtual Products


m3442a

Recommended Posts

Hello,

 

have a little bit problem with the minimum amount solution.

i need for virtual products (selling vouchers ) a minimum amount = 0, for all other physically products i have the standard Minimum purchasing limit.

 

How can developing the system if i buying the virtual product than the showing the payments?

 

I try this in the controllers/front/OrderOpcController.php

 

/* Check minimal amount */
$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
 
if ($product->is_virtual)
 
            $minimalPurchase = 0;  
 
        else
 
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
 
 
but not work
 
Thanks for help
Edited by m3442a (see edit history)
Link to comment
Share on other sites

Ok i found it myself here the right code in the OrderOPCController.php

 

/* Check minimal amount */
$currency = Currency::getCurrency((int)$this->context->cart->id_currency);
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
if ($isVirtualCart = $this->context->cart->isVirtualCart())
{
$return = Hook::exec('displayPayment');
}
else{
 
return '<p class="warning">'.sprintf(
Tools::displayError('A minimum purchase total of %s is required in order to validate your order.'),
Tools::displayPrice($minimalPurchase, $currency)
).'</p>';
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...