Hi all. Finally we’ve got a version from magento witch supports downloadable products. I’ve made some test and have the following issue.
When I use PayPal Standart Payment (IPN) with sandbox after successful payment there are 3 links for downloading one product from same order. When I use Check / Money order everything is OK - there is only one link (the purchased one). Sorry for my english - please see the attached images.
When you created your downloadable product did you define 3 links (each with the same name).. post a screen shot of your “downloadable information” pane of your product.
Can you explain me with the download process, I created a product with $0 (so I shall test) and checked out with Check/Money order option.
Once the checkout is complete, the order is still “Pending” and I couldn’t change this. Can you please explain me how to change this and in my opinion, since this is a $0 (free) product, shouldnt the customer be able to download it immediately?
Hi SonicE, I had the same problem and I think the reason for it is, that the function (resp. event handler) saveDownloadableOrderItem in /shop/app/code/core/Mage/Downloadable/Model/Observer.php is invoked multiple times: Once when the order is placed (before the redirect to PayPal) and then two more times as soon as you click “Pay Now” in PayPal.
Now I couldn’t quite figure out where the function is called (resp. the event handler registered) so I tried the following changes in the function above. This worked for me, but it is only a work around until someone with a more profound knowledge fixes this problem - and I hope it’s not breaking any other stuff!
I basically inserted two if statements:
if (!$linkPurchased->load($orderItem->getId(), 'order_id')->getId()) {...}
and
$purchasedItems = Mage::getModel('downloadable/link_purchased_item')->getCollection() ->addFieldToFilter('purchased_id', $linkPurchased->getId()) ->addFieldToFilter('link_id', $linkId); if (!$purchasedItems->getSize()) {...}
in lines 72 and 92 - here is the complete code:
/** * Save data from order to purchased links * * @param Varien_Object $observer * @return Mage_Downloadable_Model_Observer */ public function saveDownloadableOrderItem($observer) { $orderItem = $observer->getEvent()->getItem(); $product = Mage::getModel('catalog/product') ->setStoreId($orderItem->getOrder()->getStoreId()) ->load($orderItem->getProductId()); if ($product->getTypeId() == Mage_Downloadable_Model_Product_Type::TYPE_DOWNLOADABLE) { $links = $product->getTypeInstance()->getLinks(); if ($linkIds = $orderItem->getProductOptionByCode('links')) { $linkPurchased = Mage::getModel('downloadable/link_purchased');
if (!$linkPurchased->load($orderItem->getId(), 'order_id')->getId()) {
Hi hlang
many thanks for your help. I’ll make some tests and will post the results. I’ve posted this issue in the bug tracker #9831 and hope that someone from magento will provide us more information about. One more time many thanks.
@hlang I’ve tested this with other payment methods and everything is working fine. It seems that this trick do the job . Also I’ve made some tests when the user purchase more then one link - is working too.
@hlang I’ve tested this with other payment methods and everything is working fine. It seems that this trick do the job . Also I’ve made some tests when the user purchase more then one link - is working too.
Hi SonicE, I just realized that in the order confirmation e-mail sent out by Magento I still get 3 links! So my little workaround above just isn’t good enough, it should really be fixed at the source…
Hi SonicE, I just realized that in the order confirmation e-mail sent out by Magento I still get 3 links! So my little workaround above just isn’t good enough, it should really be fixed at the source…
Well I have only one link in the conformation email and your fix is working very well.
I am having the same problem as jdk410. Were you able to have the product download link working frm the “My downloadable Products” section in front end?
My link is active, and I can download samples from product description page. Just that my download link does not return the file, and simply refreshes the page.
Please please let me know your settings.
thanks again