Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Super Download Store


AlexStudio

Recommended Posts

Hi Alex,

 

You helped me once before with the GZIP turned off. I installed the OSCommerce Paypal IPN V2.2 contribution, and that worked perfectly. Then I installed the Super Downloads Shop V1.1 and that worked perfectly by itself. Unfortunately the two didn't work together, I wasn't getting redirected back to my website for the download. I read this whole thread and found the modifications to the catalog/includes/modules/payment/paypal_ipn.php. Now I get sent back to my website from Paypal automatically, but there is no link.

 

1. Installed paypal IPN

2. Installed Super Download Shop

3. Modified paypal_ipn.php

4. Permissions for Download folder are set to 777

5. Order status' are set correctly (I think)

Pending 9

Delivered 4

Preparing [PayPal IPN] 3

Download Now Available 11

Updated 12

6. PayPal updates the order status to Download Now Available when you return to the website

7. On the checkout success page I get the item description, the expiry date and the max number of downloads, but no link.

8. If I use the Credit Card Module with the 4111111111111111 the links work fine.

 

In a nutshell, I still don't understand what is wrong. I'm not a coder by any means, but I am trying to learn as much as I can. My store is for digital products only and I need to use Paypal so that I know I actually have the money before they can download. Any help would be greatly appreciated.

 

Thank you for your time and the great contribution!

 

Liz

Link to comment
Share on other sites

You probably missed one line in the paypal_ipn.php.

 

Find in catalog/includes/modules/payment/paypal_ipn.php (osCommerce PayPal IPN v2.2 by Terra):

		  $sql_data_array = array('customers_id' => $customer_id,
							  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
							  'customers_company' => $order->customer['company'],
							  'customers_street_address' => $order->customer['street_address'],
							  'customers_suburb' => $order->customer['suburb'],
							  'customers_city' => $order->customer['city'],
							  'customers_postcode' => $order->customer['postcode'],
							  'customers_state' => $order->customer['state'],
							  'customers_country' => $order->customer['country']['title'],
							  'customers_telephone' => $order->customer['telephone'],
							  'customers_email_address' => $order->customer['email_address'],
							  'customers_address_format_id' => $order->customer['format_id'],
							  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
							  'delivery_company' => $order->delivery['company'],
							  'delivery_street_address' => $order->delivery['street_address'],
							  'delivery_suburb' => $order->delivery['suburb'],
							  'delivery_city' => $order->delivery['city'],
							  'delivery_postcode' => $order->delivery['postcode'],
							  'delivery_state' => $order->delivery['state'],
							  'delivery_country' => $order->delivery['country']['title'],
							  'delivery_address_format_id' => $order->delivery['format_id'],
							  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
							  'billing_company' => $order->billing['company'],
							  'billing_street_address' => $order->billing['street_address'],
							  'billing_suburb' => $order->billing['suburb'],
							  'billing_city' => $order->billing['city'],
							  'billing_postcode' => $order->billing['postcode'],
							  'billing_state' => $order->billing['state'],
							  'billing_country' => $order->billing['country']['title'],
							  'billing_address_format_id' => $order->billing['format_id'],
							  'payment_method' => $order->info['payment_method'],
							  'cc_type' => $order->info['cc_type'],
							  'cc_owner' => $order->info['cc_owner'],
							  'cc_number' => $order->info['cc_number'],
							  'cc_expires' => $order->info['cc_expires'],
							  'date_purchased' => 'now()',
							  'orders_status' => $order->info['order_status'],
							  'currency' => $order->info['currency'],
							  'currency_value' => $order->info['currency_value']);

Add one line and becomes:

		  $sql_data_array = array('customers_id' => $customer_id,
							  'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],
							  'customers_company' => $order->customer['company'],
							  'customers_street_address' => $order->customer['street_address'],
							  'customers_suburb' => $order->customer['suburb'],
							  'customers_city' => $order->customer['city'],
							  'customers_postcode' => $order->customer['postcode'],
							  'customers_state' => $order->customer['state'],
							  'customers_country' => $order->customer['country']['title'],
							  'customers_telephone' => $order->customer['telephone'],
							  'customers_email_address' => $order->customer['email_address'],
							  'customers_address_format_id' => $order->customer['format_id'],
							  'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],
							  'delivery_company' => $order->delivery['company'],
							  'delivery_street_address' => $order->delivery['street_address'],
							  'delivery_suburb' => $order->delivery['suburb'],
							  'delivery_city' => $order->delivery['city'],
							  'delivery_postcode' => $order->delivery['postcode'],
							  'delivery_state' => $order->delivery['state'],
							  'delivery_country' => $order->delivery['country']['title'],
							  'delivery_address_format_id' => $order->delivery['format_id'],
							  'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],
							  'billing_company' => $order->billing['company'],
							  'billing_street_address' => $order->billing['street_address'],
							  'billing_suburb' => $order->billing['suburb'],
							  'billing_city' => $order->billing['city'],
							  'billing_postcode' => $order->billing['postcode'],
							  'billing_state' => $order->billing['state'],
							  'billing_country' => $order->billing['country']['title'],
							  'billing_address_format_id' => $order->billing['format_id'],
							  'payment_method' => $order->info['payment_method'],
							  'cc_type' => $order->info['cc_type'],
							  'cc_owner' => $order->info['cc_owner'],
							  'cc_number' => $order->info['cc_number'],
							  'cc_expires' => $order->info['cc_expires'],
							  'date_purchased' => 'now()',
							  'last_modified' => 'now()',
							  'orders_status' => $order->info['order_status'],
							  'currency' => $order->info['currency'],
							  'currency_value' => $order->info['currency_value']);

I think you didn't put 'last_modified' => 'now()', into this block of the code.

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

AlexStudio,

 

This problem has nothing to do specifically with your contrib (I guess), but it's a serious problem with using OSC to sell digital downloads (with or without your contrib) as anyone can just steal your products, easily.

 

I posted about it here. I would for you to post to that thread and to hear your thoughts on it, especially if you have a fix...

 

http://www.oscommerce.com/forums/index.php?showtopic=268048

 

People on this thread would do well to check my thread out.

Link to comment
Share on other sites

If you have installed osCommerce 2.2 MS2 properly, there is a .htaccess file in the catalog/download (where you store your download files) and catalog/pub (where the symbolic links are created for 'download by redirect') folder. This .htaccess contains below commands:
AuthType Basic
AuthName "No access"
AuthUserFile .htnopasswd
AuthGroupFile /dev/null
Require valid-user

and thus protect these 2 crucial folders (no direct access allowed). If you can access these folders and see a complete file list in the browser, you probably didn't install your osCommerce correctly.

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,

i've finally sorted out the download linking using your addon :D . When you set the maximum download limit of the file, are you setting that for the customer ie if you set the download limit to 99, they can download it 99 times rather than it being for all customers ie say 1 customer downloads it 50 times, then all the other customers can only download 49 of do they get a quota of 99 too?

 

Also, when the user is redirected to the checkout_success.php page, the download link seems to apear at the very bottom of the page (just above the footer), but below the table that the confirmation detais are in, is it possible to change that, and if so, how?

 

Many thanks

James

Edited by jamesrobinson19
Link to comment
Share on other sites

i've finally sorted out the download linking using your addon :D . When you set the maximum download limit of the file, are you setting that for the customer ie if you set the download limit to 99, they can download it 99 times rather than it being for all customers ie say 1 customer downloads it 50 times, then all the other customers can only download 49 of do they get a quota of 99 too?
The max download count is how many time allowed for each customers to download the file. Usually a small number is good enough if the download works smoothly.

 

Also, when the user is redirected to the checkout_success.php page, the download link seems to apear at the very bottom of the page (just above the footer), but below the table that the confirmation detais are in, is it possible to change that, and if so, how?
In the checkout_success.php you can find:
<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

That's the code for displaying download links. You can move that line to other place in that file, but be careful with the html structure.

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

The max download count is how many time allowed for each customers to download the file. Usually a small number is good enough if the download works smoothly.

 

In the checkout_success.php you can find:

<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>

That's the code for displaying download links. You can move that line to other place in that file, but be careful with the html structure.

Awsome. Thank you very much!

Link to comment
Share on other sites

You probably missed one line in the paypal_ipn.php.

 

 

 

 

Hi Alex,

 

Thanks for the reply. That line was on the post from before (I think page 7) and I put it in with the rest of the code, but it still does not work. I went in and double checked to make sure that it was there, and it is. Can you think of anything else it might be?

 

Again, thanks for your help.

 

Liz

Link to comment
Share on other sites

Hi Alex,

 

There must be something wrong with me. I'm not sure how this happened, but somehow my brain fell asleep and I didn't publish my changes to the paypal_ipn.php file. That's why they were there, but not working. I am so sorry for wasting your time with that. Please accept my deepest apologies. As soon as I pulled my head out of my butt I saw the problem. (It's hard to see clearly when you've got your head up your ass...FYI) Thank you again for all the help. If I ever run into another problem, I'll be sure to keep my head from getting in there. I'll donate to your button thingy in the install instructions.

 

Thanks,

Liz

 

:blush:

Link to comment
Share on other sites

If you have installed osCommerce 2.2 MS2 properly, there is a .htaccess file in the catalog/download (where you store your download files) and catalog/pub (where the symbolic links are created for 'download by redirect') folder. This .htaccess contains below commands:
AuthType Basic
AuthName "No access"
AuthUserFile .htnopasswd
AuthGroupFile /dev/null
Require valid-user

and thus protect these 2 crucial folders (no direct access allowed). If you can access these folders and see a complete file list in the browser, you probably didn't install your osCommerce correctly.

 

Hi, AlexStudio. Thanks for replying.

 

I did install OSC MS2.2 properly. And if you notice in the install files, it does not contain a /catalog/temp folder. You have to create that yourself. Check the install files for yourself...

 

http://www.oscommerce.com/redirect.php/go,32

 

Therefore, there is no .htaccess file since there is not temp folder to begin with. You can install it properly or improperly all day long, but the end result is that you will never get a /catalog/temp folder or the .htaccess file within it. You have to create those yourself.

 

As for the /catalog/pub folder, it does contain an .htaccess file, but it's contents are very different than what you posted above. The contents of it are as follows...

 

Options +FollowSymLinks -Indexes

 

Now, I will try creating an .htaccess file for the catalog/temp folder with the lines you provided above, however, not sure if that will work seeing how that will require a password to access the folder. Not sure that will work for customers who have to download products they purchased, but I will try it.

 

Thanks. I'll let you know if it works out or not.

Link to comment
Share on other sites

Hi, AlexStudio. Thanks for replying.

 

I did install OSC MS2.2 properly. And if you notice in the install files, it does not contain a /catalog/temp folder. You have to create that yourself. Check the install files for yourself...

 

http://www.oscommerce.com/redirect.php/go,32

 

Therefore, there is no .htaccess file since there is not temp folder to begin with. You can install it properly or improperly all day long, but the end result is that you will never get a /catalog/temp folder or the .htaccess file within it. You have to create those yourself.

 

As for the /catalog/pub folder, it does contain an .htaccess file, but it's contents are very different than what you posted above. The contents of it are as follows...

 

Options +FollowSymLinks -Indexes

 

Now, I will try creating an .htaccess file for the catalog/temp folder with the lines you provided above, however, not sure if that will work seeing how that will require a password to access the folder. Not sure that will work for customers who have to download products they purchased, but I will try it.

 

Thanks. I'll let you know if it works out or not.

 

 

Oh my god. Very sorry! I was in a very big hurry at the time i was checking htings out and typing.

 

I was saying temp folder the whole time and I meant to say download folder. The download folder does come in the OSC package with that same HTaccess file you noted above and mine was missing somehow. Actually, now I think I remember deleting it a while ago for some reason or another. The issue is resolved.

 

Thank you, once again, for your time, AlexStudio!!!!!!!!!!!!!!

Link to comment
Share on other sites

Hi,

 

I seem to be having a different error than any described in the previous 19 pages, so I thought I would ask for some help while I continue to look over the code...

 

everything seems to be working proper, but once the customer logs in to get their download, they get a page listing the files, saying "Link expires:

Tuesday 03 July, 2007" (ie today, even though I have it set for 7 days), and "0 downloads remaining", even though it should be five. There is no download button. Any ideas why I would have this?

Link to comment
Share on other sites

Hello all,

 

I just got off the phone with my web host...again...

 

My limit is 1 minute on downloads directly from os commerce (scripted). they suggested I try download by redirect or non-scripted. Is download by redirect using FTP? If not, is there a way to use FTP (host says there's no limit there) I can't get the download by redirect to work. Right now the Super Downloads Shop works perfectly as does the PayPal IPN (Thanks Alex :thumbsup: ). Im wondering if I have to do anything differently because I now have file groups to download. I appreciate any help you can give.

 

Thank you,

Liz

Link to comment
Share on other sites

I installed the latest version of Super Download Store on a clean OSCommerce and when I run Step 4 in my browser and I get the folling error message:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mysql'@'localhost' (using password: NO) in /home/discxpre/public_html/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

Alex or anyone can you please help me solve this problem?

Link to comment
Share on other sites

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'mysql'@'localhost' (using password: NO) in /home/discxpre/public_html/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

You need to enter your database information in catalog/includes/configure.php

 

it should look something like this:

// define our database connection

define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers

define('DB_SERVER_USERNAME', 'my_stores_database_username');

define('DB_SERVER_PASSWORD', 'myspuersecretpassword');

define('DB_DATABASE', 'my_database');

define('USE_PCONNECT', 'false'); // use persistent connections?

define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

 

 

and you need to put the proper names in between the quotes. I guess you can get this information in the control panel of your webhosting company.

Link to comment
Share on other sites

First look into your database table orders_products_download and see what you got logged in there. If the download_maxdays and download_count records are good, then you have something wrong in the file catalog/includes/modules/downloads.php. If this is not the case (the records are wrong), then look into database table products_attributes_download and see what you got for each product. If the records are good, then you need to check your catalog/checkout_process.php. If the records are wrong, check your catalog/admin/products_attributes.php.

 

If there is no problem, why worry?

 

check your catalog/admin/includes/configure.php for the database settings.

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

First look into your database table orders_products_download and see what you got logged in there. If the download_maxdays and download_count records are good, then you have something wrong in the file catalog/includes/modules/downloads.php. If this is not the case (the records are wrong), then look into database table products_attributes_download and see what you got for each product. If the records are good, then you need to check your catalog/checkout_process.php. If the records are wrong, check your catalog/admin/products_attributes.php.

 

 

Hi Alex,

 

thanks for your help with this - it seems to be working now - no code problems to speak of at that end, but I don't think I was attaching the files correctly. I did follow the steps you described about though and they were very useful in trying to gain an understanding of the whole process.

 

One more thing I'm working on though - I had initiated a weight-based system to differentiate between items that need shipping and those that don't - see the thing is some of my products that I sell include a downloadable teaser - obviously still need the shipping page though. I have seen an instance of where you wrote something to also skip the shipping page - anything tricky about removing that bit of code without mucking anything else up?

Link to comment
Share on other sites

AFAIK, the order content type is decided in $cart, if the item comes with a download file, the content type will be 'virtual' and thus skip the shipping process when checking out. You need to modify the class object $cart to do what you want.

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,

 

Please disregard my post above.. I don't think your code did anything to alter this. I think I need to stop staring at the screen for a bit, I'm getting a bit confused!

 

All seems to be working fine. Thanks for the contribution and the help, Alex.

Link to comment
Share on other sites

AFAIK, the order content type is decided in $cart, if the item comes with a download file, the content type will be 'virtual' and thus skip the shipping process when checking out. You need to modify the class object $cart to do what you want.

Yes, you are right. Actually I cheated a bit. I edited checkout_shipping.php where it says:

if (($order->content_type == 'virtual') ||

($order->content_type == 'virtual_weight') ||

($total_weight == 0 ))

if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

$shipping = false;

$sendto = false;

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 

and just commented out the first two.

Link to comment
Share on other sites

well, that could do the trick, but you might not have shipping address listed in the order confirmation email because the $order->content_type still is 'virtual'.

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

well, that could do the trick, but you might not have shipping address listed in the order confirmation email because the $order->content_type still is 'virtual'.

Alex, you are clever! Indeed the shipping address is absent. I will play around with includes/classes/shopping_cart.php... perhaps I can link it to the attribute table (as "buy product and receive download" and "buy download only" would always be the defining attribute) or the weight... hmm, I think weight would be easier.

Link to comment
Share on other sites

Ok, for anyone else in the situation where you have a real product being shipped to your customer but want to give them a download with the same sale (i.e. if you sell a CD but want to give them the mp3 in the meantime) this is what seems to be working for me:

 

First of all, I used the Super Download Store, Add weight to product attributes, and Zero weight skips shipping contributions available on this site. The last mod I did was this, in includes/classes/shopping_cart.php

 

After:

 

 if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
       reset($this->contents);

 

I added:

 

if ($this->weight > 0) {
$this->content_type = 'physical';
}

 

 

Oscommerce automatically believes all products with downloads associated with them are virtual, but with these mods you can control what is "virtual" or not based on weight.

 

Alex, being the resident genius - if you see any blaring holes in my logic here let me know!

Link to comment
Share on other sites

Hello Alex,

 

I'm back again. I finally had everything working perfectly with the Super Downloads Shop and the Paypal IPN, but my webhost wouldn't allow me to download anything over 1 minute long. Long story short I moved to another webhost that doesn't have a limit like that. I already installed the Paypal IPN and that is working fine. I'm trying to install the SDS and when I was trying to run the group_file_for_download, I got an error, earlier (I think page 7) you had said to take out the ENGINE = MYISAM and run again. Still didn't work.

 

On page 13 there was someone who got the same error as me and you told them to do this

 

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ('', 'Enable Group File Download?', 'DOWNLOADS_CONTROLLER_FILEGROUP_STATUS', 'Yes', 'Do you want to enable group file for download? - Default=Yes', '13', '93', NOW(), NOW(), NULL , 'tep_cfg_select_option(array(\'Yes\', \'No\'), ');

 

ALTER TABLE `products_attributes_download` ADD `products_attributes_filegroup_id` INT( 11 ) NULL AFTER `products_attributes_filename`;

 

CREATE TABLE `products_attributes_download_groups` (

`download_group_id` INT( 11 ) NOT NULL ,

`download_group_name` VARCHAR( 255 ) NULL ,

`language_id` INT( 11 ) NOT NULL ,

PRIMARY KEY ( `download_group_id` , `language_id` )

);

 

CREATE TABLE `products_attributes_download_groups_files` (

`download_groups_file_id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,

`download_group_id` INT( 11 ) NOT NULL ,

`download_group_filename` VARCHAR( 255 ) NOT NULL

);

 

ALTER TABLE `products_attributes_download_groups_files` DROP PRIMARY KEY ,

ADD PRIMARY KEY ( `download_groups_file_id` , `download_group_id` );

 

CREATE TABLE `products_attributes_download_groups_to_files` (

`download_groups_file_id` INT( 11 ) NOT NULL ,

`language_id` INT( 11 ) NOT NULL ,

`download_group_file_description` VARCHAR( 255 ) NULL ,

PRIMARY KEY ( `download_groups_file_id` , `language_id` )

);

 

 

I did that and now I'm getting this error

 

 

 

Error

SQL query:

 

ALTER TABLE `products_attributes_download` ADD `products_attributes_filegroup_id` INT( 11 ) NULL AFTER `products_attributes_filename` ;

 

 

 

MySQL said:

 

#1060 - Duplicate column name 'products_attributes_filegroup_id'

 

 

Any ideas on what I should do now?

 

I appreciate your help

 

Thanks,

Liz

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