Wednesday, June 8, 2011


If any of you work on E-stores, you probably have come across, or developed a store using Magento. Magento is a powerful php e-store, which is flexible, configurable, fairly easy to style and nice to work with. The other thing I really like about Magento is the community. It is rare that you run into an issue in Magento which you can't fix with a quick Google. There are plenty of forums and websites devoted to Magento help. Seeing as how I have now developed a few Magento sites, this time around  decided to document the problems one will typically run into. I have layed some of this out, and with luck, it will help someone out.

Remove Components (hide em)
System > Cofiguration > Advanced and disable ex:  Mage_Newsletter

Change Layout
Open the \app\design\frontend\nameofProj\default\layout\catalog.xml

<block type="page/html" name="root" output="toHtml" template="current Template">
<block type="page/html" name="root" output="toHtml" template="page/2columns-right.phtml">
eg: one-column.phtml

File Locations

Product View Template

Image Maginifcation for product

Varients Code Location

Bottom of product Code Location

Menu for Categories

-simply add list items here with custom links which may not be in the categories by default
<?php echo $_menu ?>
<li id="storeHome" class="level0 nave-1 level-top first parent">
        <a class="level-top" href="/index.php">

Header of Site
/*This is where you can change the logo, modify the top links etc*/

Footer of Site
-comment out <?php echo $this->getCopyright() ?> replace with your own code etc

Grid/List view Code
-This is where you can chane image sizes and which details are shown on the home page

toolbar for pages

page numbers in pagination  - you can change your divider ~line 94

/*change formatting of breadcrumbs*/

Login Page



Shopping Cart


Sub Categories Page

Use JQuery on pages:

<script type="text/javascript" src="/pathTo/jquery.min.js"></script>
<script type="text/javascript">
var $j = jQuery.noConflict(); //alias jquery with j$
$j('button.button span span').html(""); /*can be used to hide span text and fix some bugs if using images*/

Links to Sitemap
/catalog/seo_sitemap/product/ -product sitemap
/catalog/seo_sitemap/category/ -category sitemap

Hide index.php in the store view:
In admin, System>Configuration>Web Tab. Under Search Engine Optimization, change User Webserver rewrites to Yes.

Check if a user is logged in:

if( $this->helper('customer')->isLoggedIn() ){
<li class="level0 nav-cat1"><a href="/customer/account/login/"><span>logout</span></a></li>
<li class="level0 nav-cat1"><a href="/customer/account/login/"><span>login</span></a></li>
<?php } ?>

Display Product Skus: (for product page)
<p class="itemSku">Item #<?php echo $this->htmlEscape($_product->getSku()) ?></p>

Change the number of displayed products in list/grid view:

Admin -> System > Catalog > frontend
and: app/design/frontend/default/default/layout/catalog.xml

Embed Contact form in CMS page:

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

Get the Sub-Category Page to display Images: (replace your

\app\design\frontend\YourPath\default\template\catalog\category\view.phtml with below code)

$_category = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);

$rootcat = $_category->entity_id;
$cat = Mage::getModel('catalog/category')->load($rootcat);
$child = $cat->getChildren();
//echo $child;

$helper = Mage::helper('catalog/category');
$_helper = $this->helper('catalog/output');
<div class="category-custom-products">
<td valign="top" width="405">
<h1 class="page-title"><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
$_imgUrl = $_category->getImageUrl();
echo '<img id="ProductCategoryImage" src="'.$_imgUrl.'"/>';

<td width="40">

<td valign="top">
<div class="products-grid categories-grid">

<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_imgUrl = $cur_category->getImageUrl();
<div class="categoryItem">
<a class="categoryImageLink" href="<?php echo $helper->getCategoryUrl($cat);?>"><?php echo '<img class="categoryImg" width="216" height="180" id="ProductCategoryImage" src="'.$_imgUrl.'"/>'; ?></a>
<a class="categoryProductLink" href="<?php echo $helper->getCategoryUrl($cat);?>"><?php echo $cat->getName();?></a>
<a class="viewDetailsLink" href="<?php echo $helper->getCategoryUrl($cat);?>">view details</a>

<?php endif?>
<?php endforeach;?>
<?php echo $this->getProductListHtml() ?>

Hope this helps someone out. I'll try to add to it if I learn something interesting.

No comments:

Post a Comment