<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mukesh Chapagain&#039;s Blog &#187; category</title>
	<atom:link href="http://blog.chapagain.com.np/tag/category/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chapagain.com.np</link>
	<description>PHP Magento jQuery SQL Wordpress Joomla Programming &#38; Tutorial</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:54:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Magento: Get list of all Categories</title>
		<link>http://blog.chapagain.com.np/magento-get-list-of-all-categories/</link>
		<comments>http://blog.chapagain.com.np/magento-get-list-of-all-categories/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 12:28:07 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[category]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=931</guid>
		<description><![CDATA[Here, I will show you how you can get list of all categories of your Magento Shop. You might want to display all categories in homepage or any CMS page. There are different ways to get the category listing. Here are some:- Get all categories The following code will fetch all categories (both active and [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/' rel='bookmark' title='Permanent Link: Magento: Get sub categories and product count'>Magento: Get sub categories and product count</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-get-list-of-all-modules-programmatically/' rel='bookmark' title='Permanent Link: Magento: How to get list of all modules programmatically?'>Magento: How to get list of all modules programmatically?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-block-controller-model-helper-override/' rel='bookmark' title='Permanent Link: Magento: Block Controller Model Helper Override'>Magento: Block Controller Model Helper Override</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-current-and-parent-category/' rel='bookmark' title='Permanent Link: Magento: Get current and parent category'>Magento: Get current and parent category</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here, I will show you how you can get list of all categories of your Magento Shop.</p>
<p>You might want to display all categories in homepage or any CMS page. There are different ways to get the category listing. Here are some:-</p>
<p><strong>Get all categories</strong></p>
<p><span id="more-931"></span></p>
<p>The following code will fetch all categories (both active and inactive) that are present in your Magento Shop.</p>
<pre class="brush: php; title: ; notranslate">
$categories = Mage::getModel('catalog/category')
					-&gt;getCollection()
					-&gt;addAttributeToSelect('*');
</pre>
<p><strong>Get all active categories</strong></p>
<p>The following code will fetch all active categories that are present in your Magento Shop. Thus filtering the inactive categories.</p>
<pre class="brush: php; title: ; notranslate">
$categories = Mage::getModel('catalog/category')
					-&gt;getCollection()
					-&gt;addAttributeToSelect('*')
					-&gt;addIsActiveFilter();
</pre>
<p><strong>Get active categories of any particular level</strong></p>
<p>The following code will fetch all active categories of certain/specific level. Here, I have chosen level 1. Also <strong>sorting categories by name</strong>.</p>
<pre class="brush: php; title: ; notranslate">
$categories = Mage::getModel('catalog/category')
					-&gt;getCollection()
					-&gt;addAttributeToSelect('*')
					-&gt;addIsActiveFilter()
					-&gt;addLevelFilter(1)
					-&gt;addOrderField('name');
</pre>
<p><strong>Get store specific categories</strong></p>
<p>The following code will fetch all active store specific categories. The following helper function does so:-</p>
<p><strong>getStoreCategories($sorted=false, $asCollection=false, $toLoad=true)</strong></p>
<pre class="brush: php; title: ; notranslate">
$helper = Mage::helper('catalog/category');

// sorted by name, fetched as collection
$categoriesCollection = $helper-&gt;getStoreCategories('name', true, false);

// sorted by name, fetched as array
$categoriesArray = $helper-&gt;getStoreCategories('name', false, false);
</pre>
<p>Hope this helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=931&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/' rel='bookmark' title='Permanent Link: Magento: Get sub categories and product count'>Magento: Get sub categories and product count</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-get-list-of-all-modules-programmatically/' rel='bookmark' title='Permanent Link: Magento: How to get list of all modules programmatically?'>Magento: How to get list of all modules programmatically?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-block-controller-model-helper-override/' rel='bookmark' title='Permanent Link: Magento: Block Controller Model Helper Override'>Magento: Block Controller Model Helper Override</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-current-and-parent-category/' rel='bookmark' title='Permanent Link: Magento: Get current and parent category'>Magento: Get current and parent category</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-get-list-of-all-categories/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Magento: Adding category attributes</title>
		<link>http://blog.chapagain.com.np/magento-adding-category-attributes/</link>
		<comments>http://blog.chapagain.com.np/magento-adding-category-attributes/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 08:30:58 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[category]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=821</guid>
		<description><![CDATA[Here, I will be showing you how you can add attributes for your categories in Magento. From the admin panel, you can only add attributes to product. To add attributes to category, you need to write sql query in your phpmyadmin or a better way would be creating a new custom module and adding attributes [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-adding-attribute-from-mysql-setup-file/' rel='bookmark' title='Permanent Link: Magento: Adding attribute from MySql setup file'>Magento: Adding attribute from MySql setup file</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-current-and-parent-category/' rel='bookmark' title='Permanent Link: Magento: Get current and parent category'>Magento: Get current and parent category</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here, I will be showing you how you can add attributes for your categories in Magento.</p>
<p>From the admin panel, you can only add attributes to product. To add attributes to category, you need to write sql query in your phpmyadmin or a better way would be creating a new custom module and adding attributes to category from the mysql setup file of the module.</p>
<p>By mysql setup file, I mean the file inside the directory <strong>YourNamespace/YourModule/sql/yourmodule_setup/</strong></p>
<p><span id="more-821"></span></p>
<p>Create a new module and write the following in your module&#8217;s mysql setup file. </p>
<pre class="brush: php; title: ; notranslate">
$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$installer-&gt;startSetup();

$setup-&gt;addAttribute('catalog_category', 'my_attribute', array(
	'group'     	=&gt; 'General',
	'input'         =&gt; 'text',
    'type'          =&gt; 'varchar',
    'label'         =&gt; 'My Attribute',
	'backend'       =&gt; '',
	'visible'       =&gt; 1,
	'required'		=&gt; 0,
	'user_defined' =&gt; 1,
    'global'        =&gt; Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
));

$installer-&gt;endSetup();
</pre>
<p>The above code will create a category with the code &#8216;<strong>my_attribute</strong>&#8216; and lable &#8216;<strong>My Attribute</strong>&#8216;. You can view it under <strong>Admin Panel &#8211;> Catalog &#8211;> Manage Categories &#8211;> General Information</strong></p>
<p>Hope this helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=821&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-adding-attribute-from-mysql-setup-file/' rel='bookmark' title='Permanent Link: Magento: Adding attribute from MySql setup file'>Magento: Adding attribute from MySql setup file</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-current-and-parent-category/' rel='bookmark' title='Permanent Link: Magento: Get current and parent category'>Magento: Get current and parent category</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-adding-category-attributes/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Magento 1.4: No products displayed in category listing</title>
		<link>http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/</link>
		<comments>http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 13:24:37 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=869</guid>
		<description><![CDATA[Scenario: I have a fresh installation of Magento 1.4. I already have installed the sample data for Magento. Now, when I go to the category listing page, no products are displayed. It says &#8220;There are no products matching the selection.&#8220;. By category listing page, I mean the product listing page displayed when any category is [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/displaying-all-products-and-new-products-listing-in-columngrid-layout-zen-cart/' rel='bookmark' title='Permanent Link: Displaying all products and new products listing in column/grid layout &#8211; Zen-cart'>Displaying all products and new products listing in column/grid layout &#8211; Zen-cart</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-bestselling-products-by-category-and-date-time/' rel='bookmark' title='Permanent Link: Magento: Get Bestselling products by category and date time'>Magento: Get Bestselling products by category and date time</a></li>
<li><a href='http://blog.chapagain.com.np/magento-downloadable-products-not-displayed-in-associated-products-tab-in-grouped-product/' rel='bookmark' title='Permanent Link: Magento: Downloadable products not displayed in Associated Products tab in Grouped Product'>Magento: Downloadable products not displayed in Associated Products tab in Grouped Product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario:</strong></p>
<p>I have a fresh installation of Magento 1.4. I already have installed the sample data for Magento. </p>
<p>Now, when I go to the category listing page, no products are displayed. It says &#8220;<strong>There are no products matching the selection.</strong>&#8220;.</p>
<p><span id="more-869"></span></p>
<p>By category listing page, I mean the product listing page displayed when any category is clicked. Like, product listing for Furniture category, product listing for Living Room category, etc.</p>
<p><strong>Solution:</strong></p>
<p>- Go to <strong>System -> Index Management</strong><br />
- Select All Checkbox<br />
- In Actions, select &#8216;<strong>Reindex Data</strong>&#8216;<br />
- Click Submit</p>
<p>Now, go to the category listing page. You will be able to see the products.</p>
<p>Hope this helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=869&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/displaying-all-products-and-new-products-listing-in-columngrid-layout-zen-cart/' rel='bookmark' title='Permanent Link: Displaying all products and new products listing in column/grid layout &#8211; Zen-cart'>Displaying all products and new products listing in column/grid layout &#8211; Zen-cart</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-bestselling-products-by-category-and-date-time/' rel='bookmark' title='Permanent Link: Magento: Get Bestselling products by category and date time'>Magento: Get Bestselling products by category and date time</a></li>
<li><a href='http://blog.chapagain.com.np/magento-downloadable-products-not-displayed-in-associated-products-tab-in-grouped-product/' rel='bookmark' title='Permanent Link: Magento: Downloadable products not displayed in Associated Products tab in Grouped Product'>Magento: Downloadable products not displayed in Associated Products tab in Grouped Product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Magento: How to filter product collection using 2 or more category filters?</title>
		<link>http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/</link>
		<comments>http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 12:44:51 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[collection]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[find_in_set]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=475</guid>
		<description><![CDATA[Suppose, you have a product collection and you want to filter it by category. Suppose, you want to filter it by more than one category. You can use addCategoryFilter if you have only one category. But, what if you want to filter by more than one category? Category ids are stored for product in a [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/' rel='bookmark' title='Permanent Link: Magento: Get sub categories and product count'>Magento: Get sub categories and product count</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-search-or-filter-by-multiselect-attribute-in-admin-grid/' rel='bookmark' title='Permanent Link: Magento: How to search or filter by multiselect attribute in admin grid?'>Magento: How to search or filter by multiselect attribute in admin grid?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-product-collection-by-type/' rel='bookmark' title='Permanent Link: Magento: Get Product Collection by Type'>Magento: Get Product Collection by Type</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Suppose, you have a product collection and you want to filter it by category. Suppose, you want to filter it by more than one category. You can use addCategoryFilter if you have only one category. But, what if you want to filter by more than one category?</p>
<p>Category ids are stored for product in a comma separated way. So, to filter product collection by more than one category, you have to use:<br />
<strong>addAttributeToFilter(&#8216;category_ids&#8217;,array(&#8216;finset&#8217;=>$categoryIds));</strong></p>
<p><span id="more-475"></span></p>
<p><strong>$categoryIds</strong> can be a single category id or comma separated category ids.</p>
<p>The following code filters product collection by two category ids (36 and 37).</p>
<pre class="brush: php; title: ; notranslate">
 $_productCollection = Mage::getResourceModel('reports/product_collection')
    -&gt;addAttributeToSelect('*')
    -&gt;addAttributeToFilter('category_ids',array('finset'=&gt;'36,37'));
</pre>
<p>finset does so&#8230; when we use finset, the mysql function <strong>find_in_set</strong> is used in the sql query by Magento.</p>
<p>mysql function find_in_set:</p>
<p><strong>FIND_IN_SET()</strong> looks for the first occurrence of a string within another string containing comma-separated values.</p>
<p>SELECT FIND_IN_SET(&#8216;b&#8217;,'a,b,c,d&#8217;);  // result = 2</p>
<p>Cheers!</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=475&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/' rel='bookmark' title='Permanent Link: Magento: Get sub categories and product count'>Magento: Get sub categories and product count</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-search-or-filter-by-multiselect-attribute-in-admin-grid/' rel='bookmark' title='Permanent Link: Magento: How to search or filter by multiselect attribute in admin grid?'>Magento: How to search or filter by multiselect attribute in admin grid?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-product-collection-by-type/' rel='bookmark' title='Permanent Link: Magento: Get Product Collection by Type'>Magento: Get Product Collection by Type</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Magento: Get current and parent category</title>
		<link>http://blog.chapagain.com.np/magento-get-current-and-parent-category/</link>
		<comments>http://blog.chapagain.com.np/magento-get-current-and-parent-category/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 18:13:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[current]]></category>
		<category><![CDATA[parent]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=400</guid>
		<description><![CDATA[You can get current category from the following code: You can get the parent category from the following code: Copyright &#169; 2011 This feed is for personal, non-commercial use only. The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-bestselling-products-by-category-and-date-time/' rel='bookmark' title='Permanent Link: Magento: Get Bestselling products by category and date time'>Magento: Get Bestselling products by category and date time</a></li>
<li><a href='http://blog.chapagain.com.np/magento-adding-category-attributes/' rel='bookmark' title='Permanent Link: Magento: Adding category attributes'>Magento: Adding category attributes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>You can get current category from the following code:</p>
<pre class="brush: php; title: ; notranslate">
$currentCategory = Mage::registry('current_category');
</pre>
<p>You can get the parent category from the following code:</p>
<p><span id="more-400"></span></p>
<pre class="brush: php; title: ; notranslate">
/**
 * You want the parent category of a sub-category
 * Let the sub-category be $subCategory
 */

$parentCategory = Mage::getModel('catalog/category')-&gt;load($subCategory-&gt;getParentId());
</pre>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=400&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-bestselling-products-by-category-and-date-time/' rel='bookmark' title='Permanent Link: Magento: Get Bestselling products by category and date time'>Magento: Get Bestselling products by category and date time</a></li>
<li><a href='http://blog.chapagain.com.np/magento-adding-category-attributes/' rel='bookmark' title='Permanent Link: Magento: Adding category attributes'>Magento: Adding category attributes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-get-current-and-parent-category/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Magento: Get sub categories and product count</title>
		<link>http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/</link>
		<comments>http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 13:02:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=396</guid>
		<description><![CDATA[Here, I will be showing you the code to get sub categories of a particular category and the number of products (product count) present in the sub categories. Like, I have a category named Furniture. The sub categories under Furniture are Living Room and Bedroom. Now, I want to show the sub categories under Funiture [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-list-of-all-categories/' rel='bookmark' title='Permanent Link: Magento: Get list of all Categories'>Magento: Get list of all Categories</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-parent-id-of-simple-product-associated-to-configurable-product/' rel='bookmark' title='Permanent Link: Magento: Get parent id of simple product associated to configurable product'>Magento: Get parent id of simple product associated to configurable product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-get-all-associated-children-product-of-a-configurable-product/' rel='bookmark' title='Permanent Link: Magento: How to get all associated children product of a configurable product?'>Magento: How to get all associated children product of a configurable product?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here, I will be showing you the code to get sub categories of a particular category and the number of products (product count) present in the sub categories.</p>
<p>Like, I have a category named Furniture. The sub categories under Furniture are Living Room and Bedroom. Now, I want to show the sub categories under Funiture and the products associated with the sub categories (Living Room and Bedroom).<span id="more-396"></span></p>
<blockquote><p>Furniture<br />
- Living Room (4)<br />
- Bedroom (2)</p></blockquote>
<pre class="brush: php; title: ; notranslate">

/**
 * get current category
 */
$currCat = Mage::registry('current_category');

/**
 * get sub categories of current category
 */
$collection = Mage::getModel('catalog/category')-&gt;getCategories($currCat-&gt;getEntityId());

/**
 * looping through sub categories
 * only showing active sub categories ($cat-&gt;getIsActive())
 */
foreach($collection as $cat) {
	if($cat-&gt;getIsActive()) {
		$category = Mage::getModel('catalog/category')-&gt;load($cat-&gt;getEntityId());

		/**
		 * getting product collection for a particular category
		 * applying status and visibility filter to the product collection
  		 * i.e. only fetching visible and enabled products
  		 */
		$prodCollection = Mage::getResourceModel('catalog/product_collection')-&gt;addCategoryFilter($category);
		Mage::getSingleton('catalog/product_status')-&gt;addVisibleFilterToCollection($prodCollection);
		Mage::getSingleton('catalog/product_visibility')-&gt;addVisibleInCatalogFilterToCollection($prodCollection);

		?&gt;

		&lt;a href=&quot;&lt;?php echo $category-&gt;getUrl() ?&gt;&quot;&gt;&lt;?php echo $category-&gt;getName() ?&gt;&lt;/a&gt; (&lt;?php echo $prodCollection-&gt;count() ?&gt;)&lt;br/&gt;

		&lt;?php
	}
}
</pre>
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=396&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-get-list-of-all-categories/' rel='bookmark' title='Permanent Link: Magento: Get list of all Categories'>Magento: Get list of all Categories</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/' rel='bookmark' title='Permanent Link: Magento: Get category name and url from product'>Magento: Get category name and url from product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-parent-id-of-simple-product-associated-to-configurable-product/' rel='bookmark' title='Permanent Link: Magento: Get parent id of simple product associated to configurable product'>Magento: Get parent id of simple product associated to configurable product</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-get-all-associated-children-product-of-a-configurable-product/' rel='bookmark' title='Permanent Link: Magento: How to get all associated children product of a configurable product?'>Magento: How to get all associated children product of a configurable product?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Magento: Get category name and url from product</title>
		<link>http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/</link>
		<comments>http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 07:40:53 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[product]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=351</guid>
		<description><![CDATA[$product->getCategoryIds() gives array of category ids which the product is associated to. We can loop through this array and load each category to get the category name and url. Copyright &#169; 2011 This feed is for personal, non-commercial use only. The use of this feed on other websites breaches copyright. If this content is not [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/' rel='bookmark' title='Permanent Link: Magento: Get sub categories and product count'>Magento: Get sub categories and product count</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-current-and-parent-category/' rel='bookmark' title='Permanent Link: Magento: Get current and parent category'>Magento: Get current and parent category</a></li>
<li><a href='http://blog.chapagain.com.np/magento-adding-category-attributes/' rel='bookmark' title='Permanent Link: Magento: Adding category attributes'>Magento: Adding category attributes</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><strong>$product->getCategoryIds()</strong> gives array of category ids which the product is associated to. We can loop through this array and load each category to get the category name and url.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/**
 * get categories from a product
 */
$categoryIds = $product-&gt;getCategoryIds();
/**
 * looping through the array of category ids
 */
foreach($categoryIds as $categoryId) {
	$category = Mage::getModel('catalog/category')-&gt;load($categoryId);
	?&gt;
		Category: &lt;a href=&quot;&lt;?php echo $category-&gt;getCategoryUrl() ?&gt;&quot;&gt;&lt;?php echo $category-&gt;getName() ?&gt;&lt;/a&gt;&lt;br/&gt;
	&lt;?php
}
?&gt;
</pre>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=351&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/magento-how-to-filter-product-collection-using-2-or-more-category-filters/' rel='bookmark' title='Permanent Link: Magento: How to filter product collection using 2 or more category filters?'>Magento: How to filter product collection using 2 or more category filters?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/' rel='bookmark' title='Permanent Link: Magento 1.4: No products displayed in category listing'>Magento 1.4: No products displayed in category listing</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/' rel='bookmark' title='Permanent Link: Magento: Get sub categories and product count'>Magento: Get sub categories and product count</a></li>
<li><a href='http://blog.chapagain.com.np/magento-get-current-and-parent-category/' rel='bookmark' title='Permanent Link: Magento: Get current and parent category'>Magento: Get current and parent category</a></li>
<li><a href='http://blog.chapagain.com.np/magento-adding-category-attributes/' rel='bookmark' title='Permanent Link: Magento: Adding category attributes'>Magento: Adding category attributes</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
