Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Hi all,

 

in overall this is very nice contibution. I have installed it using auto install script for DCC 3.32

 

I am suffering one problem with minimum order value and to sort it out I followed by

problem with Min Order Min Order Type: Price Total

if you use: DISPLAY_PRICE_WITH_TAX == true

Example:
- if you have in shopping cart one item: that has a price without tax: 10$ and a tax 50% that is added to the initial price and the min order is 13 it won't let use the discount coupon because it compare the initial price of the product with the min order




catalog/includes/classes/discount_coupon.php

to add the tax to the product search for function:

function total_valid_products( $products = array() )


there u will find this line:

$price = ( $products[$i]['price'] + $cart->attributes_price( $products[$i]['id'] ) ) * $products[$i]['quantity'];


replace with

if (DISPLAY_PRICE_WITH_TAX == "true"){
$product_tax = tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']);
$price = ( tep_add_tax($products[$i]['price'], $product_tax) + $cart->attributes_price( $products[$i]['id'] ) ) * $products[$i]['quantity'];

}else{
$price = ( $products[$i]['price'] + $cart->attributes_price( $products[$i]['id'] ) ) * $products[$i]['quantity'];
}

 

unfortunately after amendment it stil not working as it mean to. Has anyone got idea what shall be done to fix it?

 

Regards

che

Share this post


Link to post
Share on other sites

You will also suffer another problem:

 

I'm still wondering if there's any possibility at all that anyone would know a fix for the problem I mentioned previously....

 

 

I'm getting an error sometimes where an order can be started and then if you go back in to pay and stuff (like if you have an item saved in your shopping cart and came back a day later to buy it), the code is already in there, and when you try to submit it, the following message comes up, and there's no way to pay.

 

 

1062 - Duplicate entry 'myspace-17' for key 1

 

insert into discount_coupons_to_orders (coupons_id, orders_id) values ('myspace', '17')

 

I don't know how to fix it. Try to search "1062 Duplicate entry" and you will find that many people mention it but there is no solution.

All this because everything is messed up on this forum.

I cannot even give you a link to the original post.

 

Very nice contribution and nobody can fix the problem for long time.

I had an idea to make possible to donate for exact problem. But it is not real.

 

Stanislav

Share this post


Link to post
Share on other sites

Hi,

 

I have 1 time set in admin panel, to use the cupon, but the customer can use it more than one time.

I have PWA contribution installed, too.

This is the problem?

I want to let the customer to use just one time, the coupon.

 

please an advice.

 

There is somebody here, who implement this contribution with PWA, and works to use just one time, the coupon?

Share this post


Link to post
Share on other sites

I ran into a problem with this contrib:

I am running osc V2.2 rc2

I used the files from "ot_discount_coupon_codes_3_32" files

 

Install went fine I added all the files and updated the SQL with out a problem.

 

The problem happened when i logged out of my administration account. Going to the admin page gave me an error:

 

Not Found

The requested URL /store/admin/FILENAME_LOGIN was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at mydarkdreams.com Port 80

 

After digging around i compared my backups with the new files.

In file: filenames.php

Two parts were missing.

 

Add.
define('FILENAME_ADMINISTRATORS', 'administrators.php'); 
AND
define('FILENAME_LOGIN', 'login.php');

 

Then I got this error:

 

1146 - Table 'mywebsite_osc1.TABLE_ADMINISTRATORS' doesn't exist

select id from TABLE_ADMINISTRATORS limit 1

[TEP STOP]

 

To fix this i found my database_tables.php missing a line.

 

Add.
define('TABLE_ADMINISTRATORS', 'administrators');

 

Hope that helps.

-------

 

Looking now on the contrib page I see there were fixes for them back in 2008. Not sure why it did not make it into this version.

:/ o well.

Share this post


Link to post
Share on other sites
Can you check if you have the 3 problems mentioned by cheeroke, me and edmond1815

 

?

 

Stanislav

i can try. i will start in the morning. need a little sleep. :ph34r:

Share this post


Link to post
Share on other sites
Hi,

 

I have 1 time set in admin panel, to use the cupon, but the customer can use it more than one time.

I have PWA contribution installed, too.

This is the problem?

I want to let the customer to use just one time, the coupon.

 

please an advice.

 

There is somebody here, who implement this contribution with PWA, and works to use just one time, the coupon?

mine is also not working. i think that there is a missing SQL statement somewhere.

also i am not using the PWA.

still working on it.

Share this post


Link to post
Share on other sites

Hi,

great contrib.

 

Installed 3.32 manually and it worked OK for few times. Now it stopped showing the discount and applying it too. Nothing. Only thing I did was to manually add coupons in the discount_coupons table. And then it stoppede. All settings in Admin are OK.

Any ideas.

for tests

www.kupuvalnik.com

 

use coupon test3 for 50% off.

 

Thanks


OSC beginner

Share this post


Link to post
Share on other sites
Hi,

great contrib.

 

Installed 3.32 manually and it worked OK for few times. Now it stopped showing the discount and applying it too. Nothing. Only thing I did was to manually add coupons in the discount_coupons table. And then it stoppede. All settings in Admin are OK.

Any ideas.

for tests

www.kupuvalnik.com

 

use coupon test3 for 50% off.

 

Thanks

works for me

___________

 

 

1 x Boots 1 80.03EUR

 

test3-50% ÎÊ: -40.01EUR

Sub-Total: 40.01EUR

Flat Rate (Best Way): 2.65EUR

Total: 42.66EUR

 

 

===============================================================

 

for my problems i think i fixed part of it. the problem was that a code that was only to be used once was not stopping.

 

on my discount reports page it showed i had -5 left. (not good)

also any order using that discount i was unable to set the status (shipped/canceled/processing) the page would cut off right at the discount (does not show tax/subtotal/total)

 

The fix for me was to delete all the discounts including the testing code that came with it.

 

i made a new one and this is what happend:

The coupon code you have entered is no longer valid. Our records show that you have used this coupon 1 time(s). You may not use this code more than 1 time(s).

 

so far so good. i will try to reproduce the error to see the difference. (i should have saved the SQL record to compare)

Edited by bhirning

Share this post


Link to post
Share on other sites
Can you show me your site?

I will check if it has the "duplicate entry" problem

 

 

Stanislav

i editted the above post for an update:

 

but my site is http://mydarkdreams.com/shop/index.php

 

code:RNW3XP <-----dead use EFC5Z8

$5.00 off total

Edited by bhirning

Share this post


Link to post
Share on other sites

I am using v 3.33 and it works fine but want to have it work with One Page Checkout

 

The problem is that the coupon is applied when the continue button is clicked and user taken to the next page.

 

With OnepageCheckout the user will need to click a submit button that will refresh and apply the discount. The onepagecheckout is compatible with another coupon contribution so there is already a submit button but I need help coding it to work with discount coupon code.

 

Can someone please help?

 

Thanks

Share this post


Link to post
Share on other sites

The Auto installer is not the problem

 

I have just tested the bhirning's site (manual installation of 3.32)

it doesn't have the "duplicate entry" error

and I was not able to use the coupon code second time

 

Then I have installed 3.32 with auto installer on my host

there is no "duplicate entry" error for me

and I cannot use the same coupon twice

 

I can give a link in PM if somebody is interested

 

So! the Discount Coupon Codes 3.32 is good version

 

Use the Autoinstaller first. Then Check your site.

If It doesn't work correctly click the "Uninstall" button and install the contribution manually.

 

You can also send me the backup directory I will try to improve the regular expression patterns.

 

Stanislav

Share this post


Link to post
Share on other sites

Hi friends,

 

i have been days and days looking for a solution, but i didnt find it yet. I need some help please!

 

I have DCC 3.32 and Paypal Express Checkout, and they dont work together, any idea??

 

Thanks!!

Share this post


Link to post
Share on other sites

sorry for the short post from above, I will explain what is the problem i have with DCC 3.32 and Paypal Express Checkout:

 

DCC works fine with my other payment methods (bank transfer and credit card) the problem is only with paypal EC. When I'm on checkout_payment.php (after checkout_shipping.php), I check paypal method and I introduce the Coupon code, then I click continue and I'm redirected to paypal. I login in paypal, select a credit card and click continue, then I'm redirected to checkout_confirmation.php where I can see that there is not discount applied. Why?.

 

Observations: If after that, I go back to method payment, introduce the discount code and click continue again, I'm sent to checkout_confirmation.php without passing through paypal, because I'm already logged in paypal, and then the discount is shown and applied ok.

 

I installed DCC 3.32 and 3.33 some times in differents stores. Also I have installed in a clean store, and it also doesnt work. Any expert has an idea? i need some help...

Thanks to all,

Share this post


Link to post
Share on other sites
Hi great mod but when i went to uninstall this is has now messed up the moduls page in admin Order Total

 

MODULE_ORDER_TOTAL_DISCOUNT_COUPON_TITLE

 

is this there i reuploaded my orig file but its still there i get error

 

Warning: include/includes/languages/english/modules/order_total/ot_discount_coupon.php) [function.include]: failed to open stream: No such file or directory in admin/modules.php on line 128

 

Warning: include() [function.include]: Failed opening /includes/languages/english/modules/order_total/ot_discount_coupon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/lib/php/Zend:/usr/local/src/ZendFramework-1.0.3/library') in /home/thedat24/public_html/admin/modules.php on line 128

 

at the top how can i get rid of all this please ?

 

Thank you

 

 

 

I believe you forgot to upload your language file :)

 

make sure you put it inside the language/modules and not just modules

 

I was looking through the helps for Contribution Discount Coupon Codes trying to find a post similar to the issue im having and this one looks close but somewhat different. Im hoping someone can point me in the right direction.

 

I followed the install steps on my existing (still in devoplement) store and it appears to have installed ok.

 

However I am getting some warning errors on the Admin pages.

 

The errors read:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /hsphere/local/home/kevins/giftworldclub.com/admin/includes/filenames.php:61) in /hsphere/local/home/kevins/giftworldclub.com/admin/includes/functions/sessions.php on line 67

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /hsphere/local/home/kevins/giftworldclub.com/admin/includes/filenames.php:61) in /hsphere/local/home/kevins/giftworldclub.com/admin/includes/functions/sessions.php on line 67

 

I have included the code from both files below. Thanks in advance! Kevin

 

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

 

<?php

/*

$Id: sessions.php,v 1.19 2003/07/02 22:10:34 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

if (STORE_SESSIONS == 'mysql') {

if (!$SESS_LIFE = get_cfg_var('session.gc_maxlifetime')) {

$SESS_LIFE = 1440;

}

 

function _sess_open($save_path, $session_name) {

return true;

}

 

function _sess_close() {

return true;

}

 

function _sess_read($key) {

$value_query = tep_db_query("select value from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "' and expiry > '" . time() . "'");

$value = tep_db_fetch_array($value_query);

 

if (isset($value['value'])) {

return $value['value'];

}

 

return false;

}

 

function _sess_write($key, $val) {

global $SESS_LIFE;

 

$expiry = time() + $SESS_LIFE;

$value = $val;

 

$check_query = tep_db_query("select count(*) as total from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");

$check = tep_db_fetch_array($check_query);

 

if ($check['total'] > 0) {

return tep_db_query("update " . TABLE_SESSIONS . " set expiry = '" . tep_db_input($expiry) . "', value = '" . tep_db_input($value) . "' where sesskey = '" . tep_db_input($key) . "'");

} else {

return tep_db_query("insert into " . TABLE_SESSIONS . " values ('" . tep_db_input($key) . "', '" . tep_db_input($expiry) . "', '" . tep_db_input($value) . "')");

}

}

 

function _sess_destroy($key) {

return tep_db_query("delete from " . TABLE_SESSIONS . " where sesskey = '" . tep_db_input($key) . "'");

}

 

function _sess_gc($maxlifetime) {

tep_db_query("delete from " . TABLE_SESSIONS . " where expiry < '" . time() . "'");

 

return true;

}

 

session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');

}

 

function tep_session_start() {

global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS;

 

$sane_session_id = true;

 

if (isset($HTTP_GET_VARS[tep_session_name()])) {

if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_GET_VARS[tep_session_name()]) == false) {

unset($HTTP_GET_VARS[tep_session_name()]);

 

$sane_session_id = false;

}

} elseif (isset($HTTP_POST_VARS[tep_session_name()])) {

if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_POST_VARS[tep_session_name()]) == false) {

unset($HTTP_POST_VARS[tep_session_name()]);

 

$sane_session_id = false;

}

} elseif (isset($HTTP_COOKIE_VARS[tep_session_name()])) {

if (preg_match('/^[a-zA-Z0-9]+$/', $HTTP_COOKIE_VARS[tep_session_name()]) == false) {

$session_data = session_get_cookie_params();

 

setcookie(tep_session_name(), '', time()-42000, $session_data['path'], $session_data['domain']);

 

$sane_session_id = false;

}

}

 

if ($sane_session_id == false) {

tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));

}

 

return session_start();

}

 

function tep_session_register($variable) {

global $session_started;

 

if ($session_started == true) {

return session_register($variable);

} else {

return false;

}

}

 

function tep_session_is_registered($variable) {

return session_is_registered($variable);

}

 

function tep_session_unregister($variable) {

return session_unregister($variable);

}

 

function tep_session_id($sessid = '') {

if (!empty($sessid)) {

return session_id($sessid);

} else {

return session_id();

}

}

 

function tep_session_name($name = '') {

if (!empty($name)) {

return session_name($name);

} else {

return session_name();

}

}

 

function tep_session_close() {

if (PHP_VERSION >= '4.0.4') {

return session_write_close();

} elseif (function_exists('session_close')) {

return session_close();

}

}

 

function tep_session_destroy() {

return session_destroy();

}

 

function tep_session_save_path($path = '') {

if (!empty($path)) {

return session_save_path($path);

} else {

return session_save_path();

}

}

 

function tep_session_recreate() {

if (PHP_VERSION >= 4.1) {

$session_backup = $_SESSION;

 

unset($_COOKIE[tep_session_name()]);

 

tep_session_destroy();

 

if (STORE_SESSIONS == 'mysql') {

session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');

}

 

tep_session_start();

 

$_SESSION = $session_backup;

unset($session_backup);

}

}

?>

 

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 

<?php

/*

$Id: filenames.php,v 1.4 2003/06/11 17:38:00 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// define the filenames used in the project

define('FILENAME_ACCOUNT', 'account.php');

define('FILENAME_ACCOUNT_EDIT', 'account_edit.php');

define('FILENAME_ACCOUNT_HISTORY', 'account_history.php');

define('FILENAME_ACCOUNT_HISTORY_INFO', 'account_history_info.php');

define('FILENAME_ACCOUNT_NEWSLETTERS', 'account_newsletters.php');

define('FILENAME_ACCOUNT_NOTIFICATIONS', 'account_notifications.php');

define('FILENAME_ACCOUNT_PASSWORD', 'account_password.php');

define('FILENAME_ADDRESS_BOOK', 'address_book.php');

define('FILENAME_ADDRESS_BOOK_PROCESS', 'address_book_process.php');

define('FILENAME_ADVANCED_SEARCH', 'advanced_search.php');

define('FILENAME_ADVANCED_SEARCH_RESULT', 'advanced_search_result.php');

define('FILENAME_ALSO_PURCHASED_PRODUCTS', 'also_purchased_products.php');

define('FILENAME_CHECKOUT_CONFIRMATION', 'checkout_confirmation.php');

define('FILENAME_CHECKOUT_PAYMENT', 'checkout_payment.php');

define('FILENAME_CHECKOUT_PAYMENT_ADDRESS', 'checkout_payment_address.php');

define('FILENAME_CHECKOUT_PROCESS', 'checkout_process.php');

define('FILENAME_CHECKOUT_SHIPPING', 'checkout_shipping.php');

define('FILENAME_CHECKOUT_SHIPPING_ADDRESS', 'checkout_shipping_address.php');

define('FILENAME_CHECKOUT_SUCCESS', 'checkout_success.php');

define('FILENAME_CONTACT_US', 'contact_us.php');

define('FILENAME_CONDITIONS', 'conditions.php');

define('FILENAME_COOKIE_USAGE', 'cookie_usage.php');

define('FILENAME_CREATE_ACCOUNT', 'create_account.php');

define('FILENAME_CREATE_ACCOUNT_SUCCESS', 'create_account_success.php');

define('FILENAME_DEFAULT', 'index.php');

define('FILENAME_DOWNLOAD', 'download.php');

define('FILENAME_INFO_SHOPPING_CART', 'info_shopping_cart.php');

define('FILENAME_LOGIN', 'login.php');

define('FILENAME_LOGOFF', 'logoff.php');

define('FILENAME_NEW_PRODUCTS', 'new_products.php');

define('FILENAME_PASSWORD_FORGOTTEN', 'password_forgotten.php');

define('FILENAME_POPUP_IMAGE', 'popup_image.php');

define('FILENAME_POPUP_SEARCH_HELP', 'popup_search_help.php');

define('FILENAME_PRIVACY', 'privacy.php');

define('FILENAME_PRODUCT_INFO', 'product_info.php');

define('FILENAME_PRODUCT_LISTING', 'product_listing.php');

define('FILENAME_PRODUCT_REVIEWS', 'product_reviews.php');

define('FILENAME_PRODUCT_REVIEWS_INFO', 'product_reviews_info.php');

define('FILENAME_PRODUCT_REVIEWS_WRITE', 'product_reviews_write.php');

define('FILENAME_PRODUCTS_NEW', 'products_new.php');

define('FILENAME_REDIRECT', 'redirect.php');

define('FILENAME_REVIEWS', 'reviews.php');

define('FILENAME_SHIPPING', 'shipping.php');

define('FILENAME_SHOPPING_CART', 'shopping_cart.php');

define('FILENAME_SPECIALS', 'specials.php');

define('FILENAME_SSL_CHECK', 'ssl_check.php');

define('FILENAME_TELL_A_FRIEND', 'tell_a_friend.php');

define('FILENAME_UPCOMING_PRODUCTS', 'upcoming_products.php');

?>

Edited by kevin60

Share this post


Link to post
Share on other sites

Great contribution but i keep having problem with free shipping on minimum order. When someone enters a code and if the total is below the minimum it does not redirect back to choose shipping method.

 

Here is part of code from checkout_confirmation.php

 

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

 

Any help is appreciated!

Share this post


Link to post
Share on other sites
sorry for the short post from above, I will explain what is the problem i have with DCC 3.32 and Paypal Express Checkout:

 

DCC works fine with my other payment methods (bank transfer and credit card) the problem is only with paypal EC. When I'm on checkout_payment.php (after checkout_shipping.php), I check paypal method and I introduce the Coupon code, then I click continue and I'm redirected to paypal. I login in paypal, select a credit card and click continue, then I'm redirected to checkout_confirmation.php where I can see that there is not discount applied. Why?.

 

Observations: If after that, I go back to method payment, introduce the discount code and click continue again, I'm sent to checkout_confirmation.php without passing through paypal, because I'm already logged in paypal, and then the discount is shown and applied ok.

 

I installed DCC 3.32 and 3.33 some times in differents stores. Also I have installed in a clean store, and it also doesnt work. Any expert has an idea? i need some help...

Thanks to all,

 

 

I am having the same problem. The coupon code does not appear to pass into PayPal.

Share this post


Link to post
Share on other sites

Have you tried to comment out the line:

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

 

?

 

Stanislav

Share this post


Link to post
Share on other sites
Have you tried to comment out the line:

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

 

?

 

Stanislav

 

Yeah tried that, still doesn't work. My osCommerce version 2.2 just in case.

 

Any other ideas?

 

Thank you!

Share this post


Link to post
Share on other sites
I am having the same problem. The coupon code does not appear to pass into PayPal.

 

 

The issue I was experiencing pertained to Discount Coupon Codes 3.32 and PayPal Direct Payment. When the consumer selected PayPal as their payment method, they were not presented the option to enter a discount code. I initially thought this was an issue with the cart not passing the coupon code discount to Pay Pal, but it appears to be an issue with what page the consumer is directed to after entering in their PayPal information.

 

A setting was changed in Payment Module > PayPal Direct Payment, to direct the user to the Payment page after leaving PayPal. This enables the consumer to enter the coupon code before confirming the order.

 

The setting changed was:

 

PayPal Direct Payment >

Express Checkout: Display Payment Page

If someone's checking out with Express Checkout, do you want to display the checkout_payment.php page? The payment options will be hidden. (Yes, if you have CCGV installed)

 

setting should be "True"

Share this post


Link to post
Share on other sites
Yeah tried that, still doesn't work. My osCommerce version 2.2 just in case.

 

Any other ideas?

 

Thank you!

 

I found out what the problem is, no i need to find the solution for it.

 

I have discount and free shipping contributions. Under Order Total->Shipping when i set Allow Free Shipping to true, it all works fine and takes the person back if after discount the price is below minimum, BUT

The first time a person gets to the checkout_shipping.php page they do not see other shipping options.

and when i have Allow Free Shipping set to false, then it does show all the shipping options and the free option but it doesn't take a person back to the shipping page.

 

I need to have other shipping options show along with free shipping option when available and still be able to check to the minimum amount.

 

I hope it wasn't too confusing.

 

Any ideas?

Thank you

Share this post


Link to post
Share on other sites

Hi,

 

I have installed this discount coupon contribution 3.32 and using Oscommerce version 2.2.

 

When i complete the checkout_payment.php page process (payment details and discount coupon code), the page has been moved to checkout_confirmation.php page but there is no discount details appearing in billing information part. It shows only the sub-total, shipping cost and the total values.

 

When i refresh the page, the page displays the billing information with discount information.

 

If we confirm the order without refreshing the page, the billing details are properly stored in the admin's orders.php page with discount informations.

 

What is the problem? Please help me... Thanks in advance.


Vivekanandan

Share this post


Link to post
Share on other sites
Thanks! That worked like a charm. :thumbsup:

 

I may have some answers too. When I first installed this contribution I couldn't create coupons either. It had something to do with the field values not being received. I changed all insert and update values in coupons.php to $_POST[""] values and then everything worked.

 

example

 

tep_db_input($coupons_description) . "', '" .
tep_db_input($coupons_discount_percent) ."', " .

 

to

 

tep_db_input($_POST["coupons_description"]) . "', '" .
tep_db_input($_POST["coupons_discount_percent"]) ."', " .

 

Hi,

 

I have installed the discount coupon contribution 3.32 and using Oscommerce version 2.2.

 

While working on it, i met the same problem you faced. And i made the neccessary changes in contribution based on the instructions given in this forum topic.

 

Still the problem continues. If we confirm the order without refreshing the page, the billing details are properly stored in the admin's orders.php page with discount informations.

 

What is the problem? Please help me... Thanks in advance.

 

Vivek


Vivekanandan

Share this post


Link to post
Share on other sites

Hi,

 

What are you doing exactly?

 

I want the customer can yous once the coupon code.

I have PWA installed.

 

Please give me you solution to try in my site.

 

Thank you in advance,

 

Edmond

 

for my problems i think i fixed part of it. the problem was that a code that was only to be used once was not stopping.

 

on my discount reports page it showed i had -5 left. (not good)

also any order using that discount i was unable to set the status (shipped/canceled/processing) the page would cut off right at the discount (does not show tax/subtotal/total)

 

The fix for me was to delete all the discounts including the testing code that came with it.

 

i made a new one and this is what happend:

The coupon code you have entered is no longer valid. Our records show that you have used this coupon 1 time(s). You may not use this code more than 1 time(s).

 

so far so good. i will try to reproduce the error to see the difference. (i should have saved the SQL record to compare)

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

×