Public Member Functions | |
setMethodFormTemplate ($method='', $template='') | |
getMethods () | |
getSelectedMethodCode () | |
Protected Member Functions | |
_prepareLayout () | |
_canUseMethod ($method) | |
_assignMethod ($method) |
Definition at line 34 of file Container.php.
_assignMethod | ( | $ | method | ) | [protected] |
Check and prepare payment method model
Redeclare this method in child classes for declaring method info instance
Definition at line 84 of file Container.php.
00085 { 00086 $method->setInfoInstance($this->getQuote()->getPayment()); 00087 return $this; 00088 }
_canUseMethod | ( | $ | method | ) | [protected] |
Checking for min/max order total for assigned payment method
Reimplemented in Mage_Adminhtml_Block_Sales_Order_Create_Billing_Method_Form, Mage_Checkout_Block_Multishipping_Billing, and Mage_Checkout_Block_Onepage_Payment_Methods.
Definition at line 54 of file Container.php.
00055 { 00056 if (!$method->canUseForCountry($this->getQuote()->getBillingAddress()->getCountry())) { 00057 return false; 00058 } 00059 00060 if (!$method->canUseForCurrency(Mage::app()->getStore()->getBaseCurrencyCode())) { 00061 return false; 00062 } 00063 00064 /** 00065 * Checking for min/max order total for assigned payment method 00066 */ 00067 $total = $this->getQuote()->getBaseGrandTotal(); 00068 $minTotal = $method->getConfigData('min_order_total'); 00069 $maxTotal = $method->getConfigData('max_order_total'); 00070 00071 if((!empty($minTotal) && ($total < $minTotal)) || (!empty($maxTotal) && ($total > $maxTotal))) { 00072 return false; 00073 } 00074 return true; 00075 }
_prepareLayout | ( | ) | [protected] |
Prepare children blocks
Create child blocks for payment methods forms
Reimplemented from Mage_Core_Block_Abstract.
Reimplemented in Mage_Checkout_Block_Multishipping_Billing.
Definition at line 39 of file Container.php.
00040 { 00041 /** 00042 * Create child blocks for payment methods forms 00043 */ 00044 foreach ($this->getMethods() as $method) { 00045 $this->setChild( 00046 'payment.method.'.$method->getCode(), 00047 $this->helper('payment')->getMethodFormBlock($method) 00048 ); 00049 } 00050 00051 return parent::_prepareLayout(); 00052 }
getMethods | ( | ) |
Retrieve availale payment methods
Definition at line 112 of file Container.php.
00113 { 00114 $methods = $this->getData('methods'); 00115 if (is_null($methods)) { 00116 $store = $this->getQuote() ? $this->getQuote()->getStoreId() : null; 00117 $methods = $this->helper('payment')->getStoreMethods($store, $this->getQuote()); 00118 foreach ($methods as $key => $method) { 00119 if ($this->_canUseMethod($method)) { 00120 $this->_assignMethod($method); 00121 } 00122 else { 00123 unset($methods[$key]); 00124 } 00125 } 00126 $this->setData('methods', $methods); 00127 } 00128 return $methods; 00129 }
getSelectedMethodCode | ( | ) |
Retrieve code of current payment method
Reimplemented in Mage_Adminhtml_Block_Sales_Order_Create_Billing_Method_Form, Mage_Checkout_Block_Multishipping_Billing, and Mage_Checkout_Block_Onepage_Payment_Methods.
Definition at line 136 of file Container.php.
00137 { 00138 $methods = $this->getMethods(); 00139 if (!empty($methods)) { 00140 reset($methods); 00141 return current($methods)->getCode(); 00142 } 00143 return false; 00144 }
setMethodFormTemplate | ( | $ | method = '' , |
|
$ | template = '' | |||
) |
Declare template for payment method form block
string | $method | |
string | $template |
Definition at line 97 of file Container.php.
00098 { 00099 if (!empty($method) && !empty($template)) { 00100 if ($block = $this->getChild('payment.method.'.$method)) { 00101 $block->setTemplate($template); 00102 } 00103 } 00104 return $this; 00105 }