Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

I have installed this mod back last year, ver 3.32. And it was done twice. First time, there was conflit and restored db ran the the store backup. After store was stable once again I reinstalled. No more problems.

 

But today I notice there is several entries into db. I will insert an image copied from phpMyAdmin.

 

coupon.jpg

 

So may I just delete the duplicates for except on entry or remove mod completely and start over?

Share this post


Link to post
Share on other sites

What I do know, is it has something to do with the way the session id is being handled. What I don't know is which page to troubleshoot. My first thought is checkout_confirmation.php What do you have on that page above this bit of code:

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>

 

Hi Tracy, here is the code: (Thanks for your help so far)

 

 

 

<?php

/*

$Id: checkout_confirmation.php,v 1.139 2003/06/11 17:34:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

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

}

 

// if there is nothing in the customers cart, redirect them to the shopping cart page

if ($cart->count_contents() < 1) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

 

// avoid hack attempts during the checkout procedure by checking the internal cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

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

}

}

 

// if no shipping method has been selected, redirect the customer to the shipping method selection page

if (!tep_session_is_registered('shipping')) {

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

}

 

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

if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];

 

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

if (tep_not_null($HTTP_POST_VARS['comments'])) {

$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

}

//kgt - discount coupons

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

//this needs to be set before the order object is created, but we must process it after

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

//end kgt - discount coupons

 

//kgt - discount coupons

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

//this needs to be set before the order object is created, but we must process it after

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

//end kgt - discount coupons

 

//kgt - discount coupons

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

//this needs to be set before the order object is created, but we must process it after

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

//end kgt - discount coupons

 

 

// load the selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

$payment_modules->update_status();

 

if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

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

$payment_modules->pre_confirmation_check();

}

//kgt - discount coupons

if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field

$order->coupon->verify_code();

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {

if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any

if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

} else {

if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session

tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page

}

}

} else { //if the coupon field is empty, unregister the coupon from the session

if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it

tep_session_unregister('coupon');

//now check to see if we need to recalculate shipping:

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

}

}

//end kgt - discount coupons

 

//kgt - discount coupons

if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field

$order->coupon->verify_code();

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {

if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any

if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

} else {

if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session

tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page

}

}

} else { //if the coupon field is empty, unregister the coupon from the session

if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it

tep_session_unregister('coupon');

//now check to see if we need to recalculate shipping:

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

}

}

//end kgt - discount coupons

 

//kgt - discount coupons

if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field

$order->coupon->verify_code();

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {

if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any

if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

} else {

if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session

tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page

}

}

} else { //if the coupon field is empty, unregister the coupon from the session

if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it

tep_session_unregister('coupon');

//now check to see if we need to recalculate shipping:

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

}

}

//end kgt - discount coupons

 

 

// load the selected shipping module

require(DIR_WS_CLASSES . 'shipping.php');

$shipping_modules = new shipping($shipping);

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

// Stock Check

$any_out_of_stock = false;

if (STOCK_CHECK == 'true') {

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {

$any_out_of_stock = true;

}

}

// Out of Stock

if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

$breadcrumb->add(NAVBAR_TITLE_2);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

Share this post


Link to post
Share on other sites

Hi Guys, I'm not sure if my issue is because of the "Discount Coupon Codes" contribution.

 

After installation, I noticed that the standard Osc "Free Shipping For Orders Over" in ot_shipping.php

did not work anymore. I tried installing coupon module and replacing all files with a site backup I did before installation but, "Free Shipping For Orders Over" still doesn't work. It's like if the Free shipping mod did not exist anymore.

 

Can any body can shed some light on this issue? I've spent a hole day trying to figure it out and NOTHING...

 

Please someone HELP! :(

 

Thanks,

Ronnie

Share this post


Link to post
Share on other sites

Hi Everyone!

I am hoping to get a better idea as to why this install isn't working. I have unzipped and correctly uploaded the files and hit the install button in the admin. It didn't register as installed in the admin, but installed the databases. I tried uploading the files again (making sure I didn't accidentally click 'no' at some point) and ran the sql manually. It still isn't working. :( I am running on PHP 4.4.7 and osC v.2.2rc2a.

 

The tab for discount coupons is showing up in modules > order total. It is not in Catalog.

 

Any help would be greatly appreciated.

 

Thanks,

Sarah

Share this post


Link to post
Share on other sites

I haven't gone through the entire code - but my first question is why is this code repeated 3 times rather than just being on the page once?

//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons 

//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons 

//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons 

 

You need to use a file comparison tool and compare your files with the files downloaded in the contribution package.

 

Hi Tracy, here is the code: (Thanks for your help so far)

 

 

 

<?php

/*

$Id: checkout_confirmation.php,v 1.139 2003/06/11 17:34:53 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

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

}

 

// if there is nothing in the customers cart, redirect them to the shopping cart page

if ($cart->count_contents() < 1) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

 

// avoid hack attempts during the checkout procedure by checking the internal cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

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

}

}

 

// if no shipping method has been selected, redirect the customer to the shipping method selection page

if (!tep_session_is_registered('shipping')) {

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

}

 

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

if (isset($HTTP_POST_VARS['payment'])) $payment = $HTTP_POST_VARS['payment'];

 

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

if (tep_not_null($HTTP_POST_VARS['comments'])) {

$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

}

//kgt - discount coupons

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

//this needs to be set before the order object is created, but we must process it after

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

//end kgt - discount coupons

 

//kgt - discount coupons

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

//this needs to be set before the order object is created, but we must process it after

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

//end kgt - discount coupons

 

//kgt - discount coupons

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

//this needs to be set before the order object is created, but we must process it after

$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);

//end kgt - discount coupons

 

 

// load the selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

$payment_modules->update_status();

 

if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

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

$payment_modules->pre_confirmation_check();

}

//kgt - discount coupons

if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field

$order->coupon->verify_code();

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {

if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any

if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

} else {

if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session

tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page

}

}

} else { //if the coupon field is empty, unregister the coupon from the session

if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it

tep_session_unregister('coupon');

//now check to see if we need to recalculate shipping:

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

}

}

//end kgt - discount coupons

 

//kgt - discount coupons

if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field

$order->coupon->verify_code();

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {

if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any

if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

} else {

if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session

tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page

}

}

} else { //if the coupon field is empty, unregister the coupon from the session

if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it

tep_session_unregister('coupon');

//now check to see if we need to recalculate shipping:

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

}

}

//end kgt - discount coupons

 

//kgt - discount coupons

if( tep_not_null( $coupon ) && is_object( $order->coupon ) ) { //if they have entered something in the coupon field

$order->coupon->verify_code();

if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG != 'true' ) {

if( !$order->coupon->is_errors() ) { //if we have passed all tests (no error message), make sure we still meet free shipping requirements, if any

if( $order->coupon->is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

} else {

if( tep_session_is_registered('coupon') ) tep_session_unregister('coupon'); //remove the coupon from the session

tep_redirect( tep_href_link( FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode( implode( ' ', $order->coupon->get_messages() ) ), 'SSL' ) ); //redirect to the payment page

}

}

} else { //if the coupon field is empty, unregister the coupon from the session

if( tep_session_is_registered('coupon') ) { //we had a coupon entered before, so we need to unregister it

tep_session_unregister('coupon');

//now check to see if we need to recalculate shipping:

require_once( DIR_WS_CLASSES.'discount_coupon.php' );

if( discount_coupon::is_recalc_shipping() ) tep_redirect( tep_href_link( FILENAME_CHECKOUT_SHIPPING, 'error_message=' . urlencode( ENTRY_DISCOUNT_COUPON_SHIPPING_CALC_ERROR ), 'SSL' ) ); //redirect to the shipping page to reselect the shipping method

}

}

//end kgt - discount coupons

 

 

// load the selected shipping module

require(DIR_WS_CLASSES . 'shipping.php');

$shipping_modules = new shipping($shipping);

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

// Stock Check

$any_out_of_stock = false;

if (STOCK_CHECK == 'true') {

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {

$any_out_of_stock = true;

}

}

// Out of Stock

if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

$breadcrumb->add(NAVBAR_TITLE_2);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>


~Tracy
 

Share this post


Link to post
Share on other sites

I believe there is an add-on contribution for using DCC with Free Shipping mods - check the contribution page.

 

Hi Guys, I'm not sure if my issue is because of the "Discount Coupon Codes" contribution.

 

After installation, I noticed that the standard Osc "Free Shipping For Orders Over" in ot_shipping.php

did not work anymore. I tried installing coupon module and replacing all files with a site backup I did before installation but, "Free Shipping For Orders Over" still doesn't work. It's like if the Free shipping mod did not exist anymore.

 

Can any body can shed some light on this issue? I've spent a hole day trying to figure it out and NOTHING...

 

Please someone HELP! :(

 

Thanks,

Ronnie


~Tracy
 

Share this post


Link to post
Share on other sites

Have you tried running a file comparison tool to make sure there were no missed or misplaced bits of code during install?

 

Have you double checked your database to make sure all of the tables and configuration settings were setup correctly and not duplicated?

 

Hi Everyone!

I am hoping to get a better idea as to why this install isn't working. I have unzipped and correctly uploaded the files and hit the install button in the admin. It didn't register as installed in the admin, but installed the databases. I tried uploading the files again (making sure I didn't accidentally click 'no' at some point) and ran the sql manually. It still isn't working. :( I am running on PHP 4.4.7 and osC v.2.2rc2a.

 

The tab for discount coupons is showing up in modules > order total. It is not in Catalog.

 

Any help would be greatly appreciated.

 

Thanks,

Sarah


~Tracy
 

Share this post


Link to post
Share on other sites

Hello lovely helpers!

 

 

 

OK, got it working except for two questions...

 

 

 

(i)

 

If I have £20 in my cart, a discount with a Min.Order of £21.70 will still be applied.

A discount with a Min.Order of £21.71 will not be applied.

 

If I have £40 in my cart, a discount with a Min.Order of £43.40 will still be applied.

A discount with a Min.Order of £43.41 will not be applied.

 

Where is this 8.5% discrepancy coming from?

 

I have removed any Order Tax in Admin > Modules > Order Total.

 

 

 

(ii)

 

Any percentage discount is applied before tax, can I have it after tax? If a cart contains £20 including tax, I want a 10% discount to mean £2 off, to avoid looking dishonest to customers.

 

 

 

Thanks for any help!

Share this post


Link to post
Share on other sites

I believe there is an add-on contribution for using DCC with Free Shipping mods - check the contribution page.

 

Thanks Tracy,

I managed to srip the code off ot_shipping.php and implemented it to table.php.

While it was not ment to be this was, It works now.

 

Thanks again....

Share this post


Link to post
Share on other sites

Hi

 

I've installed the contrib (3.34, 9th July) and it seems to work but when I'm at checkout_confirmation and navigate away to change the postage, I have to retype the discount code in again. If I go to the shopping cart (Edit Items link)from checkout_confirmation, change nothing then pick "continue shopping" the discount text disappears from the confirmation page.

 

I'm sure I've seen this bug mentioned but I can't find it or any solution.

 

Hope someone can help

 

Ian

Can no one help with this???

 

After more testing (and looking at the screen - where the error is displayed in the URL)it seems, if I navigate away from the checkout confirmation page to change something, the coupon is entered into the discount_coupons_to_orders table along with the order_id there and then.

 

Even if no mods are made, I have to enter the discount code again on checkout_payment and that's when I get the error in the URL

 

http://localhost/checkout_payment.php?error_message=Our+records+show+that+you+have+used+this+coupon+1+time%28s%29.++You+may+not+use+this+code+more+than+1+time%28s%29.&osCsid=smcrcbkplkceig30kukikjk7k2

 

The problem is, I haven't yet used to coupon. All I have done is navigate away from the checkout confirmation to change something.

 

Hope that makes more sense

 

Please, please can someone help me out

 

cheers

 

Ian

Share this post


Link to post
Share on other sites

That's you and me both then mate. <_<

 

I wish I knew how to hold the coupon code field so I could tell you, and you could tell me about my 8.5% discrepancy and the possibility of discount after tax. Two blind untouchables helping each other across the street.

 

Ho hum.

 

I imagine your problem might relate to the field needing to clear when someone tries to use an invalid coupon? Too green to offer more than that. You mught be able to sniff out the bit of code that does that and get rid of it.

 

.

Edited by MattReid

Share this post


Link to post
Share on other sites

Can no one help with this???

 

After more testing (and looking at the screen - where the error is displayed in the URL)it seems, if I navigate away from the checkout confirmation page to change something, the coupon is entered into the discount_coupons_to_orders table along with the order_id there and then.

 

Even if no mods are made, I have to enter the discount code again on checkout_payment and that's when I get the error in the URL

 

http://localhost/checkout_payment.php?error_message=Our+records+show+that+you+have+used+this+coupon+1+time%28s%29.++You+may+not+use+this+code+more+than+1+time%28s%29.&osCsid=smcrcbkplkceig30kukikjk7k2

 

The problem is, I haven't yet used to coupon. All I have done is navigate away from the checkout confirmation to change something.

 

Hope that makes more sense

 

Please, please can someone help me out

 

cheers

 

Ian

Yeah, I feel invisible. And just to proove I'm not a vampire, I have an answer. This is for Harleyreb too. While I have been waiting, I did some more testing and reading of posts, all day today. A few posts back, someone complained about all the bug fixes and that there isn't one overall install of DCC that works. In repying, TracyS mentioned a couple of "good" DCC installs that should be OK (I think thats what she said). So, I installed KGT "DCC version 3.0" from 24th April 2007 and I couldn't get anything to fail with a DEFAULT install of osc. No extra addons, just overwrote default files from this contrib.

 

So I installed the same on my development site and as soon as I picked Paypal, it crashed. I'm pretty sure I'm using the same version as Harleyreb. I also have the cheque payment installed. I installed COD just so I can flick between different payment modules and it's only Paypal that crashes. It writes the current order number and the coupon name to the database there and then like I said in my post above. That's why you get the duplicate error.

 

So, back to trawling through the list of bug fixes on the contrib page. I found "Paypal IPN w/ Discount Coupons Updated" by Nimz 7th Jan 2008. I replaced the original with the file in this contrib and hey presto. No more crashes. :D I gave it a good test, deleting & adding to the cart, changing payment methods, different addresses etc and no crashes. I still have to re-enter the coupon code tho

 

I haven't tested it live yet and I haven't installed a later version of DCC so I can't say if it's the paypal ipn or DCC but it works local

 

 

Here's to me and mines a pint next time we meet

 

 

Ian

Share this post


Link to post
Share on other sites

Glad to hear the older version worked for you. I do know if you use Paypal you have to install the Paypal add-on for DCC. We've never used paypal though, so I don't know anything more than the fact it is a needed add-on.

 

Typically, if you aren't getting an answer on the forum, it's because nobody knows the answer. I have not used the updated versions and therefore have not experienced the difficulties with them in order to know how to fix them.

 

For MattReid, I don't know how to do PHP Math - never had to. I do know the check_coupons_min_order function is in catalog/includes/classes/discount_coupon.php - dunno if that helps you any though.

 

Yeah, I feel invisible. And just to proove I'm not a vampire, I have an answer. This is for Harleyreb too. While I have been waiting, I did some more testing and reading of posts, all day today. A few posts back, someone complained about all the bug fixes and that there isn't one overall install of DCC that works. In repying, TracyS mentioned a couple of "good" DCC installs that should be OK (I think thats what she said). So, I installed KGT "DCC version 3.0" from 24th April 2007 and I couldn't get anything to fail with a DEFAULT install of osc. No extra addons, just overwrote default files from this contrib.

 

So I installed the same on my development site and as soon as I picked Paypal, it crashed. I'm pretty sure I'm using the same version as Harleyreb. I also have the cheque payment installed. I installed COD just so I can flick between different payment modules and it's only Paypal that crashes. It writes the current order number and the coupon name to the database there and then like I said in my post above. That's why you get the duplicate error.

 

So, back to trawling through the list of bug fixes on the contrib page. I found "Paypal IPN w/ Discount Coupons Updated" by Nimz 7th Jan 2008. I replaced the original with the file in this contrib and hey presto. No more crashes. :D I gave it a good test, deleting & adding to the cart, changing payment methods, different addresses etc and no crashes. I still have to re-enter the coupon code tho

 

I haven't tested it live yet and I haven't installed a later version of DCC so I can't say if it's the paypal ipn or DCC but it works local

 

 

Here's to me and mines a pint next time we meet

 

 

Ian


~Tracy
 

Share this post


Link to post
Share on other sites
For MattReid, I don't know how to do PHP Math - never had to. I do know the check_coupons_min_order function is in catalog/includes/classes/discount_coupon.php - dunno if that helps you any though.

Thanks very much for the lead, I'll go snoop around some PHP tutorials and see if I can counter my discrepancy in the file you mention. It's a bit 'sticking plaster', but hey. B)

 

 

.

Edited by MattReid

Share this post


Link to post
Share on other sites

Hey, ok, so I've been a bit dumb. My two questions back there are one and the same issue aren't they? Not only is the discount applied pre-tax, but the minimum order value is compared pre-tax also! Doh!

 

 

I don't know how shop discounts work in the rest of the world, but I'm used to them applying to the Gross price to the customer. I've never seen a sign, "25% OFF! (the pre-tax price)", and an offer never has a minimum order value (pre-tax). The only price the customer knows is the one in the window, which includes tax, and he/she will expect any percentage discount to apply to that figure, and any minimum order value also to apply to that figure, that figure being the actual selling price of what they have in their shopping cart.

 

 

I can't believe this point's never been raised before. It probably has and I'm an idiot. I'll look again. Through all 139 pages of this thread.

Edited by MattReid

Share this post


Link to post
Share on other sites

Matt - start with dbl checking the contribution download page to see if this has been setup as an add-on already.

 

For searching this thread - don't manually go through all the pages, let Google do the work for you like this:

 

site:forums.oscommerce.com "Discount Coupon Codes" +tax

 

Copy and paste the above line into Google and see what you get - it allows you to search only on this site, sentences in quotation marks must be found with all those words in that exact order (rather than anything with any one of those words) and + means it must also include whatever follows the +

 

Hey, ok, so I've been a bit dumb. My two questions back there are one and the same issue aren't they? Not only is the discount applied pre-tax, but the minimum order value is compared pre-tax also! Doh!

 

 

I don't know how shop discounts work in the rest of the world, but I'm used to them applying to the Gross price to the customer. I've never seen a sign, "25% OFF! (the pre-tax price)", and an offer never has a minimum order value (pre-tax). The only price the customer knows is the one in the window, which includes tax, and he/she will expect any percentage discount to apply to that figure, and any minimum order value also to apply to that figure, that figure being the actual selling price of what they have in their shopping cart.

 

 

I can't believe this point's never been raised before. It probably has and I'm an idiot. I'll look again. Through all 139 pages of this thread.


~Tracy
 

Share this post


Link to post
Share on other sites

I installed dc_autoinstaller_2.14_2_1 and then uninstalled it, now I am unable to access my admin page. I am getting:

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

 

--------------------------------------------------------------------------------

 

Apache/2.2.9 (Debian) Server at www.ghostrc.co.uk Port 80

Edited by djzipper

Share this post


Link to post
Share on other sites

I am having this same problem. Were you able to figure it out?

 

 

I added this contribution, added the sql in to the database

 

I see it in the admin>customers>coupons

 

then I go to the modules > order total and nothing is there.

 

I went to the online store and entered the code, didn't give me an error but it didn't apply it.

 

I went back and added the php files again just to make sure I didn't mess up and it is still doing it.

Share this post


Link to post
Share on other sites

Hi

 

I have added this contribution. But I have a problem with Paypal Express Checkout.

If i click the paypal checkout button it goes to paypal and then it bypasses the checkout_payment.php (where the discount code input is) and goes directly to order confirmation page. Therefore The customer cannot added the discount code and the discount is not used. However if i go throught the Oscom checkout the discount can be used.

 

 

Is there a solution to this?

Share this post


Link to post
Share on other sites

Hello everyone

 

I installed the contribution correctly. But it breaks entire page.

I managed to fix it, but when I get the box for discount and I write the good discount-code and the I click on the button process, dont work the discount, the price is the same, with or without the code.

 

Thanks in advance!

 

Best regards.

 

Mikel.

Edited by Mikel Garces

Share this post


Link to post
Share on other sites

I haven't gone through the entire code - but my first question is why is this code repeated 3 times rather than just being on the page once?

//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons 

//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons 

//kgt - discount coupons
if (!tep_session_is_registered('coupon')) tep_session_register('coupon');
//this needs to be set before the order object is created, but we must process it after
$coupon = tep_db_prepare_input($HTTP_POST_VARS['coupon']);
//end kgt - discount coupons 

 

You need to use a file comparison tool and compare your files with the files downloaded in the contribution package.

 

Hello!

 

I have the same problem. Everything works fine, but when someone entered a wrong code, the script jumps to login.php, without any error message.. For test I have overwrite my files "checkout_confirmation.php", "checkout_payment.php" and "checkout_process.php" with the files in the contribution, but the error is still there... And I think I know where the error is. My Shop works with session-ids in the url. And that session-id changes when someone is on the checkout_payment.php and entered a wrong code when it jumps to login.php... And idea how to fix that?

 

 

 

All the best

Peer

Edited by Erdpeer

Share this post


Link to post
Share on other sites

just installed this contribution which is awesome thank you!!!

 

but id like the error message that apears at the top of the screen to say its not a valid code to aprear just above the coupon box in red or yellow if thats possible, can anyone help please?

 

and is it also possible to change the colour of the text where on the confirmation page it says Dicount code 'xxx' used:-

 

 

thank you if you can help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×