/** * Render address * * @param Mage_Customer_Model_Address_Abstract $address * @return string */ public function render(Mage_Customer_Model_Address_Abstract $address, $format = null) { $address->getRegion(); $address->getCountry(); $address->explodeStreetAddress(); $formater = new Varien_Filter_Template(); $data = $address->getData(); if ($this->getType()->getHtmlEscape()) { foreach ($data as $key => $value) { if (is_object($value)) { unset($data[$key]); } else { $data[$key] = $this->htmlEscape($value); } } } /** * Remove data that mustn't show */ if (!$this->helper('customer/address')->canShowConfig('prefix_show')) { unset($data['prefix']); } if (!$this->helper('customer/address')->canShowConfig('middlename_show')) { unset($data['middlename']); } if (!$this->helper('customer/address')->canShowConfig('suffix_show')) { unset($data['suffix']); } $formater->setVariables(array_merge($data, array('country' => $address->getCountryModel()->getName()))); $format = !is_null($format) ? $format : $this->getFormat($address); return $formater->filter($format); }
/** * Render address * * @param Mage_Customer_Model_Address_Abstract $address * @return string */ public function render(Mage_Customer_Model_Address_Abstract $address) { $format = $this->getType()->getDefaultFormat(); $countryFormat = $address->getCountryModel()->getFormat($this->getType()->getCode()); $address->getRegion(); $address->getCountry(); $address->explodeStreetAddress(); if ($countryFormat) { $format = $countryFormat->getFormat(); } $formater = new Varien_Filter_Template(); $formater->setVariables(array_merge($address->getData(), array('country' => $address->getCountryModel()->getName()))); return $formater->filter($format); }
/** * Render address * * @param Mage_Customer_Model_Address_Abstract $address * @return string */ public function render(Mage_Customer_Model_Address_Abstract $address, $format = null) { $address->getRegion(); $address->getCountry(); $address->explodeStreetAddress(); $formater = new Varien_Filter_Template(); $data = $address->getData(); if ($this->getType()->getHtmlEscape()) { foreach ($data as $key => $value) { $data[$key] = $this->htmlEscape($value); } } $formater->setVariables(array_merge($data, array('country' => $address->getCountryModel()->getName()))); $format = !is_null($format) ? $format : $this->getFormat($address); return $formater->filter($format); }
/** * Get a JSON representation of the address data. * * @param Mage_Customer_Model_Address_Abstract $address the address to serialize * @return string */ public function getAddressJsonData(Mage_Customer_Model_Address_Abstract $address) { $address->explodeStreetAddress(); return $address->toJson(array('street1', 'street2', 'street3', 'street4', 'city', 'region_id', 'country_id', 'postcode')); }