ECommerce Insights Blog

Stay on top of it all and get ahead with useful articles, how-tos, tips and tricks on e-commerce.

10 Magento Customization Tips You Wish You Knew Earlier

Looking for Magento customization tips? Magento is the leading eCommerce platform having more than 140k+ stores running either Magento Enterprise, Professional, Go or Magento Community editions. Magento installation and configuration is a smooth drive but when it comes to customization, tweaks or handling third party extensions things get little messy. Having developed, customized and managed 100+ stores ourselves we know that there are few common tasks, tweaks which many Magento store owners are looking to get customized.

10 Useful Magento Customization Tips

We are listing 10 common Magento problems along with their solution for the community to leverage, these Magento customization tips will help you do the tasks quickly & efficiently.

1. Debugging Magento Store’ Layout

Magento provides powerful logging method known as Mage::log() method in your controller. This powerful method once added to your theme files can log loaded layout handles along with complied layout update string under /var/log/layout.log file. Enabling debug mode for our index.php file is pretty easy, just follow the code given below

public function testAction()
  //following line will log loaded layout handles to "var/log/layout.log" file
  Mage::log($this->getLayout()->getUpdate()->getHandles(), null, 'layout.log');

  //following line will log merged layout to "var/log/layout.log" file
  Mage::log($this->getLayout()->getUpdate()->asString(), null, 'layout.log');

2. Contact Form on Magento CMS page

Who can deny the importance of a contact form in any eCommerce site. Since, this is the primary mean of getting in touch with the customer every Magento store owner needs it working on their store. Creating a contact form using CMS page is a smart move, since it will also enable breadcrumb for better navigation. To add a contact form on a Magento CMS page you have to go to your CMS => Manage Pages. Write the greeting or any message you want to display above contact form and finally add the following line to add the page

{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}

3. Display Category Name on Product Detail Pages

It’s is quite common that Magento store owners want to display the product category name on the product detail page. This is important way of telling customers that where they are and what are they buying. To display product category name on product detail pages in Magento you have to edit catalog/product/view.phtml file. Simply add the following code to show product category name wherever you want within your layout.

getCategoryIds(); ?>
 $_category_id): ?>
   load($_category_id) ?>
   getName() ?>

4. Hide Product Prices If user is not logged in

Suppose you want to hide product prices or want to display tiered prices to logged in customers only you have to edit the following file. Go to app/design/frontend/default/default/template/catalog/product/view/tierprices.phtml. First of all you have to add a single line of code at the top

  isLoggedIn()): ?>

Once the line we have mentioned above is added you can add the following line

   0): ?>

Then add this closing if condition code at the end.


If you requirements are little complex you can anytime use Magento Hide Prices which is a comprehensive extension to hide product prices, add to cart buttons, disabling cart, showing call for prices, or displaying inquiry forms etc.

5. Remove Credit Cart Information From Transactional Emails

If your Magento store is sending credit card information openly in the transaction emails, this is something every Magento store owners would love to hide. Sending someone’s credit card information in an email is highly unsecure. This is how you can remove/hide displaying credit card information from transactional emails

i. Edit app/design/frontend/default/your_theme/template/payment/info/cc.phtml file
ii. Look for the following piece of code in this file

__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) ?>

iii. Comment out the above code so it looks just like we are showing below

__('Credit Card Number: xxxx-%s', $this->htmlEscape($this->getInfo()->getCcLast4())) ?>
__('Expiration Date: %s/%s', $this->htmlEscape($this->getCcExpMonth()), $this->htmlEscape($this->getInfo()->getCcExpYear())) */ ?>

You can either use HTML comments if you like. Save the file and test with one email, hopefully credit card information won’t be there in your email anymore.

6. Add a Language Pack as Store View

All major brands using Magento also use multi lingual store. Creating a new store in using Magento is pretty easy. Follow the steps given below to create a multi lingual store in Magento.

i. First of all you have to download the respective language pack and unzip within your Magento folder. Once unpacked it will create 2 folders.
a. app\design\frontend\default\default\locale
b. app\locale

ii . Now go to Admin => System => Configuration. On the top left corner under Current Configuration Scope drop-down box, you can see Default Config that’s your English language main store view.

iii. Lets say we are adding Spanish store view. Use Manage stores link right under the drop-down box that is System => Manage Stores. Click the Create Store View link on top right, and type the following values in the view information form & click Save.

Store: Main Store
Name: Spanish
Code: spanish
Status: Enabled
Sort order: 0

iv. Finally, go to System => Configuration. Under Current Configuration Scope drop-down box, you now now see Spanish store view, click the link. Under Locale options tab on the left, uncheck use website check-box then change the locale to Spanish and click Save.

Voila! you have your Spanish store ready. Now you can think about how you want the redirection to take place.

7. Adding Facebook Like Widgets on Product Detail Pages

Social media is a good way to promote brand value. Facebook, Twitter, Google+ like buttons helps a lot. To add Facebook Like button on your product pages is easy. Edit app/design/frontend/theme/theme/template/catalog/product/view.phtml file and add the following piece of code in it

8. Hide Empty Cart From Sidebar

Unless the customer adds something to their cart, displaying empty cart in your sidebar is meaningless. If you want to hide the cart in the sidebar all you have to do is follow the steps given below

i . Edit app/design/frontend/default//template/checkout/cart/sidebar.phtml file
ii. Search the following code

iii. Add the following condition just before the opening div tag

$_havingqty = $this->getSummaryCount();
if ($_havingqty > 0):

iv. And finally add the closing if condition

Conceptually it should look something like this

$_havingqty = $this->getSummaryCount();
if ($_havingqty > 0):

.. .. .. .. ..

9. Add custom comment box to each product in Cart

Jignesh has shared a pretty comprehensive post on how to add custom comment box to each products in cart. Ideas is to give your customer a comment box where they can type their instructions, requirements or specifications while ordering.

10. Custom Add to Cart button on CMS pages

Selling products via customized landing pages is not new, marketers do all sorts of efforts and create pages to bring customers. From these CMS pages the customers are given an option to add certain products in their cart. You can add any product to the cart by using the following code on your CMS page

Note that we have given it 2 parameters

a. product_id=3 – You can give the respective id as parameter to this button
b. qty=2 – define the quantity that needs to be added in the cart if the button is clicked.

FYI: We have noticed that on Magento 1.8+ there is an issue causing products not to get added to cart specially if you are behind reverse proxy like varnish or others.

I hope you like these Magento customization tips we have presented. Here are 5 more Magento tips for you. Do you have a tip or a trick to share? Please leave us a comment and share with us.