Change shipping address dropdown to div in Magento

If you want to change shipping address dropdown to div structure.
After a long research i found that this select box is comming form core php file and it's hard to make any change in core file. So we have to change in shipping.phtml file as following. Step 1 : Open shipping.phtml you can find it :- /app/design/frontend/package/yourtheme/template/checkout/onepage/shipping.phtml Please find this code around line no 30.
  • <?php echo $this->getAddressesHtmlSelect('shipping') ?>

  • Step 2 : Now replplace our custom code inside "li"
    
    
      
    
    <?php $customerId = Mage::getSingleton('customer/session')->getCustomer();?> <?php $customer = Mage::getModel('customer/customer')->load($customerId->getId()); ?> <?php $data = array();?> <?php $i=0; foreach ($customer->getAddresses() as $address):?> <?php $data = $address->toArray();?> <?php $i++; endforeach; ?>
  • <?php echo $this->__('Click to Add new address') ?>
  • Step 3 :Now Add our javaScript/Jquery in the bottom of the file.
     
      
    
    Enjoy coding!!

    No comments:

    Post a Comment