Closed emiliolodigiani closed 10 years ago
I found where the problem is.
In /app/code/community/Phoenix/CashOnDelivery/Model/CashOnDelivery.php
at line 171 and following
$shippingMethodCode = explode('_', $quote->getShippingAddress()->getShippingMethod());
$shippingMethodCode = $shippingMethodCode[0];
have an issue with shipping methods containing _ in the name, as ParadoxLabs_StorePickup (pl_store_pickup). Exploding and getting the first array value returns "pl" instead of "pl_store_pickup".
I think there are two possible solutions:
I cannot fork and send you a pull request because I already have an other fork of this repository, working for fixing the invoice tax problem.
Anyway I have tested a fix for this issue:
in file /app/code/community/Phoenix/CashOnDelivery/Model/CashOnDelivery.php
remove lines 172-178
$shippingMethodCode = explode('_', $quote->getShippingAddress()->getShippingMethod());
$shippingMethodCode = $shippingMethodCode[0];
$disallowedShippingMethods = $this->getConfigData('disallowedshippingmethods', $quote->getStoreId());
if (in_array($shippingMethodCode, explode(',', $disallowedShippingMethods))) {
return false;
}
and replace with lines:
$shippingMethodCode = $quote->getShippingAddress()->getShippingMethod();
$disallowedShippingMethods = $this->getConfigData('disallowedshippingmethods', $quote->getStoreId());
$disallowedShippingMethods = explode(',', $disallowedShippingMethods);
foreach($disallowedShippingMethods as $disallowedShippingMethod){
if(strpos($shippingMethodCode, $disallowedShippingMethod) !== false){
return false;
}
}
fixed, thank you!
If I select a disallowed shipping method, the corresponding shipping method is still available in customer checkout.
Tested with ParadoxLabs_StorePickup extension