Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Allow free downloads of digital products?


BHopkins

Recommended Posts

I would like to have some free products and some paid products. How do I go about skipping the complete checkout (going to paypal) and allow the user to download a product at no cost?

 

Thanks

 

Brandon Hopkins

 

OSCommerce newbie

Link to comment
Share on other sites

I will give you a way to do this but it doesn't get rid of the checkout_payment page.

 

Change the price of the product to 0.00. Now open the checkout_conformation.php and find:

if (isset($$payment->form_action_url)) {

$form_action_url = $$payment->form_action_url;

} else {

$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

}

 

echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 

if (is_array($payment_modules->modules)) {

echo $payment_modules->process_button();

}

 

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";

And change it to:

$orders = (int)$order->info['total'];

if ($orders > 0) {

if (isset($$payment->form_action_url)) {

$form_action_url = $$payment->form_action_url;

} else {

$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

}

 

echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 

 

if (is_array($payment_modules->modules)) {

echo $payment_modules->process_button();

}

 

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";

 

} else {

?>

<a href="http://www.your-url.com/checkout_process.php"><img src="includes/languages/english/images/buttons/button_confirm_order.gif" border="0" alt="Checkout"></a>

<?php

}

?>

If there cart has $0 in it they will get sent to the checkout_process.php then the checkout_success.php.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

Nate, you don't know how much I appreciate the reply.

 

Upon clicking "Continue" on the checkout_payment.php page I get this error:

 

Parse error: syntax error, unexpected '}' in /home/***/public_html/***/checkout_confirmation.php on line 307

 

Line 307 is:

if ($orders > 0) {

 

Lines 305-312 just in case it helps:

<?php
 $orders = (int)$order->info['total'];
if ($orders > 0) {
if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
} else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
}

 

THanks again for the help!

Link to comment
Share on other sites

You are going to have to post more code. The code I gave you is being used on my site. Does it look like this:

<?php

 

$orders = (int)$order->info['total'];

if ($orders > 0) {

if (isset($$payment->form_action_url)) {

$form_action_url = $$payment->form_action_url;

} else {

$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

}

 

echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 

 

if (is_array($payment_modules->modules)) {

echo $payment_modules->process_button();

}

 

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";

 

} else {

?>

<a href="http://www.your_url.com/checkout_process.php"><img src="includes/languages/english/images/buttons/button_confirm_order.gif" border="0" alt="Checkout"></a>

<?php

}

?>

</td>

</tr>

</table></td>

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

You are going to have to post more code. The code I gave you is being used on my site. Does it look like this:

 

Nate, this is lines 301-319. If it's easier I'll email it over to you.

	  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td align="right" class="main">
<?php
 if (isset($$payment->form_action_url)) {
$form_action_url = $$payment->form_action_url;
 } else {
$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');
 }

 echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 if (is_array($payment_modules->modules)) {
echo $payment_modules->process_button();
 }

 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
?>

 

Thanks,

 

brandon

Link to comment
Share on other sites

I checked it again, and copied and pasted again just in case something happened.

 

I'm getting this error now.

 

Parse error: syntax error, unexpected T_VARIABLE in /home/bhopkins/public_html/freebusinesscards/checkout_confirmation.php on line 305

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...