Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
To many downloadable links after PayPal payment
 
Corllete Ltd
Member
 
Avatar
Total Posts:  47
Joined:  2007-11-08
Bulgaria
 

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.

Regards

Image Attachments
pp01.jpgpp02.jpgpp03.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Moderator
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Corllete Ltd
Member
 
Avatar
Total Posts:  47
Joined:  2007-11-08
Bulgaria
 

There is only one link created (I have attached a screen shot to my previews post)

Demo Store

 
Magento Community Magento Community
Magento Community
Magento Community
 
Carty
Jr. Member
 
Total Posts:  13
Joined:  2008-12-29
 

Hi Sonice,

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?

Regards,
Big C..

 
Magento Community Magento Community
Magento Community
Magento Community
 
hlang
Jr. Member
 
Total Posts:  3
Joined:  2009-01-02
 

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()) {

                    Mage
::helper('core')->copyFieldset(
                        
'downloadable_sales_copy_order',
                        
'to_downloadable',
                        
$orderItem->getOrder(),
                        
$linkPurchased
                    
);
                    
Mage::helper('core')->copyFieldset(
                        
'downloadable_sales_copy_order_item',
                        
'to_downloadable',
                        
$orderItem,
                        
$linkPurchased
                    
);
                    
$linkSectionTitle = (
                        
$product->getLinksTitle()?
                            
$product->getLinksTitle():Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE)
                    );
                    
$linkPurchased->setLinkSectionTitle($linkSectionTitle)
                        ->
save();

                
};

                foreach (
$linkIds as $linkId{
                    
if (isset($links[$linkId])) {

                        $purchasedItems 
Mage::getModel('downloadable/link_purchased_item')->getCollection()
                            ->
addFieldToFilter('purchased_id'$linkPurchased->getId())
                            ->
addFieldToFilter('link_id'$linkId);
                        if (!
$purchasedItems->getSize()) {

                            $linkPurchasedItem 
Mage::getModel('downloadable/link_purchased_item')
                                ->
setPurchasedId($linkPurchased->getId())
                                ->
setOrderItemId($orderItem->getId());

                            
Mage::helper('core')->copyFieldset(
                                
'downloadable_sales_copy_link',
                                
'to_purchased',
                                
$links[$linkId],
                                
$linkPurchasedItem
                            
);
                            
$numberOfDownloads $links[$linkId]->getNumberOfDownloads()*$orderItem->getQtyOrdered();
                            
$linkPurchasedItem->setNumberOfDownloadsBought($numberOfDownloads)
                                ->
setStatus(Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING)
                                ->
setCreatedAt($orderItem->getCreatedAt())
                                ->
setUpdatedAt($orderItem->getUpdatedAt())
                                ->
save();
                        
};
                    
}
                }
            }
        }
        
return $this;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
Carty
Jr. Member
 
Total Posts:  13
Joined:  2008-12-29
 

Thanks, can you reply to my question too please..

Regards,
Big C..

 
Magento Community Magento Community
Magento Community
Magento Community
 
hlang
Jr. Member
 
Total Posts:  3
Joined:  2009-01-02
 

Hi Carty, I actually never tried the “Check/Money order” Payment Methods with downloadable products! Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
Corllete Ltd
Member
 
Avatar
Total Posts:  47
Joined:  2007-11-08
Bulgaria
 

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.

Best Regrdas

 
Magento Community Magento Community
Magento Community
Magento Community
 
Corllete Ltd
Member
 
Avatar
Total Posts:  47
Joined:  2007-11-08
Bulgaria
 
Carty - 01 January 2009 06:53 AM

Hi Sonice,

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.
.........

You should create an invoice to change the status. I’ve tested the process with check/money order and is working good.

 
Magento Community Magento Community
Magento Community
Magento Community
 
yrick
Jr. Member
 
Total Posts:  14
Joined:  2008-03-19
Redding, CA
 

Hello all, I’ve got the same problem as SonicE with down-loadable products using PayPal. Triplicated order numbers.

The triplicate order numbers are (for me) only showing up with a PayPal purchase. Check / Money order purchase displays correctly with order number.

I haven’t tried other payment methods yet.

 
Magento Community Magento Community
Magento Community
Magento Community
 
yrick
Jr. Member
 
Total Posts:  14
Joined:  2008-03-19
Redding, CA
 

As an update, hlang suggestion/trick worked for me.

Thanks hlang!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Corllete Ltd
Member
 
Avatar
Total Posts:  47
Joined:  2007-11-08
Bulgaria
 

@hlang I’ve tested this with other payment methods and everything is working fine. It seems that this trick do the job smile. Also I’ve made some tests when the user purchase more then one link - is working too.

I’m very great full for your solution

Regards

 
Magento Community Magento Community
Magento Community
Magento Community
 
hlang
Jr. Member
 
Total Posts:  3
Joined:  2009-01-02
 
SonicE - 02 January 2009 10:55 PM

@hlang I’ve tested this with other payment methods and everything is working fine. It seems that this trick do the job smile. 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…

 
Magento Community Magento Community
Magento Community
Magento Community
 
jdk410
Member
 
Total Posts:  39
Joined:  2008-06-08
 

Has anyone been able to actually download something via the My Downloads Section or the Link in the Order email?

Anything I setup in the LINKS section of the downloadable Information (product config) does not work?

Sample link that is created:
http://www.mydomain.com/downloadable/download/linkSample/link_id/11/

The links from the Sample section do work?

Sample link that is created:
http://www.mydomain.com/downloadable/download/sample/sample_id/5/

Please share any insight - Success - trouble.  I am assuming this is working for others since there are no Posts????

Please help.

Image Attachments
downladableconfig.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Corllete Ltd
Member
 
Avatar
Total Posts:  47
Joined:  2007-11-08
Bulgaria
 
hlang - 04 January 2009 11:42 PM


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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rupen
Jr. Member
 
Total Posts:  14
Joined:  2009-01-27
 

Hi SonicE

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

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2