Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design
Showing posts with label Store admin email address/name. Show all posts
Showing posts with label Store admin email address/name. Show all posts

Magento get store admin email address and name

If you want to get admin email address or store email address that is set in magento backend, you can get as following.

General Contact
/* Name */
Mage::getStoreConfig('trans_email/ident_general/name'); 
/* Email */
Mage::getStoreConfig('trans_email/ident_general/email');

Sales Representative
/* Name */
Mage::getStoreConfig('trans_email/ident_sales/name'); 
/* Email */
Mage::getStoreConfig('trans_email/ident_sales/email');

Customer Support
/* Name */
Mage::getStoreConfig('trans_email/ident_support/name'); 
/* Email */
Mage::getStoreConfig('trans_email/ident_support/email');

Custom Email 1
/* Name */
Mage::getStoreConfig('trans_email/ident_custom1/name'); 
/* Email */
Mage::getStoreConfig('trans_email/ident_custom1/email');

Custom Email 2
/* Name */
Mage::getStoreConfig('trans_email/ident_custom2/name'); 
/* Email */
Mage::getStoreConfig('trans_email/ident_custom2/email');

Change shipping address dropdown to list view at checkout page Magento


shipping address dropdown to list view

Once i need 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 i do not want to make any change in core file. So at last i changed my shipping.phtml file as following.

Magento shipping address dropdown to list view


I have changed in file
/app/design/frontend/default/[My-Theme]/template/checkout/onepage/shipping.phtml

This code is used for getting the html for select box for presaved address.
I added my new code after this.
<?php echo $this->getAddressesHtmlSelect('shipping') ?>

Now, my code looks like this,


<label for="shipping-address-select"><?php echo $this->__('Select a shipping address from your address book or enter a new address.') ?></label>
<div class="input-box" style="display: none;">
<?php echo $this->getAddressesHtmlSelect('shipping') ?>
</div>
        /*New Code start*/   
<div id="custAddress">
<?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();?>
<div id="addresseList">
       <a href="javaScript:void(0);" onclick="setAddress(this.id)" id="<?php echo $i;?>">
       <address> 
          <div id="selected_<?php echo $i;?>" class="selectedImage" style="float: right; margin: -6px; display: none;"><img src="<?php echo $this->getSkinURl()?>images/right.jpg" /></div>
         <?php echo $data['firstname'].' '.$data['lastname'].'<br />';?>
         <?php echo $data['street'].'<br />';?>
         <?php echo $data['city'].','.$data['region'].','.$data['postcode'].'<br />';?>
         <?php $country_name = Mage::app()->getLocale()->getCountryTranslation($data['country_id']);?>
         <?php echo $country_name.'<br />';?>
          <?php echo 'T: '.$data['telephone'];?>
       </address>
    </a>
 </div>
 <?php $i++; endforeach; ?>  
 </div>


<li id="addNewtext"><a href="javaScript:void(0);" onclick="setNewAddress()"><?php echo $this->__('Click to Add new address') ?></a></li>

/*End of New code start*/

I have added javascript and jQuery function in same file at the bottom of the page.

<script type="text/javascript">
function setAddress(obj)
{
    document.getElementById('shipping-address-select').selectedIndex = obj;
    jQuery(".selectedImage").hide();
    jQuery("#selected_"+obj).show();
    jQuery("#shipping-new-address-form").hide();
    jQuery("#addNewtext").show();
}
function setNewAddress()
{
    jQuery("#shipping-address-select").find("option:contains('New Address')").each(function()
    {
     if( jQuery(this).text() == 'New Address' )
     {
        jQuery(this).attr("selected","selected");
        jQuery("#shipping-new-address-form").show();
        jQuery("#addNewtext").hide();
        jQuery(".selectedImage").hide();
      }
    });
}
</script>  


Hit like or leave comment if post help!

 

Copyright @ 2017 HKBlog.