<?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 Wordpress Javascript programming n tutorial</description>
	<lastBuildDate>Tue, 07 Sep 2010 06:18:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 to category from the mysql setup file of the module.
By mysql setup file, I mean the file inside the directory YourNamespace/YourModule/sql/yourmodule_setup/

Create a new module and write the following in your module&#8217;s mysql setup file. 

$installer = ...


<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-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>
</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;">
$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>
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/magento-adding-category-attributes/">Magento: Adding category attributes</a></p>
</div>
<hr /><small>Copyright &copy; 2010<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-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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-adding-category-attributes/feed/</wfw:commentRss>
		<slash:comments>3</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 clicked. Like, product listing for Furniture category, product listing for Living Room category, etc.
Solution:
- Go to System -> Index Management
- Select All Checkbox
- In Actions, select &#8216;Reindex Data&#8216;
- Click Submit
Now, go to the category listing page. You ...


<strong>Related posts:</strong><ol><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/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-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>
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/magento-1-4-no-products-displayed-in-category-listing/">Magento 1.4: No products displayed in category listing</a></p>
</div>
<hr /><small>Copyright &copy; 2010<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/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/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-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>1</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 comma separated way. So, to filter product collection by more than one category, you have to use:
addAttributeToFilter(&#8216;category_ids&#8217;,array(&#8216;finset&#8217;=>$categoryIds));

$categoryIds can be a single category id or comma separated category ids.
The following code filters product collection by two category ...


<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-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>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;">
 $_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!
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/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></p>
</div>
<hr /><small>Copyright &copy; 2010<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-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-how-to-filter-product-collection-using-2-or-more-category-filters/feed/</wfw:commentRss>
		<slash:comments>7</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:

$currentCategory = Mage::registry('current_category');

You can get the parent category from the following code:


/**
 * You want the parent category of a sub-category
 * Let the sub-category be $subCategory
 */

$parentCategory = Mage::getModel('catalog/category')-&#62;load($subCategory-&#62;getParentId());


From Mukesh Chapagain&#039;s Blog &#124; Post Magento: Get current and parent category

Copyright &#169; 2010 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 viewing an infringement of the ...


<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-get-current-url-of-the-page/' rel='bookmark' title='Permanent Link: Magento: Get current Url of the page'>Magento: Get current Url of the page</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>You can get current category from the following code:</p>
<pre class="brush: php;">
$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;">
/**
 * 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>
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/magento-get-current-and-parent-category/">Magento: Get current and parent category</a></p>
</div>
<hr /><small>Copyright &copy; 2010<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-get-current-url-of-the-page/' rel='bookmark' title='Permanent Link: Magento: Get current Url of the page'>Magento: Get current Url of the page</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-get-current-and-parent-category/feed/</wfw:commentRss>
		<slash:comments>0</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 and the products associated with the sub categories (Living Room and Bedroom).
Furniture
- Living Room (4)
- Bedroom (2)


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

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

/**
 * looping ...


<strong>Related posts:</strong><ol><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-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-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;">

/**
 * 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" />
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/magento-get-sub-categories-and-product-count/">Magento: Get sub categories and product count</a></p>
</div>
<hr /><small>Copyright &copy; 2010<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-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-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-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>3</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.

&#60;?php
/**
 * get categories from a product
 */
$categoryIds = $product-&#62;getCategoryIds();
/**
 * looping through the array of category ids
 */
foreach($categoryIds as $categoryId) {
	$category = Mage::getModel('catalog/category')-&#62;load($categoryId);
	?&#62;
		Category: &#60;a href=&#34;&#60;?php echo $category-&#62;getCategoryUrl() ?&#62;&#34;&#62;&#60;?php echo $category-&#62;getName() ?&#62;&#60;/a&#62;&#60;br/&#62;
	&#60;?php
}
?&#62;


From Mukesh Chapagain&#039;s Blog &#124; Post Magento: Get category name and url from product

Copyright &#169; 2010 This feed is for personal, non-commercial use only.  The use of this feed on ...


<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>
</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;">
&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>
<div style="margin-top: 15px; font-style: italic">
<p><strong>From</strong> <a href="http://blog.chapagain.com.np/">Mukesh Chapagain&#039;s Blog</a> | <strong>Post</strong> <a href="http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/">Magento: Get category name and url from product</a></p>
</div>
<hr /><small>Copyright &copy; 2010<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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-get-category-name-and-url-from-product/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
