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

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

How to add or enable currency switcher in header Magento

If you want to enable currency switcher in your header than follow this easy step.

Currency switcher Magento

Step 1: Admin setting
You might have noticed the ”Currency Setup” tab in Magento’s Administration under “System->Configuration” menu. There you should select default site currency, and besides that, all currencies you want to support.

Magento Currency switcher

After that, you should go to “System->Manage Currency Rates” and set rates for currencies you’ve chosen before. You can use Webservicex to import currency rates from Webservicex service. Here’s how it looks like:

Magento Currency switcher

Step 2: Open /app/design/frontend/default/[YOUR THEME]/layout/page.xml
Add this line of code
<block type="directory/currency" name="currency" template="directory/currency.phtml"/>
After
<block type="page/html_header" name="header" as="header">

Step 3: Open /app/design/frontend/default/[YOUR THEME]/template/page/html/header.phtml
Add
<?php echo $this->getChildHtml('currency') ?>
After
<?php echo $this->getChildHtml('store_language') ?>

Magento: Add product/item attributes in order and invoice emails

I will show you how to add extra product attribute values, along with order item options and custom options in order emails and invoice emails.
Here is the code that should work for order and invoice emails to get additional PRODUCT ATTRIBUTES displayed:
For adding Product attributes to ORDER emails, you need to change in:
app/design/frontend/base/default/template/email/order/items/order/default.phtml

For adding Product attributes to INVOICE emails, you need to change in:
app/design/frontend/base/default/template/email/order/items/invoice/default.phtml


$productId = $_item->getProduct()->getId(); //for order emails
//$productId = $_item->getProductId(); //for invoice emails
$product = Mage::getModel('catalog/product')->load($productId);
$attributes = $product->getAttributes();

//Get a list of all PRODUCT ATTRIBUTES you want to show in this array...
$dispAttribs = array('attribute1', 'attribute2', 'attribute3');

foreach ($attributes as $attribute) {   
        $attributeCode = $attribute->getAttributeCode();
        if(!in_array($attributeCode, $dispAttribs)) continue;
        $label = $attribute->getFrontend()->getLabel($product);
        $value = $attribute->getFrontend()->getValue($product);
        echo "<strong>" . $label . ":</strong> " . $value;
}
or if you want to add only one attribute value like dropdown
$_prod = Mage::getModel('catalog/product')->loadByAttribute('sku',$this->getSku($_item));
echo $attribute_value = $_prod->getAttributeText('attribute_code');

For displaying CUSTOM OPTIONS and/or ITEM OPTIONS from the item, use this:
foreach($this->getItemOptions() as $opt) {
    if(isset($opt['option_id'])) { 
            //for CUSTOM OPTIONS
            echo "" . $opt['label'] . ": ". $opt['option_value'] . "";
    } else { 
            //for ITEM OPTIONS
            echo "" . $opt['label'] . ": ". $opt['value'] . "";
    }
}

 

Copyright @ 2017 HKBlog.