Public Member Functions | |
getTitle () | |
getBackUrl () | |
getSaveUrl () | |
getAddress () | |
getCountryId () | |
getRegionId () | |
getCustomerAddressCount () | |
canSetAsDefaultBilling () | |
canSetAsDefaultShipping () | |
isDefaultBilling () | |
isDefaultShipping () | |
getCustomer () | |
getBackButtonUrl () | |
Protected Member Functions | |
_prepareLayout () | |
Protected Attributes | |
$_address | |
$_countryCollection | |
$_regionCollection |
Definition at line 34 of file Edit.php.
_prepareLayout | ( | ) | [protected] |
Preparing global layout
You can redefine this method in child classes for changin layout
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 40 of file Edit.php.
00041 { 00042 parent::_prepareLayout(); 00043 $this->_address = Mage::getModel('customer/address'); 00044 00045 // Init address object 00046 if ($id = $this->getRequest()->getParam('id')) { 00047 $this->_address->load($id); 00048 if ($this->_address->getCustomerId() != Mage::getSingleton('customer/session')->getCustomerId()) { 00049 $this->_address->setData(array()); 00050 } 00051 } 00052 00053 if ($headBlock = $this->getLayout()->getBlock('head')) { 00054 $headBlock->setTitle($this->getTitle()); 00055 } 00056 if ($postedData = Mage::getSingleton('customer/session')->getAddressFormData(true)) { 00057 $this->_address->setData($postedData); 00058 } 00059 }
canSetAsDefaultBilling | ( | ) |
Definition at line 116 of file Edit.php.
00117 { 00118 if (!$this->getAddress()->getId()) { 00119 return $this->getCustomerAddressCount(); 00120 } 00121 return !$this->isDefaultBilling(); 00122 }
canSetAsDefaultShipping | ( | ) |
Definition at line 124 of file Edit.php.
00125 { 00126 if (!$this->getAddress()->getId()) { 00127 return $this->getCustomerAddressCount(); 00128 } 00129 return !$this->isDefaultShipping();; 00130 }
getAddress | ( | ) |
getBackButtonUrl | ( | ) |
Definition at line 147 of file Edit.php.
00148 {//echo '=>'.$this->getCustomerAddressCount();die(); 00149 if ($this->getCustomerAddressCount()) { 00150 return $this->getUrl('customer/address'); 00151 } else { 00152 return $this->getUrl('customer/account/'); 00153 } 00154 }
getBackUrl | ( | ) |
Definition at line 75 of file Edit.php.
00076 { 00077 if ($this->getData('back_url')) { 00078 return $this->getData('back_url'); 00079 } 00080 00081 if ($this->getCustomerAddressCount()) { 00082 return $this->getUrl('customer/address'); 00083 } else { 00084 return $this->getUrl('customer/account/'); 00085 } 00086 }
getCountryId | ( | ) |
Reimplemented from Mage_Directory_Block_Data.
Definition at line 98 of file Edit.php.
00099 { 00100 if ($countryId = $this->getAddress()->getCountryId()) { 00101 return $countryId; 00102 } 00103 return parent::getCountryId(); 00104 }
getCustomer | ( | ) |
Definition at line 142 of file Edit.php.
00143 { 00144 return Mage::getSingleton('customer/session')->getCustomer(); 00145 }
getCustomerAddressCount | ( | ) |
Definition at line 111 of file Edit.php.
00112 { 00113 return count(Mage::getSingleton('customer/session')->getCustomer()->getAddresses()); 00114 }
getRegionId | ( | ) |
Definition at line 106 of file Edit.php.
00107 { 00108 return $this->getAddress()->getRegionId(); 00109 }
getSaveUrl | ( | ) |
Definition at line 88 of file Edit.php.
00089 { 00090 return Mage::getUrl('customer/address/formPost', array('_secure'=>true, 'id'=>$this->getAddress()->getId())); 00091 }
getTitle | ( | ) |
Definition at line 61 of file Edit.php.
00062 { 00063 if ($title = $this->getData('title')) { 00064 return $title; 00065 } 00066 if ($this->getAddress()->getId()) { 00067 $title = Mage::helper('customer')->__('Edit Address'); 00068 } 00069 else { 00070 $title = Mage::helper('customer')->__('Add New Address'); 00071 } 00072 return $title; 00073 }
isDefaultBilling | ( | ) |
Definition at line 132 of file Edit.php.
00133 { 00134 return $this->getAddress()->getId() && $this->getAddress()->getId()==Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling(); 00135 }
isDefaultShipping | ( | ) |
Definition at line 137 of file Edit.php.
00138 { 00139 return $this->getAddress()->getId() && $this->getAddress()->getId()==Mage::getSingleton('customer/session')->getCustomer()->getDefaultShipping(); 00140 }