title: Magento: list all values of a single attribute
body: <p>I'm trying to list up all the existing values of a newly created attribute in magento 1.7.0.2. 
  (and make them clickable links, so that on click they list up all of the items with the specific attribute value, but that's not a priority right now)</p>
  
  <p>The attribute code is "artist"</p>
  
  <p>So far i created the file Artist.php in app/code/core/Mage/Catalog/Block/ with the following code:</p>
  
  <pre><code>public function getAllArtists()
  {
  $product = Mage::getModel('catalog/product');
  $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
      -&gt;setEntityTypeFilter($product-&gt;getResource()-&gt;getTypeId())
      -&gt;addFieldToFilter('attribute_code', 'artist');
  $attribute = $attributes-&gt;getFirstItem()-&gt;setEntity($product-&gt;getResource());
  $artists = $attribute-&gt;getSource()-&gt;getAllOptions(false);
    return $artists;  
  }
  </code></pre>
  
  <p>and the file artist.phtml in /app/design/frontend/default/template-name/template/catalog/product with this code:</p>
  
  <pre><code> &lt;ul id="artist_list"&gt;
    &lt;?php foreach ($this-&gt;getAllArtists() as $artist): ?&gt; 
    &lt;li&gt;&lt;a href="&lt;?php Mage::getURL() ?&gt;catalogsearch/advanced/result/?&amp;artist;[]=&lt;?php echo $artist['value'] ?&gt;&amp;search;="&gt;&lt;?php echo $artist['label'] ?&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;?php endforeach; ?&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>which i then call in a static block with</p>
  
  <pre><code>{{block type="core/template" template="catalog/product/artist.phtml"}}
  </code></pre>
  
  <p>but nothing appears...</p>
  
  <p>i used the code from this thread: <a href="http://www.magentocommerce.com/boards/viewthread/19982/P0/" rel="noreferrer">http://www.magentocommerce.com/boards/viewthread/19982/P0/</a></p>
  
  <p>the attribute is set "Visible on Product View Page on Front-end"
  and i call the attribute value of each item in the ../template/product/view.phtml with </p>
  
  <pre><code>&lt;?php echo $_product-&gt;getData('artist') ?&gt; 
  </code></pre>
  
  <p>and it correctly displays the value.</p>
  
  <p>any ideas?</p>