Friday 18 May 2012

Magento: Create Category List with Images

Magento: Create Category List with Images

The code to create a list of top-level categories along with their images:
<?php $_categories = $this->getStoreCategories() ?>
<?php $count = 0 ?>
<ul id="square-category">
<?php foreach ($_categories as $_category): ?>

<?php $open = $this->isCategoryActive($_category); ?>
<?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$immagine = $this->getCurrentCategory()->getThumbnail()
?>

<?php $count = $count+1 ?>
    <li class="Pos<?php echo $count ?>">
        <a href="<?php echo $this->getCategoryUrl($_category) ?>" title="<?php echo $this->htmlEscape($_category->getName()) ?>">
            <img src="/media/catalog/category/<?php echo "$immagine" ?>" alt="<?php echo $this->htmlEscape($_category->getName()) ?>" class="category-img" />
            <span><?php echo $this->htmlEscape($_category->getName()) ?></span>
        </a>
    </li>
<?php endforeach; ?>
</ul>

Magento: Customise the contact form

Magento: Customise the contact form

This is very useful information if you want to modify the magento contact form.

There are several aspects that need to be modified, these include:
  • the .phtml file.
  • the .xml if you want to add extra textual content to the contact page.
  • the email template using the transactional emails in the CMS.
  • adjust the contact form settings in the CMS to use your new template.
Click the link below if you want a more detailed article.

click here for the original website

Thursday 17 May 2012

Magento: Add phtml file to template

Magento: Add phtml file to template

Use this bit of code:
<block type="core/template" name="footerMenu" template="page/footermenu.phtml"/>
in your XML file.
Then this in your template file if you want to place it:
<?php echo $this->getChildHtml('footerMenu') ?>

Magento: Simple Footer Menu

Magento: Simple Footer Menu

Here is the code that I've used to create the simple text links in the footer.
<?php $helper = $this->helper('catalog/category'); ?>
<?php foreach ($helper->getStoreCategories() as $_category): ?>
    <a href="<?php echo $helper->getCategoryUrl($_category); ?>"><?php echo $this->htmlEscape($_category->getName()); ?></a> |
<?php endforeach ?>

click here for the original website where I grabbed the first part of the code.
click here for the original website that I used to modify the code.