Wednesday, 25 September 2013

Show category name in breadcrumb in magento

Show category name in breadcrumb in magento when click on home page product

Just add the below code in top of the breadcrumbs.phtml page :-

<?php
if ($product = Mage::registry('current_product')) {
    $categories = $product->getCategoryCollection()->load();

    if($categories) {
        foreach ($categories as $category)
        {
            if($category) {
            $category = Mage::getModel('catalog/category')->load($category->getId());
            break;
            }
        }
    }
    $lastCrumbName = $product->getName();
    $lastCategoryAdjust = 0;
   
}
else {
    if($category = Mage::registry('current_category')) {
    $lastCrumbName = $category->getName();
    }
    $lastCategoryAdjust = 1;
}

if($category) {
    if($path = $category->getPath()) {
        $path = explode('/', $path);
        $crumbs = array('home' => array('label' => 'Home',
        'title' => 'Home',
        'link' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB),
        'first' => true,
        'last' => false
        ));
        for($i = 2; $i < count($path) - $lastCategoryAdjust; $i++) {
            $cur_category = Mage::getModel('catalog/category')->load($path[$i]);
            if($cur_category && $cur_category->getIsActive()) {
                $crumbs['category' . $path[$i]] = array('label' => $cur_category->getName(),
                'title' => $cur_category->getName(),
                'link' => $cur_category->getUrl(),
                'first' => false,
                'last' => false
                );
            }
        }
          $crumbs['current'] = array('label' => $lastCrumbName,
        'title' => '',
        'link' => '',
        'first' => false,
        'last' => true
        );
    }
}

?>

You are done!!!!!

How to get category id from product id in magento

How to get category id from product id in magento

<?php
$product = Mage::getModel('catalog/product')->load(6);

$cats = $product->getCategoryIds();
foreach ($cats as $category_id) {
    $_cat = Mage::getModel('catalog/category')->load($category_id) ;
    echo $_cat->getName();
}
?>

Thursday, 19 September 2013

Extension Key for installed the usefull extenion in magento


Extension Key:-
http://connect20.magentocommerce.com/community/Mage_Productlist
http://connect20.magentocommerce.com/community/Crius_SkipStep1
http://connect20.magentocommerce.com/community/magento_easy_tabs
http://connect20.magentocommerce.com/community/Facebook_LikeBox
http://connect20.magentocommerce.com/community/Custom_Layered_Navigation
http://connect20.magentocommerce.com/community/AjaxCart
http://connect20.magentocommerce.com/community/EM_Quickshop
http://connect20.magentocommerce.com/community/Squirreltechnologies_Squeeqly
http://connect20.magentocommerce.com/community/easy_exploded_menu
http://connect20.magentocommerce.com/community/AGCloudRolloverToZoom