diff --git a/app/code/community/Meanbee/Royalmail/Helper/Data.php b/app/code/community/Meanbee/Royalmail/Helper/Data.php index 7cde7fe..e4cb8c7 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; + $weight *= 0.45359237; 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); 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 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,