views:

80

answers:

0

After a successfull order I would like to propose directly the downloadable URL for products buyer bought in the success.phtml file.

I wrote this piece of code to know product's values of the latest order:

// Get the latest Order ID
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
// Get every products on the latest order
$items = $order->getAllItems();

// Loop the products
foreach ($items as $item){
    $product = Mage::getModel('catalog/product')->setStoreId($order->getStoreId())->load($item->getProductId());
    // HERE I NEED FUNCTION TO GET DOWNLOADABLE URL LINK
}