public function getAddressesHtmlSelect($type) { if ($this->isCustomerLoggedIn()) { if ('billing' !== $type || false === Mage::helper('quafzi_fixedbillingaddress/data')->isBillingAddressFixed()) { return parent::getAddressesHtmlSelect($type); } if (Mage::helper('quafzi_fixedbillingaddress')->isBillingAddressSelectable()) { $options = array(); foreach ($this->getCustomer()->getAddresses() as $address) { $options[] = array('value' => $address->getId(), 'label' => $address->format('oneline')); } $addressId = $this->getAddress()->getCustomerAddressId(); if (empty($addressId)) { $address = $this->getCustomer()->getPrimaryBillingAddress(); if ($address) { $addressId = $address->getId(); } } $select = $this->getLayout()->createBlock('core/html_select')->setName($type . '_address_id')->setId($type . '-address-select')->setClass('address-select')->setExtraParams('onchange="' . $type . '.newAddress(!this.value)"')->setValue($addressId)->setOptions($options); if (Mage::helper('quafzi_fixedbillingaddress')->isCreateOrModifyAdditionalAddressAllowed()) { $select->addOption('', Mage::helper('checkout')->__('New Address')); } return $select->getHtml(); } else { $selectId = 'billing-address-select'; $js = '<script type="text/javascript">$("' . $selectId . '").parentElement.previousElementSibling.hide()</script>'; return '<input id="' . $selectId . '" type="hidden" value="' . $this->getAddress()->getAddressId() . '">' . $this->_getBillingAddressHtml() . $js; } } return ''; }
public function getAddressesHtmlSelect($type) { if ('billing' !== $type || false === Mage::helper('quafzi_fixedbillingaddress/data')->isAddressFixed()) { return parent::getAddressesHtmlSelect($type); } $selectId = 'billing-address-select'; $js = '<script type="text/javascript">$("' . $selectId . '").parentElement.previousElementSibling.hide()</script>'; return '<input id="' . $selectId . '" type="hidden" value="' . $this->getAddress()->getAddressId() . '">' . $this->_getBillingAddressHtml() . $js; }