GetAddressesHtmlSelect () Edit - Magento

I am trying to edit a function (found in ) to include a "new address" to be displayed first in the Dropppown I created. getAddressesHtmlSelect()

code/core/Mage/Checkout/Block/Onepage/abstract.php

I found a place that needs to be changed, but I cannot figure out how to do it. Can anyone please help? This code:

$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);

        $select->addOption('', Mage::helper('checkout')->__('New Address'));

        return $select->getHtml();

      

+3


source to share


1 answer


Have a look at rewriting magento blocks.
You need to rewrite Mage_Checkout_Block_Onepage_Billing

and Mage_Checkout_Block_Onepage_Shipping


Just rewrite these blocks in your custom module and define new logic for getAddressesHtmlSelect Function

To set the "New Address" as default: A compiled working sample for you.



array_unshift($options, array('value' => '', 'label'=> Mage::helper('checkout')->__('New Address')));
            $select = $this->getLayout()->createBlock('core/html_select')
                ->setName($type.'_address_id')
                ->setId($type.'-address-select')
                ->setClass('address-select')
                ->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
                ->setOptions($options);

            return $select->getHtml();

      

+5


source







All Articles