Magento Template Advices Part 2


Magento Template Advices
Here goes second part of quick tips for magento developers. First part is here

List of Problems:

  1. Admin login problem in local installation
  2. UPS dont show methods titles
  3. Using html tags in product description
  4. How to remove zoom tool

This problem caused by a strict rule from magento development – “Valid Domain/Base URL should be have 1 or 2 dot on it”

Condition to recreate problem:
1. you should be working in localhost .
2. Your domain/base url in localhost doesnt have one or two “dot”

How to fix it
You need to change your local hostname
for example
you have magento installed in localhost – you should rename/add alias to it – like this magento.localhost
This can be done in:
– for windows users C:\WINDOWS\system32\drivers\etc\hosts
– for linux users: look for your system manual

After go to admin section, do not forget to change the 2 base url on “System > Configuration > Web” section.

If you get only prices and do not see methods descriptions like Ground or UPS Next Day Air on checkout page, we are going to you.

You need to change




in the following templates

* note: replace PACKAGE and THEME with your package and theme names respectively.

you can use perl to find/replace it

perl -i -p -e 's/getMethodDescription/getMethodTitle/g' `find | grep .phtml`; 

There are several common problems
1. you use ul / ol lists and it displays wrong
– in this case you need to update css , you can find out what to edit by using firebug/other developer tool

2. using tables and get a lot of empty space
– this is hapen cause of nl2br() function , which convert all newline characters to br
you can solve it by writing html in one line
or edit catalog/product/view/description.phtml

<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($this->getProduct()->getDescription()), 'description') ?> 


<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $this->getProduct()->getDescription(), 'description') ?> 

but in this case you are responsible for newline characters

If you want to remove zoom tool edit app/design/frontend/interface/theme/template/catalog/product/view/media.phtml

Comment out this code:

<div class="image-zoom" id="track_outer">
<img id="zoom_out" src="<?php echo $this-/>getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="< ?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
<div id="track">
<div id="handle"></div>
<img id="zoom_in" src="<?php echo $this-/>getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="< ?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
<script type="text/javascript">
Event.observe(window, 'load', function() {
product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out');

also comment out this line in page.xml

<!--<action method="addJs"><script>scriptaculous/slider.js</script>

That removes the zoom tool and displays the base image, however it will still be constrained to a box based on the CSS styles. You’ll need to adjust your CSS styles in the boxes.css for the following style definitions:

Managed WordPress Hosting

Did you like it? Help us spread the word!

7 Responses to "Magento Template Advices Part 2"

  1. Anna Green says:

    I have been working with Magento today and have experienced nothing but problems! The new update in my opinion should not have been released! There are a lot of changes that are going to make life much easier such built in wsywig controls and much better cache management. But because of the changes non of the old templates are compatible with new magento. If your thinking of taking on Magento for the first time, my advice is don’t bother just yet, give some time, and wait for the bugs to get fixed.

    • Marc says:

      I agree the new version does make things a bit harder. Having just started with Magento, I find most of the documentation is for previous versions. However, I have noticed that if you are experiencing issues with supposedly compatible themes, such as Modern – installing into the ../base/ folder under skin and app rather than ../default/ can make a difference.

      However – this is just what I found out from playing around – don’t take it as gospel!

  2. WebProject | Web Design | Web Development| says:

    Great Post !
    I enjoyed reading it…

  3. Rory says:

    Trying to learn Magento (its a nightmare!) does anyone know of any good starter tutorials, I’m finding it a real struggle?

  4. That are some nice tips. Especially the explaination about the removal of the nl2br() function

  5. Santiago says:

    it is great, thanks you, i need this


Do you have something to say?