Cult-Foo

Magento Template Advices Part 2

Tags:

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

$_rate->getMethodDescription()

to

$_rate->getMethodTitle()

in the following templates
/app/design/frontend/PACKAGE/THEME/templates/checkout/cart/shipping.phtml
/app/design/frontend/PACKAGE/THEME/templates/checkout/multishipping/overview.phtml
/app/design/frontend/PACKAGE/THEME/templates/checkout/multishipping/shipping.phtml
/app/design/frontend/PACKAGE/THEME/templates/checkout/onepage/shipping_method/available.phtml
/app/design/frontend/PACKAGE/THEME/templates/paypal/express/review.phtml
/app/design/frontend/PACKAGE/THEME/templates/paypaluk/express/review.phtml

* 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
change

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

to

<?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>
</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" />
</div>
<script type="text/javascript">
Event.observe(window, 'load', function() {
product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out');
});
</script>

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:

.product-img-box
.main-product-img
Managed WordPress Hosting

Did you like it? Help us spread the word!

Do you have something to say?