title: Getting products from an order in Magento
body: <p>In my magento project, under My Account > My Orders (logged on customer), I am able to view the order details along with the products I ordered. Now, for each of the ordered product, I'd like to retrieve a specific attribute however, from my understanding, the code snippet at the beginning of <code>sales/order/items/renderer/default.phtml</code> which is <code>$_item = $this-&gt;getItem();</code> is the order itself so if I use something like <code>$_item-&gt;getId()</code>, I'm getting the order id and not the product's.</p>
  
  <p>I tried researching and ended up with this code:</p>
  
  <pre><code>$orders = Mage::getModel('sales/order')-&gt;load($_item-&gt;getId());
  foreach($orders as $order):
      $is = $order-&gt;getAllItems();
      foreach($is as $i):
          echo $i-&gt;getProductId();
      endforeach;
  endforeach;
  </code></pre>
  
  <p>Hoping I could use the product id to get the other attributes of the said product however, I 'm getting an error with this code with no way of telling what the error is. I've also tried something like this:</p>
  
  <pre><code> $_productCollection = Mage::getResourceModel('reports/product_collection')
                          -&gt;addAttributeToSelect('*')
                          -&gt;addAttributeToFilter('name', $name);
  
                      foreach($_productCollection as $_product):
                          $_temp = $_product-&gt;getResource()-&gt;getAttribute('name_en')-&gt;getFrontend()-&gt;getValue($_product);
                      endforeach;
  </code></pre>
  
  <p>But I keep getting 0 when I try to check the count of items in the product collection. How can I retrieve a custom attribute for the product in this page?</p>