Join over 10,000 ecommerce enthusiasts who receive free updates
Get email updates
Build A "Smarter"
Magento Store
Magik Extra Fees Create unlimited number & types of extra fees and charges to drive increased revenue per order.
$199  $99

Most popular posts

5 Quick Magento Tips You Wish You Knew Earlier

 

Customize a Magento Store.

If you are looking to customize your Magento store or theme, a majority of times you ought to do very specific tasks. I am listing few of them below. I hope you will love this series and will find out most common solutions to most common Magento tasks.

How to display category title only on sub category page in Magento Template?

To display category title only on sub category page in Magento template go to app/design/frontend/default/Your_Theme/template/catalog/category/view.phtml and find the following line of code

1
<h1 class="page-title1"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>

simply replace the above line with the following piece of code

1
2
3
4
5
<?php if($_category->getLevel() > 2): //current category is not a parent-category ?>
<div class="category-title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></div>
<?php else: //this is a parent category page ?>
//do nothing
<?php endif; ?>
 

How to show 4 products instead of 3 products in a row on Listing Page in a Magento Theme?

To show 4 products instead of 3 on listing page in Magento Theme you need to edit app/design/frontend/default/Your_Theme/template/catalog/product/list.phtml file and add the following line

1
$this->setData('column_count',4);

after this piece of code

1
2
3
4
<?php
 $_productCollection=$this->getLoadedProductCollection();
 $_helper = $this->helper('catalog/output');
?>

Eventually it should look something like this

1
2
3
4
5
<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
    $this->setData('column_count',4);
?>
 

How to show currency selector in right sidebar in a Magento template?

To show currency selector in right sidebar you need to edit app/design/frontend/default/Your_Theme/layout/directory.xml. Just edit in catalog_category_default, change the reference name from left to right like this

1
2
3
4
5
  <catalog_category_default>
        <reference name="right">
            <block type="directory/currency" name="currency" before="catalog.leftnav" template="directory/currency.phtml"/>
        </reference>
  </catalog_category_default>
 

How to check if current page is homepage in Magento Template?

Using the following code you can check if current page is homepage or not in Magento template.

1
2
3
4
5
6
7
8
if($this->getIsHomePage())
{
    echo "You are on Homepage";
}
else
{
    echo "You are not on Homepage";
}
 

How to retrieve the base Url path in Magento?

This is extremely easy just call this to get the Magento Base URL

1
<?php echo Mage::getBaseUrl(); ?>

We would love to hear your questions, comment on these quick tips. Please leave us a comment and let us know.

 
Enjoyed this Post?
Then you can follow us here:

Subscribe to RSS
Follow us on Twitter
Follow us on Facebook

Ashish Nayyar

Chief Product Officer & Architect. MagikCommerce.com

Build A "Smarter" Magento Store
Magik Extra Fees Magik Extra Fees is the #1 extention for creating unlimited number & types of extra fees and charges to drive increased revenue per order.
  • Extra Fee for Products
  • Extra Fee for Categories
  • Extra Fee for Shipping
  • Multiple Additional Charges
$199  $99