<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Get all options of select or multiselect attribute in Magento by attribute code</title>
	<atom:link href="http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/</link>
	<description>PHP &#38; Magento Tips and Tutorials</description>
	<lastBuildDate>Thu, 17 May 2012 05:29:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Justin</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-688</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Fri, 30 Mar 2012 10:40:38 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-688</guid>
		<description>Ohh yes

I have found it my own.

This code works for fetching the associated colors for a product in product listing or category listing.

foreach ($_product-&gt;getOptions() as $o) {
	if($o-&gt;getTitle() == &#039;Available Colors&#039;){
		$values = $o-&gt;getValues();
		foreach ($values as $v) {
			echo &#039;, &#039;.$v-&gt;getData(&#039;default_title&#039;) ;
		}
	} 
}

Enjoy!!!</description>
		<content:encoded><![CDATA[<p>Ohh yes</p>
<p>I have found it my own.</p>
<p>This code works for fetching the associated colors for a product in product listing or category listing.</p>
<p>foreach ($_product-&gt;getOptions() as $o) {<br />
	if($o-&gt;getTitle() == &#8216;Available Colors&#8217;){<br />
		$values = $o-&gt;getValues();<br />
		foreach ($values as $v) {<br />
			echo &#8216;, &#8216;.$v-&gt;getData(&#8216;default_title&#8217;) ;<br />
		}<br />
	}<br />
}</p>
<p>Enjoy!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-687</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Fri, 30 Mar 2012 10:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-687</guid>
		<description>I tried your code and its work but I want only those color which are assigned to a particular product.

Thanks.</description>
		<content:encoded><![CDATA[<p>I tried your code and its work but I want only those color which are assigned to a particular product.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remon</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-213</link>
		<dc:creator>Remon</dc:creator>
		<pubDate>Thu, 19 May 2011 10:16:45 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-213</guid>
		<description>Hi there.
Your code solved some for us, but not completely. Say we have an optionlist size that has S M L and XL. Some shirts are only entered in the shop with a M and L variant.
When we use your code on the category page all options are listed (S thru XL) and not only the M and L.
We&#039;ve been googling for 3 days now, we&#039;re at a loss. Maybe you can point us in the right direction?
Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hi there.<br />
Your code solved some for us, but not completely. Say we have an optionlist size that has S M L and XL. Some shirts are only entered in the shop with a M and L variant.<br />
When we use your code on the category page all options are listed (S thru XL) and not only the M and L.<br />
We&#8217;ve been googling for 3 days now, we&#8217;re at a loss. Maybe you can point us in the right direction?<br />
Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sumanta Pati</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-212</link>
		<dc:creator>Sumanta Pati</dc:creator>
		<pubDate>Sat, 27 Mar 2010 06:15:35 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-212</guid>
		<description>Thank You . It&#039;s solve my problem</description>
		<content:encoded><![CDATA[<p>Thank You . It&#8217;s solve my problem</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Subesh Pokhrel</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-211</link>
		<dc:creator>Subesh Pokhrel</dc:creator>
		<pubDate>Mon, 15 Mar 2010 12:12:02 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-211</guid>
		<description>This should fix your problem

$_attribute=$_product-&gt;getResource()-&gt;getAttribute(&quot;size&quot;);
$_sourceTable = Mage::getModel(&#039;eav/entity_attribute_source_table&#039;)-&gt;setAttribute($_attribute);
$_sizeText = $_sourceTable-&gt;getOptionText($_product-&gt;getSize());</description>
		<content:encoded><![CDATA[<p>This should fix your problem</p>
<p>$_attribute=$_product->getResource()->getAttribute(&#8220;size&#8221;);<br />
$_sourceTable = Mage::getModel(&#8216;eav/entity_attribute_source_table&#8217;)->setAttribute($_attribute);<br />
$_sizeText = $_sourceTable->getOptionText($_product->getSize());</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: him</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-210</link>
		<dc:creator>him</dc:creator>
		<pubDate>Sun, 14 Mar 2010 16:56:24 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-210</guid>
		<description>// Add the attribute code here.
$attribute=$product-&gt;getResource()-&gt;getAttribute(&quot;color&quot;);

// Checking if the attribute is either select or multiselect type.
if($attribute-&gt;usesSource()){

	// Getting all the sources (options) and print as label-value pair
	$options = $attribute-&gt;getSource()-&gt;getAllOptions(false);

	echo &quot;&quot;;
	print_r($options);
}

form this i am egtting pair of option but I need only value of option..what i will do</description>
		<content:encoded><![CDATA[<p>// Add the attribute code here.<br />
$attribute=$product-&gt;getResource()-&gt;getAttribute(&#8220;color&#8221;);</p>
<p>// Checking if the attribute is either select or multiselect type.<br />
if($attribute-&gt;usesSource()){</p>
<p>	// Getting all the sources (options) and print as label-value pair<br />
	$options = $attribute-&gt;getSource()-&gt;getAllOptions(false);</p>
<p>	echo &#8220;&#8221;;<br />
	print_r($options);<br />
}</p>
<p>form this i am egtting pair of option but I need only value of option..what i will do</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Subesh Pokhrel</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-209</link>
		<dc:creator>Subesh Pokhrel</dc:creator>
		<pubDate>Tue, 23 Feb 2010 10:14:15 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-209</guid>
		<description>In Frontend? or Backend...</description>
		<content:encoded><![CDATA[<p>In Frontend? or Backend&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magento Question</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-208</link>
		<dc:creator>Magento Question</dc:creator>
		<pubDate>Tue, 23 Feb 2010 09:20:47 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-208</guid>
		<description>@subesh
Refering to the code you posted first.
Is there also a way to not show all the attributes of a product?
Or better in my case, Only the attribute &#039;size&#039; that is out of stock?

best regards</description>
		<content:encoded><![CDATA[<p>@subesh<br />
Refering to the code you posted first.<br />
Is there also a way to not show all the attributes of a product?<br />
Or better in my case, Only the attribute &#8216;size&#8217; that is out of stock?</p>
<p>best regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Subesh Pokhrel</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-207</link>
		<dc:creator>Subesh Pokhrel</dc:creator>
		<pubDate>Mon, 04 Jan 2010 04:32:37 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-207</guid>
		<description>@Magento Fan

$collection = $model-&gt;getCollection()
-&gt;addAttributeToSelect(&quot;color&quot;)                    -&gt;addAttributeToFilter(&quot;color&quot;,&#039;15&#039;);
$collection-&gt;load();

You can work like this..</description>
		<content:encoded><![CDATA[<p>@Magento Fan</p>
<p>$collection = $model->getCollection()<br />
->addAttributeToSelect(&#8220;color&#8221;)                    ->addAttributeToFilter(&#8220;color&#8221;,&#8217;15&#8242;);<br />
$collection->load();</p>
<p>You can work like this..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magento Fan</title>
		<link>http://subesh.com.np/2009/12/options-select-multiselect-attribute-magento-attribute-code/#comment-206</link>
		<dc:creator>Magento Fan</dc:creator>
		<pubDate>Sat, 02 Jan 2010 21:40:46 +0000</pubDate>
		<guid isPermaLink="false">http://subesh.com.np/?p=148#comment-206</guid>
		<description>One more time. Really sorry. Don&#039;t know how enclose the code. Not working.

	$model = Mage::getModel(&#039;catalog/product&#039;);
	$collection = $model-&gt;getCollection();
	$collection-&gt;addAttributeToSelect(&#039;name&#039;);  //multiple select attributes fail
	$collection-&gt;load();</description>
		<content:encoded><![CDATA[<p>One more time. Really sorry. Don&#8217;t know how enclose the code. Not working.</p>
<p>	$model = Mage::getModel(&#8216;catalog/product&#8217;);<br />
	$collection = $model-&gt;getCollection();<br />
	$collection-&gt;addAttributeToSelect(&#8216;name&#8217;);  //multiple select attributes fail<br />
	$collection-&gt;load();</p>
]]></content:encoded>
	</item>
</channel>
</rss>

