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

Allow instant download of Digital Products (i.e. force set status to ‘available’)
 
dwilson
Jr. Member
 
Total Posts:  2
Joined:  2008-10-26
 

Wanted my users to be able to download their digital goods right away rather than have their order placed into ‘pending’ status so hacked the code a tad t make it work, seems fine so pending further testing, your millage may vary :D

go to: /app/code/core/Mage/Downloadable/Model and open Observer.php
There are two things to change:

One

at about line 104

->setStatus(Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING)

change to:

->setStatus(Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE)

Two

at about line 151

if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED{
            $status 
Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_PENDING;
        
elseif ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED
            
|| $order->getState() == Mage_Sales_Model_Order::STATE_CLOSED{
            $status 
Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED;
        
elseif ($order->getStatus() == $orderStatusToEnable{
            $status 
Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE;
        
}

change to:

if ($order->getState() == Mage_Sales_Model_Order::STATE_CANCELED
            
|| $order->getState() == Mage_Sales_Model_Order::STATE_CLOSED{
            $status 
Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_EXPIRED;
        
elseif ($order->getStatus() == $orderStatusToEnable{
            $status 
Mage_Downloadable_Model_Link_Purchased_Item::LINK_STATUS_AVAILABLE;
        
}

Save the file and try it out, seems to work fine - please test further before going into production but as far as I can tell this will get me into production with a digital delivery service.

Hope it helps

Happy new year!

 
Magento Community Magento Community
Magento Community
Magento Community
 
skippybosco
Enthusiast
 
Avatar
Total Posts:  796
Joined:  2008-10-03
 

Hi dwilson,

Thank you for sharing this.

Were you finding that when your customers were purchasing digital products and completing payment that it was staying in the pending status?

I would have assumed that completing a normal payment would move the order into complete status and the link would be available?

If this is not the case, how would anyone ever sell digital products and get the link to show as available without this hack?

Skippy

 
Magento Community Magento Community
Magento Community
Magento Community
 
lbrean
Member
 
Total Posts:  31
Joined:  2008-12-10
 

I’m just running a test install and haven’t set up a payment option other than check/money order yet. However, with check/money order, the download section states “processing” until you go into magento, send the customer an invoice for the order, and then mark the invoice as paid. Once the invoice is marked as paid, the download becomes available to the customer.

I’ll run a test using regular paypal in the next day or two and post what happens unless someone else does first.

 
Magento Community Magento Community
Magento Community
Magento Community
 
978bobs
Member
 
Total Posts:  44
Joined:  2009-01-11
 

Try out the following from the Admin

SYSTEM / CONFIGURATION / CATALOG / DOWNLOADABLE PRODUCTS OPTIONS

From here there is a setting for ORDER STATUS TO ENABLE DOWNLOADS

You can choose the status choices.... PENDING, PROCESSING, COMPLETE, CLOSED, CANCELLED, ON-HOLD

I haven’t had a chance to test this out, but I would assume that by choosing “Pending” all payment types would trigger immediate ability to donwload.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rise Creative Group
Jr. Member
 
Total Posts:  4
Joined:  2009-01-11
 

Setting your digital products to be available when the order is pending would be great...if it actually worked. Anyone having trouble with this setting?

Thanks!

Stephan

 
Magento Community Magento Community
Magento Community
Magento Community
 
bensykes
Jr. Member
 
Total Posts:  4
Joined:  2009-01-07
 

I would just say one thing to avoid problems with upgrades by overriding the class in Local rather than Core:

Create a directory called /app/code/local/Mage/Downloadable/Model
Copy /app/code/core/Mage/Downloadable/Model/Observer.php to /app/code/local/Mage/Downloadable/Model/Observer.php

Then carry out the changes in that file rather than the core file. Then when Magento upgrades at least you won’t have to re-hack the file. Of course if the other dependent classes change too much with an upgrade you will have to re-solve the problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bensykes
Jr. Member
 
Total Posts:  4
Joined:  2009-01-07
 

Oh, and the “pending” bug should be fixed in 1.2.1 according to the developers (bug 9895 i think it was)

 
Magento Community Magento Community
Magento Community
Magento Community
 
StuGotz
Jr. Member
 
Total Posts:  3
Joined:  2009-03-31
 

This was working for me....

You can choose the status choices.... PENDING, PROCESSING, COMPLETE, CLOSED, CANCELLED, ON-HOLD

However for some reason I have lost all the order status choices except PENDING… (so when the order goes to COMPLETE the customer’s order DOES NOT show up in their My Downloadable Products !!!

Somehow, somewhere either I or the system cut out all these choices.  I can’t figure out how to re-estibalish them without reloading the entire package…

 
Magento Community Magento Community
Magento Community
Magento Community
 
stereoscott
Jr. Member
 
Avatar
Total Posts:  17
Joined:  2009-03-18
New York, NY
 
StuGotz - 08 April 2009 08:41 AM

This was working for me....

You can choose the status choices.... PENDING, PROCESSING, COMPLETE, CLOSED, CANCELLED, ON-HOLD

However for some reason I have lost all the order status choices except PENDING… (so when the order goes to COMPLETE the customer’s order DOES NOT show up in their My Downloadable Products !!!


Somehow, somewhere either I or the system cut out all these choices.  I can’t figure out how to re-estibalish them without reloading the entire package…

Stu, I thought the same thing but then I hunted down where those option choices were getting populated, and it’s not from the database but they are coded in the the app/code/core/Mage/Downloadable/Model/System/Config/Source/Orderitemstatus.php file. In this file I only see these this, implying these are the only two options to activate the downloads.

class Mage_Downloadable_Model_System_Config_Source_Orderitemstatus
{
    
public function toOptionArray()
    
{
        
return array(
            array(
                
'value' => Mage_Sales_Model_Order_Item::STATUS_PENDING,
                
'label' => Mage::helper('downloadable')->__('Pending')
            ),
            array(
                
'value' => Mage_Sales_Model_Order_Item::STATUS_INVOICED,
                
'label' => Mage::helper('downloadable')->__('Invoiced')
            )
        );
    
}
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
StuGotz
Jr. Member
 
Total Posts:  3
Joined:  2009-03-31
 

Scott—Thanks for your post!!

I had it set to PENDING and then tried Invoiced and the link became active.  Lots of trial and error but at least I can get Downloadable files configured and I was able to test it.  I would prefer COMPLETE as the sole status for downloading a file that needs to be paid for.  I will try adding that as an option and checking some of the other info on this post.  I prefer not to do these edits as upgrades become problematic..!!  But then again that’s what backups are for smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
lividinstruments
Member
 
Total Posts:  64
Joined:  2008-10-03
 

Ok what seems to happen is after you make that change all NEW orders will be affected, not previous orders. Works now on new orders.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lividinstruments
Member
 
Total Posts:  64
Joined:  2008-10-03
 

I am still having problems with Paypal Direct payments, it doesn’t show anything as downloadable when the customer returns, but works fine with website payments pro? Anyone?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top