From 1e345d392bbda054e891bcf3ee19b9d01251f250 Mon Sep 17 00:00:00 2001 From: Aaron Rickard Date: Tue, 8 Mar 2016 16:18:17 +0000 Subject: [PATCH 1/4] #57: Bug Fix - Cart weight being incorrectly calculated Cart weight being incorrectly calculated when using the 'kg' option in the system configuration section. --- .../community/Meanbee/Royalmail/Helper/Data.php | 6 +++--- .../Royalmail/Model/Shipping/Carrier/Royalmail.php | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/code/community/Meanbee/Royalmail/Helper/Data.php b/app/code/community/Meanbee/Royalmail/Helper/Data.php index 7cde7fe..d404ae0 100644 --- a/app/code/community/Meanbee/Royalmail/Helper/Data.php +++ b/app/code/community/Meanbee/Royalmail/Helper/Data.php @@ -93,13 +93,13 @@ public function _getWeight() switch ($unit) { case 'kg': - $weight *= 1000; + // do nothing, as default royalmail value break; case 'lb': $weight *= 453.59237; break; - default: // case 'g': - // No need to do anything.. + default: // case 'g' + $weight /= 1000; break; } diff --git a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php index 9f47fb4..05c652d 100644 --- a/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php +++ b/app/code/community/Meanbee/Royalmail/Model/Shipping/Carrier/Royalmail.php @@ -88,12 +88,18 @@ public function collectRates(Mage_Shipping_Model_Rate_Request $request) if (empty($allowedMethods) == false) { $data = $request->getData(); + + $dataClass = Mage::helper('royalmail'); + $dataClass->setWeightUnit($this->getConfigData('weight_unit')); + $dataClass->setNegativeWeight($removeWeight); + $dataClass->_setWeight($data['package_weight']); + $calculatedMethods = $this->calculateMethodClass->getMethods($data['dest_country_id'], - $data['package_value'], $data['package_weight']); + $data['package_value'], $dataClass->_getWeight()); // Config check to remove small or medium parcel size based on the // config value set in the admin panel - if ($data['package_weight'] <= 2) { + if ($dataClass->_getWeight() <= 2) { if (Mage::getStoreConfig('carriers/royalmail/parcel_size') == Meanbee_Royalmail_Model_Parcelsize::SMALL || Mage::getStoreConfig('carriers/royalmail/parcel_size') == "" ) { @@ -119,10 +125,6 @@ public function collectRates(Mage_Shipping_Model_Rate_Request $request) foreach ($calculatedMethods as $methodItem) { if ($allowedMethod[1] == $methodItem->shippingMethodNameClean) { - $dataClass = Mage::helper('royalmail'); - $dataClass->setWeightUnit($this->getConfigData('weight_unit')); - $dataClass->setNegativeWeight($removeWeight); - $method = Mage::getModel('shipping/rate_result_method'); $method->setCarrier($this->_code); From cdd7efe6f5efeb7e67ef8e89dd4c9d0b35211ab0 Mon Sep 17 00:00:00 2001 From: Aaron Rickard Date: Tue, 8 Mar 2016 16:52:36 +0000 Subject: [PATCH 2/4] #57: Move decimal on lb calculation Move the decimal place on lb calculation to correctly calculate pounds to kg --- app/code/community/Meanbee/Royalmail/Helper/Data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/Helper/Data.php b/app/code/community/Meanbee/Royalmail/Helper/Data.php index d404ae0..e4cb8c7 100644 --- a/app/code/community/Meanbee/Royalmail/Helper/Data.php +++ b/app/code/community/Meanbee/Royalmail/Helper/Data.php @@ -96,7 +96,7 @@ public function _getWeight() // do nothing, as default royalmail value break; case 'lb': - $weight *= 453.59237; + $weight *= 0.45359237; break; default: // case 'g' $weight /= 1000; From 82112031e02f60122a8b8db5c50697e5b042fff9 Mon Sep 17 00:00:00 2001 From: Aaron Rickard Date: Wed, 9 Mar 2016 10:27:16 +0000 Subject: [PATCH 3/4] #60: Bug Fix - spelling mistake in CSV files Fix the spelling mistake preventing some users seeing the special delivery method. --- .../data/3_deliveryMethodMeta.csv | 18 +++--- .../data/4_deliveryToPrice.csv | 60 +++++++++---------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/Meanbee/RoyalmailPHPLibrary/data/3_deliveryMethodMeta.csv b/lib/Meanbee/RoyalmailPHPLibrary/data/3_deliveryMethodMeta.csv index cd56c07..f540264 100644 --- a/lib/Meanbee/RoyalmailPHPLibrary/data/3_deliveryMethodMeta.csv +++ b/lib/Meanbee/RoyalmailPHPLibrary/data/3_deliveryMethodMeta.csv @@ -67,18 +67,18 @@ WORLD_ZONE_TWO_INTERNATIONAL_SIGNED_SMALL_PARCEL_EXTRA_INSURANCE,50.01,250,250," WORLD_ZONE_TWO_INTERNATIONAL_ECONOMY_LETTER,0,20,20,"International Economy Letter" WORLD_ZONE_TWO_INTERNATIONAL_ECONOMY_LARGE_LETTER,0,20,20,"International Economy Large Letter" WORLD_ZONE_TWO_INTERNATIONAL_ECONOMY_SMALL_PARCEL,0,20,20,"International Economy Small Parcel" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_500,0,500,500,"Special Delivery: Guaranteed by 1pm" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_1000,501,1000,1000,"Special Delivery: Guaranteed by 1pm" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_2500,1001,2500,2500,"Special Delivery: Guaranteed by 1pm" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_500,0,500,500,"Special Delivery: Guaranteed by 1pm" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_1000,501,1000,1000,"Special Delivery: Guaranteed by 1pm" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_2500,1001,2500,2500,"Special Delivery: Guaranteed by 1pm" UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_50,0,50,50,"Special Delivery: Guaranteed by 9am" UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_1000,51,1000,1000,"Special Delivery: Guaranteed by 9am" UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_2500,1001,2500,2500,"Special Delivery: Guaranteed by 9am" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,0,500,500,"Special Delivery: Guaranteed by 1pm Saturday" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,501,1000,1000,"Special Delivery: Guaranteed by 1pm Saturday" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,1001,2500,2500,"Special Delivery: Guaranteed by 1pm Saturday" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_50,0,50,50,"Special Delivery: Guaranteed by 9am Saturday" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_1000,51,1000,1000,"Special Delivery: Guaranteed by 9am Saturday" -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_2500,1001,2500,2500,"Special Delivery: Guaranteed by 9am Saturday" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,0,500,500,"Special Delivery: Guaranteed by 1pm Saturday" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,501,1000,1000,"Special Delivery: Guaranteed by 1pm Saturday" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,1001,2500,2500,"Special Delivery: Guaranteed by 1pm Saturday" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_50,0,50,50,"Special Delivery: Guaranteed by 9am Saturday" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_1000,51,1000,1000,"Special Delivery: Guaranteed by 9am Saturday" +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_2500,1001,2500,2500,"Special Delivery: Guaranteed by 9am Saturday" UK_CONFIRMED_ROYAL_MAIL_SIGNED_FOR_FIRST_CLASS_LETTER,0,50,50,"Signed For: First Class Letter" UK_CONFIRMED_ROYAL_MAIL_SIGNED_FOR_FIRST_CLASS_LARGE_LETTER,0,50,50,"Signed For: First Class Large Letter" UK_CONFIRMED_ROYAL_MAIL_SIGNED_FOR_FIRST_CLASS_SMALL_PARCEL,0,50,50,"Signed For: First Small Parcel" diff --git a/lib/Meanbee/RoyalmailPHPLibrary/data/4_deliveryToPrice.csv b/lib/Meanbee/RoyalmailPHPLibrary/data/4_deliveryToPrice.csv index f8bcef9..33911d2 100644 --- a/lib/Meanbee/RoyalmailPHPLibrary/data/4_deliveryToPrice.csv +++ b/lib/Meanbee/RoyalmailPHPLibrary/data/4_deliveryToPrice.csv @@ -396,36 +396,36 @@ UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_2500,0.001,0.100,24.06,2500, UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_2500,0.101,0.500,26.46,2500, UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_2500,0.501,1.000,28.20,2500, UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_2500,1.001,2.000,32.64,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,0.001,0.100,10.74,500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,0.101,0.500,11.70,500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,0.501,1.000,13.26,500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,1.001,2.000,16.20,500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,2.001,10.000,34.92,500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_500,10.001,20.000,52.44,500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,0.001,0.100,11.94,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,0.101,0.500,12.90,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,0.501,1.000,14.46,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,1.001,2.000,17.40,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,2.001,10.000,36.12,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_1000,10.001,20.000,53.64,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,0.001,0.100,14.34,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,0.101,0.500,15.30,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,0.501,1.000,16.86,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,1.001,2.000,19.80,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,2.001,10.000,38.52,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_1PM_SATURDAY_2500,10.001,20.000,56.04,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_50,0.001,0.100,21.36,50, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_50,0.101,0.500,23.76,50, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_50,0.501,1.000,25.50,50, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_50,1.001,2.000,29.94,50, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_1000,0.001,0.100,23.56,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_1000,0.101,0.500,25.96,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_1000,0.501,1.000,27.70,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_1000,1.001,2.000,32.14,1000, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_2500,0.001,0.100,27.06,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_2500,0.101,0.500,29.46,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_2500,0.501,1.000,31.20,2500, -UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVER_9AM_SATURDAY_2500,1.001,2.000,35.64,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,0.001,0.100,10.74,500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,0.101,0.500,11.70,500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,0.501,1.000,13.26,500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,1.001,2.000,16.20,500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,2.001,10.000,34.92,500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_500,10.001,20.000,52.44,500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,0.001,0.100,11.94,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,0.101,0.500,12.90,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,0.501,1.000,14.46,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,1.001,2.000,17.40,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,2.001,10.000,36.12,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_1000,10.001,20.000,53.64,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,0.001,0.100,14.34,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,0.101,0.500,15.30,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,0.501,1.000,16.86,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,1.001,2.000,19.80,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,2.001,10.000,38.52,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_1PM_SATURDAY_2500,10.001,20.000,56.04,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_50,0.001,0.100,21.36,50, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_50,0.101,0.500,23.76,50, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_50,0.501,1.000,25.50,50, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_50,1.001,2.000,29.94,50, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_1000,0.001,0.100,23.56,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_1000,0.101,0.500,25.96,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_1000,0.501,1.000,27.70,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_1000,1.001,2.000,32.14,1000, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_2500,0.001,0.100,27.06,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_2500,0.101,0.500,29.46,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_2500,0.501,1.000,31.20,2500, +UK_GUARANTEED_ROYAL_MAIL_SPECIAL_DELIVERY_9AM_SATURDAY_2500,1.001,2.000,35.64,2500, UK_CONFIRMED_ROYAL_MAIL_SIGNED_FOR_FIRST_CLASS_LETTER,0.001,0.100,1.73,50, UK_CONFIRMED_ROYAL_MAIL_SIGNED_FOR_FIRST_CLASS_LARGE_LETTER,0.001,0.100,2.05,50, UK_CONFIRMED_ROYAL_MAIL_SIGNED_FOR_FIRST_CLASS_LARGE_LETTER,0.101,0.250,2.36,50, From e4486c94381a3fc2c5ac28d891c7ebee450fe3b8 Mon Sep 17 00:00:00 2001 From: Aaron Rickard Date: Fri, 15 Apr 2016 10:46:05 +0100 Subject: [PATCH 4/4] 62: Update version number to correct release 2.7.6 --- app/code/community/Meanbee/Royalmail/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Meanbee/Royalmail/etc/config.xml b/app/code/community/Meanbee/Royalmail/etc/config.xml index b94b376..776889e 100644 --- a/app/code/community/Meanbee/Royalmail/etc/config.xml +++ b/app/code/community/Meanbee/Royalmail/etc/config.xml @@ -22,7 +22,7 @@ - 2.7.4 + 2.7.6