Public Member Functions | |
__construct () | |
getAddress () | |
getShippingRates () | |
getCarrierName ($carrierCode) | |
getShippingMethod () | |
isMethodActive ($code) | |
getActiveMethodRate () | |
getIsRateRequest () | |
getShippingPrice ($price, $flag) | |
Protected Attributes | |
$_rates |
Definition at line 34 of file Form.php.
__construct | ( | ) |
Constructor
By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes
Reimplemented from Varien_Object.
Definition at line 38 of file Form.php.
00039 { 00040 parent::__construct(); 00041 $this->setId('sales_order_create_shipping_method_form'); 00042 }
getActiveMethodRate | ( | ) |
Retrieve rate of active shipping method
Definition at line 119 of file Form.php.
00120 { 00121 $rates = $this->getShippingRates(); 00122 if (is_array($rates)) { 00123 foreach ($rates as $group) { 00124 foreach ($group as $code => $rate) { 00125 if ($rate->getCode() == $this->getShippingMethod()) { 00126 return $rate; 00127 } 00128 } 00129 } 00130 } 00131 return false; 00132 }
getAddress | ( | ) |
Retrieve quote shipping address model
Definition at line 49 of file Form.php.
00050 { 00051 return $this->getQuote()->getShippingAddress(); 00052 }
getCarrierName | ( | $ | carrierCode | ) |
Rertrieve carrier name from store configuration
string | $carrierCode |
Definition at line 85 of file Form.php.
00086 { 00087 if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title', $this->getStore()->getId())) { 00088 return $name; 00089 } 00090 return $carrierCode; 00091 }
getIsRateRequest | ( | ) |
Definition at line 134 of file Form.php.
00135 { 00136 return $this->getRequest()->getParam('collect_shipping_rates'); 00137 }
getShippingMethod | ( | ) |
Retrieve current selected shipping method
Definition at line 98 of file Form.php.
00099 { 00100 return $this->getAddress()->getShippingMethod(); 00101 }
getShippingPrice | ( | $ | price, | |
$ | flag | |||
) |
Definition at line 139 of file Form.php.
00140 { 00141 return $this->getQuote()->getStore()->convertPrice(Mage::helper('tax')->getShippingPrice($price, $flag, $this->getAddress()), true); 00142 }
getShippingRates | ( | ) |
Retrieve array of shipping rates groups
Definition at line 59 of file Form.php.
00060 { 00061 if (empty($this->_rates)) { 00062 $groups = $this->getAddress()->getGroupedAllShippingRates(); 00063 /* 00064 if (!empty($groups)) { 00065 00066 $ratesFilter = new Varien_Filter_Object_Grid(); 00067 $ratesFilter->addFilter($this->getStore()->getPriceFilter(), 'price'); 00068 00069 foreach ($groups as $code => $groupItems) { 00070 $groups[$code] = $ratesFilter->filter($groupItems); 00071 } 00072 } 00073 */ 00074 return $this->_rates = $groups; 00075 } 00076 return $this->_rates; 00077 }
isMethodActive | ( | $ | code | ) |
Check activity of method by code
string | $code |
Definition at line 109 of file Form.php.
00110 { 00111 return $code===$this->getShippingMethod(); 00112 }