Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Installation Guide - osC Paypal IPN 1.1 + Downloads Controller 5.3 - on fresh osC MS2.2


AlexStudio

Recommended Posts

this might help

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_CATALOG', '/srv/www/vhosts/mydomain.com/httpdocs/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'src/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

 

in the src folder I have all the files

 

pub folder is empty

 

hope to hear from you soon

Link to comment
Share on other sites

To find out the reason you got a blank download page, here is a simple debug code:

 

in catalog/download.php (060817 update release) find:

  if (!tep_session_is_registered('customer_id')) die;

// Check download.php was called with proper GET parameters
 if ((isset($HTTP_GET_VARS['order']) && !is_numeric($HTTP_GET_VARS['order'])) || (isset($HTTP_GET_VARS['id']) && !is_numeric($HTTP_GET_VARS['id'])) ) {
die;
 }

// Check that order_id, customer_id and filename match
 $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$HTTP_GET_VARS['order'] . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$HTTP_GET_VARS['id'] . "' and opd.orders_products_filename != ''");
 if (!tep_db_num_rows($downloads_query)) die;
 $downloads = tep_db_fetch_array($downloads_query);
// MySQL 3.22 does not have INTERVAL
 list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);
 $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);

// Die if time expired (maxdays = 0 means no time limit)
 if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) die;
// Die if remaining count is <=0
 if ($downloads['download_count'] <= 0) die;
// Die if file is not there
 if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die;

If you modified this file (for DC 5.3), just try to locate each die; statement.

change to:

  if (!tep_session_is_registered('customer_id')) die("Not logged in!");

// Check download.php was called with proper GET parameters
 if ((isset($HTTP_GET_VARS['order']) && !is_numeric($HTTP_GET_VARS['order'])) || (isset($HTTP_GET_VARS['id']) && !is_numeric($HTTP_GET_VARS['id'])) ) {
die("Invalid GET parameters!");
 }

// Check that order_id, customer_id and filename match
 $downloads_query = tep_db_query("select date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . $customer_id . "' and o.orders_id = '" . (int)$HTTP_GET_VARS['order'] . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_download_id = '" . (int)$HTTP_GET_VARS['id'] . "' and opd.orders_products_filename != ''");
 if (!tep_db_num_rows($downloads_query)) die("Failed to query the filename from database!");
 $downloads = tep_db_fetch_array($downloads_query);
// MySQL 3.22 does not have INTERVAL
 list($dt_year, $dt_month, $dt_day) = explode('-', $downloads['date_purchased_day']);
 $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads['download_maxdays'], $dt_year);

// Die if time expired (maxdays = 0 means no time limit)
 if (($downloads['download_maxdays'] != 0) && ($download_timestamp <= time())) die("Download Expired!");
// Die if remaining count is <=0
 if ($downloads['download_count'] <= 0) die("No download count remains!");
// Die if file is not there
 if (!file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'])) die("Download file not found!");

Then try to download again, you'll find out what's going wrong. Don't forget to restore the original download.php before you go live. These debugging code would be hints for hackers to steal your file.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Hi Alex,

 

thanks for that.

 

after clicking the download link in user account I get following

 

Invalid GET parameters

 

 

 

the browser is pointing to

 

http://www.mydomain.com/download.php/order/16/id/pub/.rnxsxtqyxciftpsly/pp0121.pdf

 

 

 

 

the download file is located at http://www.mydomain.com/src/pp0121.pdf

 

hope this makes sence to you, looks to me as if I have to move the download file to a new folder

 

could you clear it up please ?

 

many thanks in advance

Link to comment
Share on other sites

What SEO mod you're using? The GET parameters probably are modified by your SEO mod and failed the download.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

hi, i have added the files and folders in as required, however when i go to payment modules in my admin i get the following error....Fatal error: Cannot redeclare class paypal_ipn in /home/deansyme/public_html/shop/includes/modules/payment/paypal_ipn.php on line 13[/b]

what does it mean and how can i fix it?

many Thanks

Dean

 

- <?php

/*

$Id: paypal_ipn.php,v 2.1.0.0 13/01/2007 16:30:28 Edith Karnitsch Exp $

 

Copyright © 2004 osCommerce

Released under the GNU General Public License

 

Original Authors: Harald Ponce de Leon, Mark Evans

Updates by PandA.nl, Navyhost, Zoeticlight, David, gravyface, AlexStudio, windfjf and Terra

 

*/

 

class paypal_ipn {

var $code, $title, $description, $enabled, $identifier;

 

// class constructor

function paypal_ipn() {

global $order;

 

$this->code = 'paypal_ipn';

$this->title = MODULE_PAYMENT_PAYPAL_IPN_TEXT_TITLE;

$this->description = MODULE_PAYMENT_PAYPAL_IPN_TEXT_DESCRIPTION;

$this->sort_order = MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER;

$this->enabled = ((MODULE_PAYMENT_PAYPAL_IPN_STATUS == 'True') ? true : false);

$this->email_footer = MODULE_PAYMENT_PAYPAL_IPN_TEXT_EMAIL_FOOTER;

$this->identifier = 'osCommerce PayPal IPN v2.1';

 

if ((int)MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID > 0) {

$this->order_status = MODULE_PAYMENT_PAYPAL_IPN_PREPARE_ORDER_STATUS_ID;

}

 

if (is_object($order)) $this->update_status();

 

if (MODULE_PAYMENT_PAYPAL_IPN_GATEWAY_SERVER == 'Live') {

$this->form_action_url = 'https://www.paypal.com/cgi-bin/webscr';

} else {

$this->form_action_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

}

}

 

// class methods

function update_status() {

global $order;

 

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_IPN_ZONE > 0) ) {

$check_flag = false;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_IPN_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

while ($check = tep_db_fetch_array($check_query)) {

if ($check['zone_id'] < 1) {

$check_flag = true;

break;

} elseif ($check['zone_id'] == $order->billing['zone_id']) {

$check_flag = true;

break;

}

}

 

if ($check_flag == false) {

$this->enabled = false;

}

}

}

the more I learn - The more i'll be able to teach!

deano

Scotland's Gift Shop

Link to comment
Share on other sites

You probably have 2 or more payment modules with the class name 'paypal_ipn' in your catalog/includes/modules/payment/ directory. If you made backups of paypal_ipn.php, don't store it in that folder.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

  • 4 weeks later...

Hi Alex

 

I have got a digital downlaod shop and everything works fine except when i try to download a FREE (0 price) music using Master Products and FREE ship & pay module, it passes everything until checkout but then the download link is missing. i set the status to Download now Available from the admin, still same and also it does not change the status and stays at Pending.

 

I hope to hear from you.

 

Many Many Thanks in advance

Link to comment
Share on other sites

You need to modify your 'zero payment' module to set order status to download now available.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Also im using Master Products and whenever the price is 0, it doesnt allow me to add the master product to the cart.

 

i really need to get this problem sorted and you the only one that can help me. i am so desperate for this solution. if you need to look at any part of the code let me know n i can post it no problem.

 

Many Many Thanks for all your support and help and i hope we also pay you back one day

Link to comment
Share on other sites

I know this is resurrecting an old post - but I had the same problem.

 

The last_modified field in the 'orders' table is already set to datetime, so I changed it instead to timestamp and the order correctly became available when the order was completed to 'Downloads now available' status.

 

Vger

a few things:

 

1. papabruin is right - the sql file is not in either of the packages mentioned in the original post/tutorial. it must be acquired through the "Download / Free Ship /Pay v5.3 MS 2.2 Farrukh Saeed 7 Aug 2003" file.

 

2. i want my customers to be able to download the file right after they have completed the paypal checkout process. for this, i had to change the `set preparing orders status` to `11 downloads now available`. the download link was still not appearing after they were returned to checkout_success.php. the expiry date for downloads was messed up (showing 19 dec 1999 or some other date in 99). the was also not available under 'my account'.

 

this was happening because the `last_modified` field in the `orders` table was NULL, and that was being used to calculate the expiry date for downloads.

 

i changed catalog/includes/modules/download.php at line 29 to:

 

$downloads_query = tep_db_query("select o.orders_status, date_format(o.date_purchased, '%Y-%m-%d') as date_purchased_day, opd.download_maxdays, op.products_name, opd.orders_products_download_id, opd.orders_products_filename, opd.download_count, opd.download_maxdays from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd where o.customers_id = '" . (int)$customer_id . "' and o.orders_status >= '" . DOWNLOADS_CONTROLLER_ORDERS_STATUS . "' and o.orders_id = '" . (int)$last_order . "' and o.orders_id = op.orders_id and op.orders_products_id = opd.orders_products_id and opd.orders_products_filename != ''");

 

this fix worked for me.

however, i think it would be more suitable to set the `last_modified` field equal to `date_purchased` at the time the order information is being saved.

Link to comment
Share on other sites

  • 4 months later...

I'm using osCommerce_PayPal_IPN_v2.3.3 and Super_Download_Shop_v1_1

 

I'm sorry to ask but I've searched through all the documentation and can't seem to find the answer to this basic question...

 

Everything is set up and when I test on a single product it is fine, I get the download button. When I 'buy' a group product of 3 files all the info is in the download area, but I don't have a download button, no way to download the files.

 

I followed instructions to create a file group, then add files to it. The files are all in a sub-folder of download folder. I added a new product to my catalog and set my new file group as it's product attribute. I left the filename blank because it's actually a group of files and I found nothing about this in the documentation. A default name was set when I inserted the product attribute.

 

Can you tell me what I am doing wrong here? How do I get the file group to download?

 

Thanks in advance!

Donna

Link to comment
Share on other sites

  • 1 month later...

I know this has been asked before, but the only answer someone provided was for when it was a case of having logged into the Paypal Sandbox with the real email rather than with the generated fake email as shown on the Paypal Developer Centre.

 

When I log in with fake information to the oscommerce site I'm testing, and select the test.zip file, and go through the process of adding it to the cart, confirming, being redirected to Paypal, entering the fake information in, clicking OK and so on, I receive the following message:

 

This invoice has already been paid. For more information, please contact the merchant.

 

I have followed the excellent instructions given by Alex_Studio. Folders and files have the correct permissions. This is a new clean installation, right at the beginning phase. The only changes are:

 

a) I've uploaded and installed the latest osC Paypal IPN contribution (latest update by Alex_Studio);

b) /catalog is renamed to /downloadshop

c) /admin is also renamed

 

(The renamed folders shouldn't be a problem, as I've edited the necessary paths in the two config.php files. I've also entered the correct URL in the IPN notification section for the fake business account in Paypal.)

 

The fake accounts have not yet been verified - I receive a "Page Not Found" whenever I click SUBMIT to complete verification. I don't know whether this might be a cause, but I can't see how it could be.

 

I hope someone can give me some ideas of where to look for what's causing this. Any help at all will be very much appreciated. Please feel free to go through the fake purchase process to check the error - the URL is www.soundbooks.com.au/downloadshop

 

Thanks in advance.

Edited by Almirena
Link to comment
Share on other sites

The problem I described has just now - weirdly - ceased. I was able a few minutes ago to complete the "payment" and download the test.zip file.

 

For those who are encountering this problem, I wonder whether it may be a Paypal glitch, or even a problem with connection. I mention this as a possibility because the computer on which I was working (not my home computer, thank goodness!) has all the CPU processing power of a constipated slug, and internet browser "pauses" are, to say the least of it, not unknown.

 

Whatever the problem was, it's now gone. I wish I had something more useful to contribute for those who have also experienced this.

Link to comment
Share on other sites

I've just added the Downloads Controller, uploaded as instructed and edited the table within phpMyAdmin after uploading the mysql file.

 

But now I find that when I go in to "purchase" (using the fake paypal info) the download, when I click onto "confirm order", the following error is generated:

 

Fatal error: Cannot redeclare tep_get_configuration_key_value() (previously declared in /home/soundboo/public_html/downloadshop/includes/functions/downloads_controller.php:13) in /home/soundboo/public_html/downloadshop/includes/functions/downloads_controller.php on line 18

 

Has anyone any ideas what is causing this? I notice someone else posted the same error, but the reply (to comment out line 18) would not actually make sense, as line 18 consists of the following:

 

}

 

The file in question - downloads_controller.php - is as follows:

 

<?php
/*

 WebMakers.com Added: Downloads Controller Functions
 NOTE: Some function may already exist in other Add-Ons I have created.

*/
?>
<?php

////
// BOF: WebMakers.com Added: configuration key value lookup
 function tep_get_configuration_key_value($lookup) {
$configuration_query_raw= tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key='" . $lookup . "'");
$configuration_query= tep_db_fetch_array($configuration_query_raw);
$lookup_value= $configuration_query['configuration_value'];
return $lookup_value;
 }
// EOF: WebMakers.com Added: configuration key value lookup

?>

Edited by Almirena
Link to comment
Share on other sites

Please check this post and the followings.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Thanks - I followed those instructions, and by the time I got to removing the following

 

// BOF: WebMakers.com Added: Downloads Controller
require(DIR_WS_FUNCTIONS . 'downloads_controller.php');
// EOF: WebMakers.com Added: Downloads Controller

 

from catalog/includes/functions/general.php, I was able to get to the next screen, which asks for Payment Information and has the CONTINUE button. But when I hit that CONTINUE button, I once again receive the error

 

Fatal error: Cannot redeclare tep_get_configuration_key_value() (previously declared in /home/soundboo/public_html/downloadshop/includes/functions/downloads_controller.php:13) in /home/soundboo/public_html/downloadshop/includes/functions/downloads_controller.php on line 18

 

I did try changing require to require_once, but that left the error occurring when I clicked CHECKOUT.

Link to comment
Share on other sites

Remove both free shipping and free payment modules came with Downloads Controller. They are for osCommerce 2.2 MS1.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

I really appreciate your patience and help, Alex.

 

I've deleted the includes/modules/shipping/freeshipper.php, includes/modules/payment/freecharger.php, and /languages/english/modules/freeshipper.php and /languages/english/modules/payment/freecharger.php.

 

Is there something else I should have removed?

 

I am still getting the error:

 

Fatal error: Cannot redeclare tep_get_configuration_key_value() (previously declared in /home/soundboo/public_html/downloadshop/includes/functions/downloads_controller.php:13) in /home/soundboo/public_html/downloadshop/includes/functions/downloads_controller.php on line 18
Edited by Almirena
Link to comment
Share on other sites

I am thinking of uninstalling oscommerce, deleting the databases, and starting from scratch using the Super Download Shop. This tep_get_configuration_key_value() error does seem to be a persistent one, hard to fix.

 

As this is a new part of an existing website, and I've been given no frantic deadline, and the installation has no real data in it, that's probably the best option! If anyone here does happen to have an inkling about what might be continuing to create this error, that would be good to hear about - but I am almost certain I'll proceed with uninstalling tomorrow morning - when it's cooler.

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I have been reading this forum and solving many problems, so thanks for this.

Now I have a doubt that I couldn't find the answer, so I decided to post it.

 

I have installed the Paypal IPN module. I wanna know if the customer could pay with paypal without creating an account at paypal. I read that is possible but when I tried in sandbox, it doesn't work. I don't know if this occured because is a sanbox account or 'cause it won't work with this module.

 

And if it is possible, how much does paypal charge to the seller or it's free? I read at paypal.com the 'optional paypal account' only works with donations, shopping car and buy now.

 

Thanks in advance, I hope someone could help me....

Link to comment
Share on other sites

You need to turn on 'PayPal account optional' in your profile setting. This PayPal IPN module is utilizing the PayPal Website Payment Standard button code, 'PayPal account optional' is supported.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Thanks Alex for your help

 

I have another question. When the client finish the pay process in paypal, I want to change the status order automatically. How can I do that? All the times that I had tested, I should go to Admin->Customers->Orders, and change the status manually.

 

Somebody know how?

Thanks in advance...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...