title: Adding downloadable links on success page
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2561774/how-to-get-downloadable-product-links-after-successfull-order">How to get downloadable product links after successfull order</a>  </p>
  </blockquote>
  
  
  
  <p>I wonder if it's possible to add multiple download links on Magento success page after ordering.</p>
  
  <p>I am able to get one working link to a downloadable file with this code:</p>
  
  <pre><code>$incrementId = $this-&gt;getOrderId();
  
  $linkPurchased = Mage::getModel('downloadable/link_purchased')-&gt;load($incrementId, 'order_increment_id');
  
  $downloadableItems = Mage::getResourceModel('downloadable/link_purchased_item_collection')-&gt;addFieldToFilter('purchased_id', $linkPurchased-&gt;getPurchasedId());
  foreach ($downloadableItems as $item) {
  
  $links = Mage::getModel('core/url')-&gt;getUrl('downloadable/download/link', array('id' =&gt; $item-&gt;getLinkHash(), '_secure' =&gt; true));
  echo $this-&gt;__('Download').' le &lt;a href="'.$links.'" target="_blank"&gt;file&lt;/a&gt;';
  </code></pre>
  
  <p>It gives me one perfect link on success page even if my order had multiple items.</p>
  
  <p>Problem: 
  The object in $linkPurchased have only one item.</p>
  
  <p>Why is</p>
  
  <pre><code>Mage::getModel('downloadable/link_purchased')-&gt;load($incrementId, 'order_increment_id');
  </code></pre>
  
  <p>returns only one item? </p>
  
  <p>Thank you</p>