Public Member Functions | |
collectRates (Mage_Shipping_Model_Rate_Request $request) | |
getAllowedMethods () | |
Protected Member Functions | |
_updateFreeMethodQuote ($request) | |
Protected Attributes | |
$_code = 'freeshipping' |
Definition at line 35 of file Freeshipping.php.
_updateFreeMethodQuote | ( | $ | request | ) | [protected] |
Allows free shipping when all product items have free shipping (promotions etc.)
Mage_Shipping_Model_Rate_Request | $request |
Reimplemented from Mage_Shipping_Model_Carrier_Abstract.
Definition at line 87 of file Freeshipping.php.
00088 { 00089 $freeShipping = false; 00090 $items = $request->getAllItems(); 00091 $c = count($items); 00092 for ($i = 0; $i < $c; $i++) { 00093 if ($items[$i]->getProduct() instanceof Mage_Catalog_Model_Product) { 00094 if ($items[$i]->getFreeShipping()) { 00095 $freeShipping = true; 00096 } else { 00097 return; 00098 } 00099 } 00100 } 00101 if ($freeShipping) { 00102 $request->setFreeShipping(true); 00103 } 00104 }
collectRates | ( | Mage_Shipping_Model_Rate_Request $ | request | ) |
FreeShipping Rates Collector
Mage_Shipping_Model_Rate_Request | $request |
Reimplemented from Mage_Shipping_Model_Carrier_Abstract.
Definition at line 48 of file Freeshipping.php.
00049 { 00050 if (!$this->getConfigFlag('active')) { 00051 return false; 00052 } 00053 00054 $result = Mage::getModel('shipping/rate_result'); 00055 // $packageValue = $request->getBaseCurrency()->convert($request->getPackageValueWithDiscount(), $request->getPackageCurrency()); 00056 $packageValue = $request->getPackageValueWithDiscount(); 00057 00058 $this->_updateFreeMethodQuote($request); 00059 00060 $allow = ($request->getFreeShipping()) 00061 || ($packageValue >= $this->getConfigData('free_shipping_subtotal')); 00062 00063 if ($allow) { 00064 $method = Mage::getModel('shipping/rate_result_method'); 00065 00066 $method->setCarrier('freeshipping'); 00067 $method->setCarrierTitle($this->getConfigData('title')); 00068 00069 $method->setMethod('freeshipping'); 00070 $method->setMethodTitle($this->getConfigData('name')); 00071 00072 $method->setPrice('0.00'); 00073 $method->setCost('0.00'); 00074 00075 $result->append($method); 00076 } 00077 00078 return $result; 00079 }
getAllowedMethods | ( | ) |
Get allowed shipping methods
Implements Mage_Shipping_Model_Carrier_Interface.
Definition at line 106 of file Freeshipping.php.
00107 { 00108 return array('freeshipping'=>$this->getConfigData('name')); 00109 }
$_code = 'freeshipping' [protected] |
Reimplemented from Mage_Shipping_Model_Carrier_Abstract.
Definition at line 40 of file Freeshipping.php.