Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Enable free product download


Guest

Recommended Posts

Posted

Hello to all.

 

We are only accepting Paypal payments. All of our products are downloaded. So far, so good. But, now we want to let clients download certain products for free. We still want them to go thru the check-out process... But, we want the actual payment & link to Paypal bypassed if the price of the item is zero. Does anybody know how to do that?

 

I was thinking I could enable COD payment, list it as the very last payment option, and only allow it if the price is zero. Is this a good direction? Or, is there a better way? I know it's a bit kludgey. Also, I'm not a PHP expert. And, I'm not sure what variable I'd key off of to restrict the COD option from being viewable.

 

Any help would be greatly appreciated.

 

Sincere thanks.

Posted

Does anybody know how to do this?

 

It turns out that COD turns off automatically if your products are virtual. I've figured out how to defeat that... But, now i need to make it conditional based upon a zero order value.

Posted

OKAY... I've seen a few requests for this info. A number of view, but no responses. It took a while but this is my fix. Caveat emptor...

 

In a nutshell, I enable COD payment, list it as the very last payment option, and only allow it if the price is zero.

 

There are a number of important conditions to be considered...

1. My products are all downloadable. No actual shipping.

2. COD automatically disables for downloadable products.

 

I was finally able to solve the problem by modifying code in one single file:

...\includes\modules\payment\cod.php

 

Search for this code:

 

// disable the module if the order only contains virtual products

if ($this->enabled == true) {

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

$this->enabled = false;

}

}

 

and replace it with this code:

 

// disable the module if the order only contains virtual products

//MJA - 3/28/06 - Following lines are modified to ALLOW COD for orders with $0.00 price.

if ($this->enabled == true) {

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

if ($order->info['total'] > 0) {

$this->enabled = false;

}

}

}

 

Be careful with the number of }'s you replace!

 

I've tested this on my development server, and it seems to work perfectly.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...