Hello, is there any possibility how to show payment method only for defined range of total amount?
Usage: We want to offer payment PlatimPak which is supported by payment gate only for range 500 - 25000 CZK.
Thank you.
added in constructor:
$varsToPush = $this->getVarsToPush ();
$this->setConfigParameterable ($this->_configTableFieldName, $varsToPush);
$this->setConvertable(array('min_amount','max_amount','cost_per_transaction','cost_min_transaction'));
$this->setConvertDecimal(array('min_amount','max_amount','cost_per_transaction','cost_min_transaction','cost_percent_total'));
+ new function:
/**
* Check if the payment conditions are fulfilled for this payment method
*
* @author: Valerie Isaksen
*
* @param $cart_prices: cart prices
* @param $payment
* @return true: if the conditions are fulfilled, false otherwise
*
*/
protected function checkConditions ($cart, $method, $cart_prices) {
$this->convert_condition_amount($method);
$amount = $this->getCartAmount($cart_prices);
if($this->_toConvert){
$this->convertToVendorCurrency($method);
}
//vmdebug('standard checkConditions', $amount, $cart_prices['salesPrice'], $cart_prices['salesPriceCoupon']);
$amount_cond = ($amount >= $method->min_amount AND $amount <= $method->max_amount
OR
($method->min_amount <= $amount AND ($method->max_amount == 0)));
if (!$amount_cond) {
return FALSE;
}
return TRUE;
}
added:
<fieldset name="restrictions" >
<field name="countries" multiple="true" type="vmcountries" scope="com_virtuemart" default=""
label="VMPAYMENT_STANDARD_COUNTRIES" description="VMPAYMENT_STANDARD_COUNTRIES_TIP"/>
<field name="min_amount" type="text" label="VMPAYMENT_STANDARD_MIN_AMOUNT"
description="VMPAYMENT_STANDARD_MIN_AMOUNT_TIP"/>
<field name="max_amount" type="text" label="VMPAYMENT_STANDARD_MAX_AMOUNT"
description="VMPAYMENT_STANDARD_MAX_AMOUNT_TIP"/>
</fieldset>