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 p
I found a solution, here it is:
First, create a new .phtml file in template/downloadable/ , I called mine downloadablelist.phtml
Then copy all of template/downloadable/customer/products/list.phtml in our new downloadablelist.phtml
This will give us a copy of the customer account my downloadable products list.
Call our block in success page :
getLayout()->createBlock('downloadable/customer_products_list')->setTemplate('downloadable/checkout/downloadablelist.phtml')->toHtml(); ?>
Now I cleaned up what I don't need from the product list. I removed the table and added a ul instead.
Next is to show only the products that are made from the last order.
getItems();
$orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
if(count($_items)):
$_group_id = Mage::helper('customer')->getCustomer()->getGroupId();
echo ''.$this->__('Downloadable products').' :
'; ?>
getPurchased()->getOrderIncrementId();
if($itemOrderId == $orderId) {?>
- htmlEscape($_item->getPurchased()->getProductName()) ?> - getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>>getLinkTitle() ?>
I changed the url the original downloadable file had to :
href="getUrl('downloadable/download/link/', array('id' => $_item->getLinkHash(), '_secure' => true)) ?>"
Thank you