Be the first to know about special offers and new products for web developers and Internet business owners.
I will never share your email address with the bad boys. Period.
|
Be the first to know about special offers and new products for web developers and Internet business owners. I will never share your email address with the bad boys. Period.
The latest
Recent comments
|
How to Sell Ebooks Using Drupal
Submitted by alexis on Mon, 2006-11-06 00:49.
For more than two years Drupal has been my content management system of choice for many projects, my own and my client's. Hence, when I decided to run a site for writing about teleworking and selling my ebook for teleworkers I chose Drupal and one of its most complete modules: ecommerce. Just a few weeks after launching my new site I realized I needed a different approach for selling my ebooks and started writing my own module, I called it simply ebook. This article is the first of a two-part series. You will know what my problem was, why I decided to write a new module for Drupal, what the ebook module can do for you, how to get it and install it (yes, it's GPL baby!) and my ideas for future versions. In the second part I'll share some insights from the programming process. The Problem With EbooksFeedback from your visitors is very important for running a successful web site; however, I've learnt to take many suggestions with a grain of salt. Sometimes a visitor just tell you what he thinks would be great, quite often is just a matter of taste or the visitor has no idea of what good coding or design is. But when many of your visitors, novice Internet users and geek friends alike, start telling you that they're having problems with your site, then it's time to take a closer look and listen to the masses. The ecommerce module (actually a package composed of many modules) was originally created by Matt Westgate and is currently maintained by Gordon Heydon. These guys are two of the most active and knowledgeable drupallers around. Ecommerce is a great piece of code. It can take care of the selling, payment processing and shipping of different kinds of products. It even has its own API for adding your own features, if you know enough about Drupal development and take the time to get familiar with the main functions in the package. I was using the file module for selling my ebooks but the many complaints from my visitors made me think that maybe it wasn't the best choice. Let's see a few of the problems I had with the ecommerce package and its file module:
The first two points caused me many lost sales and incomplete registrations, the last one is important if you plan on maintaining a few sites for selling your ebooks. The simpler the better. Why a New Module?I first tried to modify the file module in ecommerce, but then I noticed I would spend too much time getting rid of things I didn't need instead of creating the features I wanted. Ecommerce's API is elegant and powerful, but it was just too much for my very simple and focused requirement. I decided to create a new module from scratch and use some ideas and code from ecommerce, specially the payment processing and secure downloading parts. Isn't open source nice? Right now the ebook module is, as every first version, far from complete, but it's working and has already sold many of my ebooks. If you can't wait for my future versions of the ebook module, play with the current one and code whatever additional functions you need. It's all yours. The FeaturesThe ebook module creates a new node type called, surprise, ebook, which adds a few fields to the basic story type: sku, file path and price. Check out the features of ebook module 1.0:
Download and InstallVersion 1.0 of the ebook module supports Drupal 4.7. I'll have a version for the all new Drupal 5.0 in just a few days. Subscribe to this site's feed to know when it's available. I'm running my sites on a Linux server with Apache and MySQL and process payments via Authorize.net (which requires an SSL certificate installed at your domain) and Paypal. The following instructions suppose you have a similar setup:
To setup a new ebook for sale on your Drupal site:
What's Next?I've created the ebook module to fulfill a very specific set of needs, my needs, but I'm sure there are many out there who have similar requirements: selling ebooks in a quick and easy way. During the development process and after a few days running on my site I've already noticed some new features that I could add, this is a list that I plan to frequently update as I release new versions:
Of course, all your suggestions are welcome. I don't have a date for new versions of the ebook module but I plan to continue working on it during all these months while I setup a couple of sites with new ebooks I'm currently working on, so, stay tuned. Behind the ScenesIn the second part of this series we'll see how the ebook module works, a few suggestions for creating your own Drupal modules and some ideas that every programmer may find useful. See you around! Update: The ebook module has been renamed to Quickfile and now is a Drupal project. Trackback URL for this post:http://www.ventanazul.com/webzine/trackback/4
|
Want to launch a online store, need a new look for your website, market your services on the Net or build a virtual community? Not a problem, let's talk about it. www.flickr.com
This is a Flickr badge showing public photos from alexisbellido. Make your own badge here.
Other Destinations |
Payment Processing Optional
I love the idea.
Can a Payment processing option be optional?
My site only uses Paypal. Can the other option be disabled?
How To Make a Payment Processor Optional
Hi Lisa, thank you for your comment. Of course, you can disable any payment processor. There are three ways of doing it:
Actually options one and two don't disable a payment processor, they just hide the link to the payment page using that processor but for practical use is the same.
Don't forget to let us know about your site if you implement the module.
Cheers!
Alexis Bellido
Documentation
Very cool. I will work on this payment option. I do have some technical question regarding ebook settings.
Directory for ebooks: Is this the full system directory starting at the root? or can I use the relative directory from the web site.
Thank You URL: This is defaulted to thankyou | I assume I need to create this page, but I don't know if it can be a generic page or if it needs to be of php type. If it is php type, what variables need to be sent?
I did a test purchase via paypal and the email link was: http://www.bbmercari.com/thankyou?txnid=2&nid=9.
Naturally since the thankyou doesn't exist the page not found error shows.
Lastly, in my test the payment was received, but the Payment status under that transaction stated pending. This may be because the thankyou page doesn't exist. I changed the payment to completed, but now I don't know how to view the transaction link as an admin. Is there a way I can do this?
I know this module is in its infancy. I LOVE IT. I just need to know how to get the transaction to fully complete and I'll start using it.
Cheers,
Lisa
Tech details
Hi again Lisa,
Yes, directory for ebooks is a full system directory, such as /home/user/ebooks.
You are right about the thank you page, you have to create it first and the ebook module will add the download link via hook_link when your transaction is completed. It can be a generic page, no special codes needed. It could be a page telling just "thank you for your purchase." I plan to pass more variables to this page later so you can show transaction details to your clients in there.
The transaction link is always of the form /url-of-thank-you-page?txnid=x&nid=y, when x is the transaction id and y is the node id assigned to your ebook. I will add an option that allows administrators to easily get this url.
You can see all transactions logged from /admin or admin/ebook/transaction.
If I'm correct you are using Paypal, right? You need to have IPN and autoreturn enabled in your Paypal account. Check that and if you don't have a Paypal Sandbox account get one, it's very useful for debugging.
Please let me know how it goes. Your feedback is very valuable to improve future versions.
Alexis Bellido
Thanks for the Support.
I've got it all put together now. Thank you for your support.
I only ran into a few other bugs. While trying to look at the transactions, a php error occurred because I'd never set up a coupon and the coupon array was invalid. To correct the issue, I had to create and activate a bogus coupon, and then I could view the transaction. On a similar note, you MUST create at least one Ebook before you can create a coupon. If you try to do that in the reverse order, a similar array error occurs during the create coupon processes.
Now that I've got it all together and in the right order, everything works quite well.
The site is www.bbmercari.com/8Secrets if you want to take a look.
I thank you so much for this module, and the support. I hope my comments help and I look forward to the next release.
Aloha,
Lisa
Cool
That's great Lisa. Thank you for pointing out those ugly bugs. Sometimes while you're creating code you forget that others won't run it in ideal situations.
I'm working on the version for Drupal 5.0 (many changes there) and then I will fix these issues and prepare for the second release.
I've just bought a license of iDevAffiliate and will include support for it on the next versions of ebook module too.
Cheers!
Alexis
Sales of non ebooks
Wanted to ask how this module might work for electronic products that are not ebooks?
How about for selling music downloads? or domains? or software?
I am looking for a simple drupal solution for doing some basic online sales without the complexity of the ecommerce module.
Do you think your solution fits the bill? Is it adaptable to other eproducts ?
Thanks for your advice (and of course the module!)
Newbie
Yes, the module can sell any digital product
Music, videos, software, photographs, any digital product that you want to provide via secure downloads.
I'm not sure about domains. You could make some changes and get rid of the secure download functions but if you plan on running a domain registration business there are more specific and complete solutions for that.
Go ahead and let us know when you have it running :)
Cheers!
Alexis Bellido
Ebook is now Quickfile
Hello, the module has been renamed to Quickfile to reflect that is capable of handling any type of files and is now listed as a Drupal project.
Alexis Bellido
Second part on this subject...
Please, I can't wait any longer :-)
Coming soon. I haven't forgotten
I'm polishing some last details and will post the second part of the article in a few days.
There's also a tutorial about converting the module from Drupal 4.7 to Drupal 5.0. Stay tuned!
Regards!
Alexis Bellido
Thankyou Page
In the readme it says to create the thankyou page, do you include the %download_url code in there as well?
I have tested several downloads but cannot figure out how to get the download link.
When I go to administer->quickfiles I see under email notifications the client email template. I never get this when I go through the whole process.
Any ideas?
thanks
steve
No, you don't need to insert %download_url
Quickfile adds the download url automatically to the thank you page.
Take a look at this issue on Drupal.org. It may help you.
Let me know.
Cheers.
Alexis Bellido
Voucher system
Hi
can you add as payment gateway the voucher system? so I can sell voucher codes and customers will use it to buy e-books.
Could you explain what you mean by voucher?
Are you talking about some kind of pre-paid code?
Alexis Bellido
Yep
Yes exactly
Good idea, pre-paid purchases for quickfiles
Thank you for the suggestion Giorgi. I'll take a look at the code and make a few improvements as soon as I get some time :)
Regards!
Alexis Bellido
Hi,I created a page
Hi,
I created a page thankyou.html (external to drupal), and the link sent in the e-mail point to http://lnx.bigmoon.org/thankyou.html?txnid=0&nid=1&method=paypal&linktype=email&method=paypal
but no link is in there... may be i didn't understand.
thankyou.html contains just text.
I now there are so many post about it, I think I read everything but still don't understand....
Sincerely,
Elio
It's not an HTML page
The thank you page is not an HTML page, it's just another node created in Drupal using the page type. Just go to create content and choose page.
Alexis Bellido
Update for 5.1
Do you have a update so this will work with 5.1? Or is there something quick I could change to make it work?
thanks
It should work as it is
I've been running QuickFile with Drupal from CVS, which is the latest version available, so it should run with 5.1.
However, I'd do a 5.1 clean installation to check if everything is in order.
Cheers.
Alexis Bellido
Quickfile directory
I set up Quickfile, and it is really fantastic. Thanks for it!
But I have some trouble getting it work. Paypal Sandbox seems to be OK, I configured the "Instant Payment Notification Preferences" as well as the "Website Payment Preferences" as suggested, and there are the completed transactions over there, I have also a download link in my site, but the link does not work, it launches at the download error page. http://www.example.com/quickfile/download/5TF70895MD5137441/10/paypal
1. Can I be sure, that the Quickfile directory has been set up correctly, when I am adding a new quickfile content, the autocomplete works in "File Path" field? I mean it lists all the file names copied to quickfile directory.
2. There are no transactions logged in my site. The Transactions page, as well as the transactions table in the database is empty. Can you give any hints what to check?
Quickfile directory
Yes, if the autocomplete list is working then you are ok with your quickfile directory setup.
If the transaction table, hence the log at Drupal, are empty, Quickfile is not inserting de transaction correctly and the download link is generating has no way of confirming it's an approved transaction.
The problem may be related to your IPN setup, if QuickFile doesn't receive a payment confirmed message via IPN it should create at least a "Paypal transaction failed" message in your log. Have you checked that? If you have that message in your log review your Sandbox and IPN setup are correct.
If you don't have anything in your log then take a look at the steps at quickfile_paypal_ipn() in quickfile.module, it's quite possible you will find the source of your problem by knowing what the code is looking for.
Alexis Bellido
Testing of quickfile_paypal_ipn()
I've taken your advise, and done some testing in quickfile_paypal_ipn(). I gathered info into a variable in the while loop starting at line 1057, and at the end I called the watchdog to store this variable into drupal's log. It shows the content in $res, the separator is "|".
HTTP/1.0 500 Error encountered | Connection: close | Content-Type: text/html | | | | | | |
Your browser sent a request this gateway didn't understand.
| |
Possible reasons:
|
|
Your browser violates the HTTP/1.1 protocol |
There's an interoperability problem between your browser and this proxy |
|
Possible solutions:
|
|
Contact your system administrator for assistance |
Contact your Zorp support for assistance |
|
Additional information:
| No 'Host:' header in request, and policy requires this. |
--------------------------------------------------------------------------------
| Page generated by Zorp on bendeguz, version 3.0.8 on Tue Feb 13 22:38:05 CET 2007. | | | |
Can you interpret this for me? Is it an issue for Drupal, for Quickfile or for my host?
Thx,
Doka
Can you open sockets?
I'm seeing a 500 there, it seems as your server can't connect to Paypal, does your hosting provider allows you to create sockets? Ask them if you can run a line like this to contact other servers from yours:
$fp = fsockopen ($paypal_host, 80, $errno, $errstr, 30);Are you doing this in Paypal's Sandbox? Did you correctly create an account there?
Alexis Bellido
Quickfile Drupal 5
Hi Again. :)
I'm trying out the Drupal 5 Version and everything is working great all the way to the final step.
Upon setting up a transaction to test, the download link was emailed to me. When I went to the link "Download your quickfile" it always fails and returns with the Error Downloading File page I set up. I've tried everything to debug this that I can think of, and the results are always the same.
I have no issue setting up the quickfile, and the file I'm using is always found during the setup process.
Do you have any suggestions?
Quickfile Drupal 5
I just posted a support request and it hasn't even been approved yet. I want to let you know that I figured out the issue. As a transaction, I set the payment as received, but not completed... therefor the download was not accepted. Once I sent the payment as completed ... well it worked perfectly!
Thanks for this great module!
Were you creating the transaction from the admin area?
Hi Lisa, you are right. If creating the transaction from the admin section you need to set it as complete manually.
When the transaction is created naturally, meaning a user is buying on your site, the transaction status is set by the payment processor.
Regards!
Alexis Bellido
HTTP 1.1 and strcmp()
It is turned out fsockopen works fine ($fp indicates no error), but according to the error log I have to use HTTP 1.1. So I changed this line in quickfile_paypal_ipn() function:
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";to this one
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";and added this one to header:
$header .= "Host: " . $paypal_host . "\r\n"; // necessary for HTTP 1.1Applying these changes, the HTTP 1.0 500 error has disappeared, but I had trouble around this line:
if (strcmp ($res, "VERIFIED") == 0) {There was the "VERIFIED" string in the message from Paypal, but the strcmp() function was not able to recognise it, and run to "INVALID". As I modified strcmp () to strstr(), it works. So now everything is OK, but I'm not sure what I have changed are correct. What you think about that?
I use Sandbox, and the account over there is OK.
Quickfile
Hi Alexis,
I would like to automatic send "the file" with email. without download link.
is this with quickfile possible?
thanks for this great program.
Best regards from Munich
Marti
Sending of file via email
Hi Marti, that's a nice idea. It's not possible in the current version but I'll try to include it in the next release. I just need to find the time between some other jobs.
Regards!
Alexis Bellido
Multiple payments
Would you consider a multiple payments option? Or is it already possible?
For instance a $100.00 ebook could be paid in 2 or 3 monthly payments or more generally a subscription to a monthly or weekly download service.
Not currently possible
I'll take a look at what's needed and see if I can include it in a future relase. No ETA yet until I get other projects completed.
Cheers!
Alexis Bellido
Disabling payment system
Thank you for creating such a wonderful module! I was wondering if it was possible to override the payment system completely and just offer the download link after a person has clicked on a link or button of some sort. I love the download system you have set up, but for some of my files, I do not wish to charge the person anything. For example, let's say I want to release a free demo of my software through your system. Would it be possible to:
1. Create a Quickfile page that has a "Download now!" button.
2. When a person clicks the button, the system creates a transaction number, skipping any sort of payment
3. The system then uses the transaction number to generate the download link as usual
4. The system then redirects the user to that download link
Is this functionality too far-fetched? Or is it already implemented and I've completely missed this wonderful feature?
Thank you for creating
Thank you for creating Quickfile alexis. It works great.
How to distribute updates with Quickfile
Hi Alexis, sounds like a great module.
How do people usually distribute updates using Quickfile? I love the simplicity of your module over ecommerce, but need to somehow make updates available to my customers.
Thank you!
sandbox doesn't work
I haven't been able to get Quickfiles to function w/ PayPal sandbox. When sandbox mode is enabled on the Quickfiles admin screen PayPal returns an error message that says there is a problem w/ the merchant's email address.
Is this a problem caused by changes at PayPal since QuickFiles was last updated or am I missing something?
Also, haven't been able to get the module to work w/ a private directory *above* the public httpdocs directory where Drupal lives. How have you configured your Apache access permissions and directory/file ownership for this to work?
Problem going from Paypal to "thankyou" page
Hi,
Great module. However there seems to be a problem - when I complete my order through Paypal, then click the button to return to thankyou page, the download link doesn't work, it's just in the form
http://www.example.co.uk/site/quickfile/download///
Something to do with the way the txnid and nid are passed? From Paypal it appears these values are passed in a POST transaction. When clicking the link from email the download works fine.
Is there any way to fix this or something you can suggest please?
Many thanks
Tom
How to have purchase path without extra coupon page?
I'd like to have the option of not having the coupon page. For example, if I have a product with no coupons, the coupon page should be skipped entirely.
I've used Google Analytics to demonstrate that the coupon page is major point of dropout. It's a boring, non-relevant page (if there is no coupon) which causes people to lose interest.
Any suggestions?
Thanks,
Chad
Quickfile Internet Explorer
I having difficulty with quickfile module within internet explorer, when I click on place order nothing seems to happen. When I use Firefox it works fine. Has anyone get quickfile module to work with internet explorer
Bravo!!!
I've been in the process of converting my little online document-selling hobby to Drupal and had problems with e-commerce module and files for anonymous purchasers.
This looks like it's a *perfect* fit! I'm 'going to download and try it out right away!
Thanks! I thought I was going to have to resort to writing this myself! :)
What about Drupal 6
Do you have any plans of upgrading this module to Drupal 6?
Plans for Drupal 6.1?
Any plans for Drupal 6.1?
Yeah, improved version on its way
I'll find the time to hack an improved version for both Drupal 5.x and Drupal 6.x quite soon.
Cheers!
Alexis Bellido
Looking forward to an improved version
Thanks Alexis - it would be great to have an improved version available soon!
Updated version as soon as possible
Hi Roger, yes, that's what I want to do. I'm working on a new ebook and I may want to launch a new site for it so I intend to find the time to improve QuickFile as soon as I can. I can't give an ETA yet, however :)
Regards!
Alexis Bellido
Post new comment