1/12/2011

How to generate google sitemap.xml manually in magento

To generate Sitemap.xml in magneto ,Login to your admin panel of your site. Then goto Catalog -> Google Sitemap. Click on Add sitemap then give sitemap.xml in the field of Filename then in the field of Path give your path foldername ( If you wish to save the sitempa.xml in your root folder then use " / " sign). Then click on Save&Generate button to generate your sitemp.xml . then type www.yoursite.com/sitemap.xml to see your sitemap(If you have not use any folder).Submit this sitemap to Google or Bing to see your site in search engines.

1/06/2011

how to remove .html from category and product url in magento

By Default magento's all category url and product url comes with .html extension.If you want to remove the .html extension from all category url and product url, then Follow the below step.

Login to your magento admin panel then Go to System->Config ->Catalog. From Search Engine Optimizations tab delete ".html" from Product URL Suffix and Category URL Suffix, and save config. Now goto System->Index Management and Reindex All data. Now clear your cache. You can see that all .html has been removed.

1/05/2011

How to get sub category list of a particular category in magento

To get all subcategory list under a particular category you need to know the category id of that particular id, then you can get the subcategory .In the below example I have taken My category id is 69.

<?php
$category = Mage::getModel('catalog/category')->getCategories(69);
foreach($category as $_category){
$currentCat = Mage::getModel('catalog/category')->load($_category->getId());
?>
<li><a href="<?php echo $currentCat->getUrl()?>"><?php echo $currentCat->getName();?></a></li>
<?php
}
?>

How to get all Sub-category list by a main category Id in magento

How to see all category and subcategory menu in Magento

By default there is a top.phtml file in magento which show all category and subcategory .To modify menu display style it needs to modify in core file whcih will create problem to Update magento in future,So without touching the core file we can access all category and subcategory in magento.
For that we will write the code in top.phtml file

<?php foreach ($this->getStoreCategories() as $_category): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"><?php echo $this->htmlEscape($_category->getName()) ?></a>
<?php
$_catid=$_category->getId();
$category = Mage::getModel('catalog/category')->load($_catid);
$subcategory = $category->getAllChildren(true);
array_shift($subcategory);
if($subcategory!=null)
{?>
<ul>
<?php
foreach ($subcategory as $sub)
{
$sub1 = Mage::getModel('catalog/category')->load( $sub);
?>
<li><a href="<?php echo $sub1->getUrl();?>"><span>
<?php echo $sub1->getName(); ?>
</span></a></li>
<?php } ?>

</ul>
<?php }?>

</li>
<?php endforeach ?>

1/03/2011

How to get Current currency code or symbol in magento

To get Current currecy code in magento, write the following code.

<?php echo $current_currency_code = Mage::app()->getStore()->getCurrentCurrencyCode(); ?>

To get Current currecy symbol in magento , write the following code.

<?php echo $current_currency_symbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();?>