How to display best selling products in magento

1. Create a new file for Block:

 * Catalog Product Bestseller Block
 * @author Amasty Team
class Mage_Catalog_Block_Product_Bestseller extends Mage_Catalog_Block_Product_Abstract
    public function getCollection()
        $storeId = Mage::app()->getStore()->getId();
        $collection = Mage::getResourceModel('reports/product_collection')
            ->setOrder('ordered_qty', 'desc');
        if (Mage::helper('catalog/product_flat')->isEnabled()) {
                ->joinInner(array('e2' => 'catalog_product_flat_' . $storeId), 'e2.entity_id = e.entity_id');
        } else {
                ->addAttributeToSelect(array('name', 'price', 'small_image'));
        if ($categoryId = $this->getCategory()) {
            $category = Mage::getModel('catalog/category')->load($categoryId);
        $collection->setPage(1, $this->getLimit());
        return $collection;

2. Create a template file 

 * Bestseller Products block template
 * @see Mage_Catalog_Block_Product_Bestseller
<div class="block block-list block-viewed">
    <div class="block-title">
        <strong><span><?php echo $this->__($this->getHeader()) ?></span></strong>
    <div class="block-content">
        <?php $products = $this->getCollection(); ?>
        <?php if (0 < $products->getSize()) { ?>
            <table class="bestseller-table">
                    <?php foreach ($products as $p) { ?>
                        <td style="padding: 15px 15px 0px 15px;">
                            <a href="<?php echo $p->getProductUrl() ?>" title="<?php echo $this->htmlEscape($p->getName()) ?>" class="product-image">
                                <img src="<?php echo $this->helper('catalog/image')->init($p, 'small_image')->resize(125) ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($p->getName()) ?>" />
                            <h3 class="product-name">
                                <a href="<?php echo $p->getProductUrl() ?>" title="<?php echo $this->htmlEscape($p->getName())?>">
                                    <?php echo $this->htmlEscape($p->getName()) ?>
                            <?php echo $this->getPriceHtml($p, true) ?>
                    <?php } ?>
                    <?php foreach ($products as $p) { ?>
                    <td style="padding: 0px 15px 15px;">
                        <?php if($p->isSaleable()): ?>
                            <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($p) ?>')">
                                <span><span><?php echo $this->__('Add to Cart') ?></span></span>
                        <?php else: ?>
                            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                        <?php endif; ?>
                    <?php } ?>
        <?php } ?>

3. Now you need to call the created block, to do that go to Backend > CMS > Pages > Edit Page ‘Home page’ and add the following lines of code:

{{block type="catalog/product_bestseller" template="catalog/product/bestseller.phtml" header="Bestsellers" limit=4}}

4. You need to create a permission for this block:
   Backend – > System – > Permissions – > Blocks – > 'Add New Block' button

Image upload error

|| Magento 1.9.2 and php7 – image upload error:
check console: Uncaught Error: Function name must be a string in




Installation Problem:

|| Fatal error: Uncaught Error: Function name must be a string in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout.php:555

$out .= $this->getBlock($callback[0])->$callback[1]();


$out .= $this->getBlock($callback[0])->{$callback[1]}();

|| Maximum execution time of 30 seconds exceeded in magento installation.

/* solve */
go to xampp/php/php.ini and search by 

max_execution_time=30  replace to 600
max_input_time=60      replace to 600
memory_limit=128M      replace to 1000m

|| PHP extension soap must be loaded

I edited php.ini and removed the leading semicolon ( ; ) from extension=php_soap.dll.
After restarting Apache I was able to proceed with the installation without any other issues.

Upgrade magento from 1.7 to latest

1st way to upgrade :

Use the Magento Connect method:
Within each Magento installation, you can easily upgrade Magento via Magento Connect. The steps to upgrade via Magento Connect include:

  • Login to the Magento admin
  • Move to system- Magento Connect- Connect manager
  • Login to Magento Connect
  • Click on ‘check for upgrades’
  • Upgrade ‘Mage _All_Latest’. This will upgrade Magento.

2nd way to upgrade:

  1. Take a backup of current database and current 1.7 code. place maintenance.flag file inside 1.7 code folder to put website offline.
  2. Download latest magento from the
  3. Remove all folders and files from your 1.7 code except maintenance.flag (but you should have backup somewhere) and place all folders and files from the 1.9.
  4. Now from your 1.7 merge your following custom folders into the 1.9
    • Community app/code/community
    • Local app/code/local
    • Media
    • your theme or package (app/design/frontend/default/<your theme> or app/design/frontend/<your package>)
    • custom folders from Skin (both for adminhtml and frontend).
    • copy your custom xml files from app/etc/modules/ to current app/etc/modules/
    • any custom admin theme folder from adminhtml/default/yourtheme.
    • copy your custom folders from adminhtml/default/default/ (1.7) to adminhtml/default/default/ (1.9).
    • custom js files if any from app/js/.
  5. Now go to app/etc/local.xml.Edit database details their.put your database username and password and database name.
  6. Remove maintenance.flag file and check the site in the browser. it is done.

Magento mysql dump file

Importing phpMyAdmin Database Dump File

When importing a MySQL dump file that’s been generated using phpMyAdmin, you need to put the following at the beginning of the file:


And the following at the end of the file:


PHP extension is missing

|| New version magento 2 PHP Extension intl is missing   
1. Go to the file php.ini 
2. Search for ;extension=php_intl.dll
3. Remove semicolon and restart server. It will work.

|| Magento 1.4v-1.9.1 version 
1. Go to the file php.ini 
2. Search for ;extension=php_curl.dll
3. Remove semicolon and restart server. It will work.

Magento Code

|| How to remove the thousand separator in price
   Go to the folder lib/Zend/Local/Data/en.xml and Search <group> tag.
   Just do <group> </group> thousand separator as space, then cash clear

|| How To Remove Decimal format from price ?
   go to app/code/core/Mage/Directory/Model/Currency.php and change format function:

   public function format($price,$options=array(),$includeContainer = true,$addBrackets = false){   
      return $this->formatPrecision( $price,0,$options,$includeContainer,$addBrackets);

|| Recently viewed product

||  How to show out of stock in the product listing page
    1. First go to app/code/core/Mage/catelog/Block/product/list.php
    2. then find the function _getProductCollection()
    3. then find the following line

    $this->_productCollection = $layer->getProductCollection();
    modified this line, this following way
    $this->_productCollection = $layer->getProductCollection()->joinField('inventory_in_stock', 'cataloginventory_stock_item', 'is_in_stock', 'product_id=entity_id','is_in_stock>=0', 'left')->setOrder('inventory_in_stock','desc');

||  placing upsells in the product view page
     <block type="catalog/product_list_upsell" name="" as="upsell_products" template="catalog/product/list/upsell.phtml">
          <action method="setColumnCount"><columns>5</columns></action>
          <action method="setItemLimit"><type>upsell</type><limit>5</limit></action>
     view page: <?php echo $this->getChildHtml('upsell_products'); ?>

||  page-title category-title
    catalog > category > view.phtml

||  get product price
    <div class="product_price">  
         <?php $_productCollection=$this->getLoadedProductCollection();
         $productBlock = $this->getLayout()->createBlock('catalog/product_price');
         echo $productBlock->getPriceHtml($_product); ?>

||  Configuring numbres of products displayed on the mini cart:
    System > Configuration > under Sales > Checkout > Shopping Cart Sidebar

||  How to enable/disable the demo store notice in Magento.
    System tab > Configuration > Design >  HTML Head > Display Demo Store Notice.
    notice text: page > html > notice.phtml

||  Proceed to Checkout

||  Header Top links 

||  To understand new order id:
    go > db Look in "eav_entity_store" and find increment_last_id.
    Change "increment prefix" to a name that could understood for new order id.

||  sales order view All Status in Admin Panel for Comments History:
    go to design/adminhtml/def/def/template/sales/oreder/view/history.phtml

    Replace :	
    <?php foreach ($this->getStatuses() as $_code=>$_label): ?>
    To :
    <?php foreach (Mage::getSingleton('sales/order_config')->getStatuses() as $_code=>$_label): ?>

||  remove white image frame:
    <li><a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->escapeHtml($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->keepFrame(false)->resize(45, 50)->setWatermarkSize('30x10'); ?>" width="45" height="50" alt="<?php echo $this->escapeHtml($this->getProductName()) ?>" /></a></li>

||  wishlist product image size location:

||  cart page product image size location:

||  Mini cart product image size location:

||  where is product category  title

||  How to product count:

<!-- total product count -->
    <?php $_helper = $this->helper('catalog/output'); ?>
    <?php $_category_detail = Mage::registry('current_category'); ?>
    <?php $_category_detail->getName(); ?>
    <?php $_category_detail->getId(); ?>
        $products_count = Mage::getModel('catalog/category')->load($_category_detail->getId())->getProductCount();
        echo'(' . ($products_count) . '&nbsp;' . 'Products Founds)';
    </p><!-- count end -->

||	how to set up mobile theme
	iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini

||	<?php echo $this->getChildHtml('topMenu') ?>
	<block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/>
||   Product total view
	<div class="total_view">

			$id = $id=$_helper->productAttribute($_product, $_product->getId(), 'id');

			$fromDate = '2013-12-10';
			$toDate   = now();
			$viewedProducts = Mage::getResourceModel('reports/product_collection')->addViewsCount($fromDate, $toDate);
			foreach($viewedProducts as $product) {
				echo  "Total View Count: " . $product->getData('views');

||	Checkout page Button Place Order click then ajax loading title Submitting order information 

||	Edit was added to your shopping cart in magento 
	search this :  was added to your shopping cart.

||	Discount Codes

||	Product column count in xml page
	<action method="setColumnCount"><count>3</count></action>

||	How to Remove "Starting at" Price in Magento
	<span class="price-label"><?php echo $this->__('Starting at:') ?></span>

||	product view page compare & wishlist

||	product view page add to cart

||	Magento Currency Drop Down only Currency Symbols like BDT, USD >  template/directory/currency.phtml 
    <?php //echo $_name ?> <?php echo $_code ?>

||	Currency symbols from System->Manage Currency->Symbols.

||  Magento Currency Symbol 404's when i go to admin
    solve: Change line 68 in app\code\core\Mage\CurrencySymbol\etc\config.xml
    <currencysymbol before="Mage_Adminhtml">Mage_CurrencySymbol_Adminhtml</currencysymbol>

||	Currency:
	1.catalog.xml or page.xml
	   <block type="directory/currency" name="currency" as="currency" template="directory/currency.phtml"/>
	2.anywhere phtml file
	   <?php echo $this->getLayout()->createBlock('directory/currency')->setTemplate('directory/currency.phtml')->toHtml(); ?>

||  Currency remove: local.xml file
    <catalog_category_default><remove name="currency" /></catalog_category_default>

||	clear shopping cart & Update Shopping Cart is not working 
	---> In your /app/design/frontend/yourthemepackage/default/template/checkout/cart.phtml file or /app/design/frontend/default/yourtheme/template/checkout/cart.phtml file
		 Just place on line 50 just after getUrl('checkout/cart/updatePost') ?>" method="post"> paste the below code
		 <?php echo $this->getBlockHtml('formkey'); ?>

||	Login frontend edit

||	Checkout Login edit frontend (CHECKOUT AS A GUEST OR REGISTER)

||	Product url:
	<?php echo $_product->getProductUrl() ?>

||	name :
	<?php echo $this->__('Go') ?>

||	Default product image
	1. System > Configuration > Catalog > Product Image Placeholders
	2. skin\frontend\default\mytheme\images\catalog\product\placeholder

||	Adding Links to your topLinks

||	page > html >breadcrumbs.phtml

||	Only Contact Us page breadcrumbs:layout>contacts.xml
	<reference name="root">
	  <action method="unsetChild"><alias>breadcrumbs</alias></action>
		<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
			<action method="addCrumb">
			<action method="addCrumb">
			  <crumbInfo><label>Contact us</label><title>Contact us</title></crumbInfo>
	  <action method="setTemplate"><template>page/empty.phtml</template></action>
	  <action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>

||	Breadcrumbs>page.xml:
	<label>Main Content Area</label>

||	Breadcrumbs Adding to cms pages in Magento:
	if ((!$crumbs || !is_array($crumbs)) && $this->getUrl('')!= $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))) {
		$breadcrumb = $this->getLayout()->getBlock('breadcrumbs');
		$breadcrumb->addCrumb('home', array('label' => Mage::helper('cms')->__('Home'), 'title' => Mage::helper('cms')->__('Home Page'), 'link' => Mage::getBaseUrl()));
		$breadcrumb->addCrumb('my_account activeBreadcrumb', array('label' => $this->getLayout()->getBlock('head')->getTitle(), 'title' => $this->getLayout()->getBlock('head')->getTitle(), 'last' => 1));
		$crumbs = $breadcrumb->_crumbs;

||	Showing Breadcrums anywhere in Magento:
	<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml()?>

||	if you want to condition that the slide show only home page:
        // If it is the home page, then just show up on the home page, other pages don't show 
	||  <?php if( Mage::getSingleton('cms/page')->getIdentifier()=='home') :?>
        <div class=""></div>    
		<?php endif;?>
	   // if it is the home page, then don't show up on the home page, other pages show up 
	||	<?php if(!(Mage::getSingleton('cms/page')->getIdentifier() == 'home'  && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms')) : ?>

||	Short Description
	<?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?>

||	Product Detail page Description
		$my_product = Mage::getModel('catalog/product')->load($_product->getId());
		echo $my_product->getDescription();

||	How to get attribute name and value?
	<p class="attribute"><?php echo "Author:".$attributeValue = Mage::getModel('catalog/product')->load($_product->getId())->getAttributeText('author');?></p>

||	One Page Checkout Success 2column
	---> app\design\frontend\default\default\layout\checkout.xml
		 <label>One Page Checkout Success</label>

||	Product Url
	<a href="<?php echo $_product->getProductUrl() ?>">Product Details</a>

||	Forgot Your Password? column layout->

||	Admin Change(xampp\htdocs\onlinesales\app\design\adminhtml\default\default\template)-
	1. login.phtml file:69 line
	2. forgotpassword.phtml file: 64 line
	<p class="legal"><?php echo Mage::helper('adminhtml')->__('Copyright &copy; FSB.', date('Y')) ?></p>

||	Search Bar Anywhere
	<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('catalogsearch/')->toHtml();?>	

||	Advanced Search
	<a href="<?php echo $this->getUrl('catalogsearch/advanced/')?>"><?php echo $this->__('Advanced Search');?></a>

||	call name<li><a href="<?php echo $this->getUrl('');?>"><?php echo $this->__('Home');?></a></li>

||	media img src for phtml
	<img alt="author" src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);?>/wysiwyg/author/Humayun-ahmed.jpg">

||	media img src for block:
	<a href="{{store url=''}}"><img src="{{media url='folder/sub1.jpg'}}" alt="" /></a>

||	page.xml:
	<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">

||	how to call topmenu.phtml in 2columns-left.phtml page
	<?php echo $this->getLayout()->createBlock('page/html_topmenu')->setTemplate('page/html/topmenu.phtml')->toHtml();?>

||	Diaplay SKU On The Product view Page:
	<p class="p_code">Product Code: <?php echo nl2br($_product->getSku()) ?></p>
	<?php echo $this->htmlEscape($_product->getSku()) ?>
	<?php echo $sku = Mage::getModel('catalog/product')->load($_product->getId())->getSku();?>

<-- Product Name call --->
<?php echo Mage::getModel('catalog/category')->load(20)->getName(); ?>

<-- Name & view more link-->
<?php $cate_id = 15; ?>
<h2><?php echo Mage::getModel('catalog/category')->load($cate_id)->getName(); ?> <a href="<?php echo Mage::getModel('catalog/category')->load($cate_id)->getUrl(); ?>"><?php echo $this->__('View More')?></a></h2>

||	product in phtml-page:
	<?php echo $this->getLayout()->createBlock('catalog/product_list')->setCategoryId(3)->setTemplate('catalog/product/list.phtml')->toHtml();?>

||	product in home page from Block
	{{block type="catalog/product_list" category_id="3" template="catalog/product/list.phtml"}}
	{{block type="catalog/product_list" column_count="4" category_id="45" limit="16" template="catalog/product/custom_scroll.phtml"}}

||	<?php $_columnCount = 4 //$this->getColumnCount(); ?>	

||	block call
	<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('opcontent')->toHtml() ?> 

||	cms page link:
	<div class="home_page">{{block type="core/template"template="page/home.phtml"}}</div>

||	catalog.xml>
	<!--Category default layout-->
	<!--Category layered navigation layout-->
	<action method="setColumnCount"><count>4</count></action>

||	no conflict jequry:
	$j = jQuery.noConflict();

||	Home page>phtml page link:
	<div class="custom_menu">
		<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('navigation/css/nav.css');?>" media="all" />
		<?php echo $this->getLayout()->createBlock('navigation/navigation')->setTemplate('navigation/left.phtml')->toHtml() ?>

||	compare:
	<?php echo $this->getLayout()->createBlock('catalog/product_compare_sidebar')->setTemplate('catalog/product/compare/sidebar.phtml')->toHtml();?>

||	show mycart in home page from block:
	{{block type="checkout/cart_sidebar" template="checkout/cart/sidebar.phtml"}}

||	mycart xml page
	<block type="checkout/cart_sidebar" name="checkout/cart_sidebar" template="checkout/cart/sidebar.phtml"/>		
||	Mycart:
	<?php echo $this->getLayout()->createBlock('checkout/cart_sidebar')->setTemplate('checkout/cart/sidebar.phtml')->toHtml();?>

||	Newsletter in phtml:
	<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml();?>
	<?php echo $this->getChildHtml('newsletter') ?>

||	show newsletter from block:
	{{block type="newsletter/subscribe" template="newsletter/subscribe.phtml"}}

||	Wishlist:
	<?php echo $this->getLayout()->createBlock('wishlist/customer_wishlist')->setTemplate('wishlist/sidebar.phtml')->toHtml();?>

||	Wishlist href link:
	<?php echo $this->helper('wishlist')->getListUrl()?> 

||	gaterthen code &gt; 

||	copyright code &copy;

||	Cart Count:
	<a href="<?php echo Mage::helper('checkout/cart')->getCartUrl(); ?>"> CART </a>
            <?php $cart=Mage::helper('checkout/cart')->getSummaryCount(); 
                if($cart == 0){
                    echo "0";
                    echo $cart;
||	Cart total amount 	
		$grandTotal = Mage::helper('checkout/cart')->getQuote()->getGrandTotal();
		$text = $this->__('%s', Mage::helper('core')->formatPrice($grandTotal, false));
	<span class="head_amount"><?php echo $text; ?></span>
||	Can I use multiple versions of jQuery on the same page?
	<!-- load jQuery 1.1.3 -->
	<script type="text/javascript" src=""></script>
	<script type="text/javascript">
	   var jQuery_1_1_3 = $.noConflict(true);

	<!-- load jQuery 1.3.2 -->
	<script type="text/javascript" src=""></script>
	<script type="text/javascript">
	   var jQuery_1_3_2 = $.noConflict(true);

||	mage media link magento:
	$media 	 = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
	$regFile = $media.'reg/regi.pdf';
	?><a href="<?php echo $regFile;?>">Download</a>

||	How to add related products tab in products detail page
		1.Go layout\catalog.xml
		search this> <block type="catalog/product_view_tabs" name="" as="info_tabs" template="catalog/product/view/tabs.phtml" >
		2.<action method="addTab" translate="title" module="catalog"><alias>related</alias><title>Related Product</title><block>catalog/product_list_related</block><template>catalog/product/view/related.phtml</template></action>
		3.catalog\product\view>related.phtml page create and in this page <?php echo $this->getLayout()->getBlock('catalog.product.related')->toHtml()?> paste
		4.Related product image size (catalog\product\list\ralated.phtml)
		5.If you don't see output, you have to do must be cash refresh and logout

||	Display Related products in product details page:
	<?php //echo $this->getChildHtml('related'); ?>
	<?php //echo $this->getChildHtml('catalog.product.related') ?>
	<?php echo $this->getLayout()->getBlock('catalog.product.related')->toHtml()?>

||	Login & Logout:
		<?php if (Mage::getSingleton('customer/session')->isLoggedIn()==1): ?>
		<li class="first"><a title="Log Out" href="<?php echo $this->getUrl('customer/account/logout') ?>">Log Out</a></li>
		<?php else:?>
		<li class="first"><a title="Log In" href="<?php echo $this->getUrl('customer/account/login') ?>">Log In</a></li> | 
		<li class=""><a title="Register" href="<?php echo $this->getUrl('customer/account/create') ?>">Register</a></li> |
		<?php endif;?>
		<li><p>or create an<a href="<?php echo $this->getUrl('customer/account');?>">Account</a></p></li>

||	product onmouseover:
	<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(true)->resize(192,224); ?>" width="192" height="224" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" onmouseover="this.src='<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(true)->resize(192,224) ?>';" onmouseout="this.src='<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(true)->resize(192,224) ?>';" /></a>

||	Audio song added code:
	<div style="position:fixed; top:0; right:0; " class="auido_play">
		<audio loop="true" autoplay="autoplay" controls="controls">
			<source type="audio/wav" src="<?php echo $this->getSkinUrl('css/song.mp3');?>"></source>
	<embed src="<?php //echo $this->getSkinUrl('css/song.mp3');?>" autostart="true" loop="true"width="2" height="0"></embed> 
	<a href="<?php //echo $this->getSkinUrl('css/song.mp3');?>">Play music</a>

||	Online Visitor and Total Visitors in Magento:
	$visitor_count = Mage::getModel('log/visitor_online')->prepare()->getCollection()->count();
	if(!empty($visitor_count) && $visitor_count > 0)
		$cnt =  $visitor_count;
		echo 'Visitors online :'.$cnt;
	$write = Mage::getSingleton('core/resource')->getConnection('core_write');
	$readresult=$write->query("SELECT * FROM log_visitor ORDER BY visitor_id DESC LIMIT 1 ");
	while ($row = $readresult->fetch() )
		echo "Total Visitors".$row['visitor_id'];

||	Online Visitor from BBrands:
		 $visitor_count = Mage::getModel('log/visitor_online')->prepare()->getCollection()->count();
		 if(!empty($visitor_count) && $visitor_count > 0)
			echo $visitor_count.' Online Visitors'; 

Dynamic Menu

<!-----This is for All menu----->
$rootcatId= Mage::app()->getStore()->getRootCategoryId(); 
$categories = Mage::getModel('catalog/category')->getCategories($rootcatId);
function  get_categories($categories) {
    $array= '<ul>';
    foreach($categories as $category) {
        $cat = Mage::getModel('catalog/category')->load($category->getId());
        $count = $cat->getProductCount();
        $array .= '<li>'.
        '<a href="' . Mage::getUrl($cat->getUrlPath()). '">' . 
                  $category->getName() . "(".$count.")</a>\n";
        if($category->hasChildren()) {
            $children = Mage::getModel('catalog/category')->getCategories($category->getId());
             $array .=  get_categories($children);
         $array .= '</li>';
    return  $array . '</ul>';
echo  get_categories($categories); 
echo "<div class=\"clearer\"></div>";

<!------Only Current Menu > submenu-------->
<div class="left_menu">
		$routeDetect = Mage::app()->getFrontController()->getRequest()->getRouteName();
		if($routeDetect == 'catalog') :
	<div class="block block-whishlist">
		<div class="block-title">
			<strong><span>Current Categories</span></strong>
		<div class="block-content">
				$_current_category =Mage::registry('current_category')->getId();
				$collection = Mage::getModel('catalog/category')->getCategories($_current_category);
				$helper     = Mage::helper('catalog/category');	
				<?php foreach ($collection as $cat):?>
					<?php if($cat->getIsActive()):?>
						<li style="border-bottom: 1px solid #ddd">
							<a href="<?php echo $helper->getCategoryUrl($cat);?>">             
								<cite><?php echo $cat->getName();?></cite>
								$collection_sub = Mage::getModel('catalog/category')->getCategories($cat->getId());									
								<?php foreach ($collection_sub as $sub):?>
									<?php if($sub->getIsActive()):?>
										<li border-bottom: 1px solid #ddd>
											<a href="<?php echo $helper->getCategoryUrl($sub);?>">             
											&nbsp;<cite><?php echo $sub->getName();?></cite>
									<?php endif;?>
								<?php endforeach;?>	
					<?php endif;?>
				<?php endforeach;?>
	<?php endif;?>							
		$routeDetect = Mage::app()->getFrontController()->getRequest()->getRouteName();
		if($routeDetect != 'customer') :
	<?php endif;?>

Useful websites on Magento:

In this section, you can fnd a lot of interesting articles about Magento development,Magento design, and free extensions.

Excellence Magento blog:
This is the blog of Manish Prakash, a Magento and mobile app developer.His blog is full of interesting tutorials and articles on Magento development.Check out at

Fabrizio Branca blog
Fabrizio Branca is a certifed developer, and he released a number of free extensions to boost up your Magento, especially the cache.You can fnd all the free extensions he created at

Bubble codes by Johann Reinke
In this website blog, you can fnd interesting articles and resources related to Magento as well as the free Magento Go admin theme.You can check this out at

Inchoo’s blog
Inchoo is a web company specialized in Magento and they own a blog full of useful information, tips, and free modules that you can use for your project and to understand a lot of things about Magento development, e-commerce-related marketing, and Magento custom free and useful extensions.You can fnd the blog at

Tuts plus Magento tutorials
If you are looking for some other neat, simple tutorials on Magento and Magento design, you can fnd some interesting articles when you go to the Tuts plus website and search for Magento.You can access all the Magento articles at

Smashing magazine
Smashing magazine is an online magazine for web designers and developers.Here too, you can fnd a lot of articles about Magento. You can access this at

Free resources for design, UI, and web design
There have a few links about design, responsive design, and other interesting topics.

UI – UIX resources:
Ux news:

Social media
The following is a useful link that can be used for reference:
• AddThis social media:

Free resources
The following are some useful links that can be used for reference:
• Free mockup to present your theme:
• Freebies bug:
• Pixeden:

In this book, we have seen how to create and develop a responsive Magento theme with custom widgets and the custom admin theme panel. We have also seen how to customize the admin theme to make it look better and similar to the front end.The responsive web design is very important, especially during a time like this, when mobile devices are constantly developing and being disseminated, and purchases via smartphones are increasing. If you improve and learn how to do this in the better way, you can offer very high quality services to your clients.I hope you found this guide useful and that it has offered you the fundamental knowledge to be able to continue your work and realize some fantastic Magento themes.