-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
Hello there,
I'll describe the issue by an example, assume you've set "inlandcosts" to 25$, and "max_order_total" to 1000$. Now add items to the cart with 998$ grand total.
See the implementation of Mage_Payment_Model_Method_Abstract::isApplicableToQuote()
if ($checksBitMask & self::CHECK_ORDER_TOTAL_MIN_MAX) {
$total = $quote->getBaseGrandTotal();
$minTotal = $this->getConfigData('min_order_total');
$maxTotal = $this->getConfigData('max_order_total');
if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) {
return false;
}
}So if the current payment method in the quote is set to "phoenix_cashondelivery", the GT will be 1023$ which makes the payment method not available, otherwise the GT will be 998$ and the payment method is available.
How did I fix it?
I overridden getConfigData method in Phoenix_CashOnDelivery_Model_CashOnDelivery as follows:
public function getConfigData($field, $storeId = null)
{
if($field == 'max_order_total')
{
$customConfig = parent::getConfigData($field, $storeId);
try {
/* @var Mage_Checkout_Model_Type_Onepage $onePage */
$onePage = Mage::getSingleton('checkout/type_onepage');
$paymentCode = $onePage->getQuote()->getPayment()->getMethod();
if($paymentCode == 'phoenix_cashondelivery')
$customConfig += $this->getConfigData('inlandcosts', $storeId);
} catch (Exception $e)
{
Mage::logException($e);
}
return $customConfig;
}
return parent::getConfigData($field, $storeId);
}Please advise.
Many Thanks
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels