Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

I just installed the newest version. Everything works great except when i when i get to the order confirmation page, it does not show a discount. I went back and made sure i have a valid sort value and i do. So i went back in and placed another order and still no discount comes up on the confirmation. So i did it again but put in a false coupon code, still goes right to the confirmation like nothing happened still not showing any discount. So i rechecked the manual entries i made. I noticed i made a mistake on the catalog/checkout_confirmation.php entry. I didn't delete the "}" symbol from two places. So i fixed it so it was correct. Then i went to try it again and this time i got an error with shipping. It keeps going to the shipping page and telling me the shipping charges have changed. So i try to continue on to the order confirmation screen and once again it goes to the shipping page giving me the same error. Its like i am caught in a "loop". any suggestions would be great.

 

You need to restore from a backup and try re-installing.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi there, I'm new to osCommerce and the whole online store thing. This is my first post.

 

I really appreciate this contribution but I'm strugglinh with the tax total that is displayed. The correct tax is included in the total, it is just displaying a very strange amount.

xxx

Sub-Total: $759.28

Discount Coupon 1 applied: -$118.45

Shipping: $23.49

Goods & Services Tax (10%): $25.95

Total: $675.10

 

My prices include tax but I need to show the total tax on the order confirmation and invoice.

 

Total tax should be approx. $60

 

When a discount is not applied, the correct tax total is displayed.

 

I've all sorts of configuration combinations and nothing seems to set this right.

 

I'd appreciate any help.

 

Thanks

GAM

 

 

Send me an email with your debug output (see the manual for help with getting debug output) and I will try to see what's going on.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hello,

Relatively new OSCommerce user here. I want to say thanks for this contribution and the support offered on these forums. It's great! Even a novice like myself was able to setup a store and integrate some contributions. I currently have this contribution, Paypal WPP, and a Free of Charge module installed. My question/problem is this. If I have a coupon for 100% discount resulting in a price of $0, it runs into problems with Paypal as they won't process a charge of $0. Is there a way to get it to bypass paypal in the event of a coupon lowering the price to $0 and go directly to the download page (digital page)? Thanks in advance for any and all help.

Steve

 

 

That will be a change you'll want to make in the paypal module. I'm away right now, so it's not easy for me to look at it myself.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
You need to restore from a backup and try re-installing.

 

Ok, i restored and just re-installed. Everything is working this time except for the shipping charges. After i go and try to purchase someing, i put in the coupon code and and try to go to the confirmation page and it takes me back to checkout_shipping.php and says "Your calculated shipping charges have changed." This phrase is in a red box that goes accross the screen. Any other idea? I would love for this to work but i am still stuck in this shipping charges loop. If i continue on the checkout_shipping.php page, it takes me to checkout_payment.php. When i hit continue it takes me back to the checkout_shipping.php page and gives the same message. I even tried to continue without a coupon code, left it blank and it still takes me back to the checkout_shipping.php page.

Share this post


Link to post
Share on other sites

I also tried to remove it in the control panel. Even with this turned off i still get the shipping charges changed error. Could this be becuase i have only one shipping option? Please let me know if there is anything i can post that may help solve this.

Share this post


Link to post
Share on other sites

One last thing that may help out. I did install a contribution that figures out the shipping rate based on a percentage of the sale. This maybe what is causing the shipping error. Please let me know if any way to use the the percentage based shipping and the coupon contribution. The shipping percentage conrtibution can be found at http://www.oscommerce.com/community/contri...arch,percentage

Share this post


Link to post
Share on other sites

I installed the mod and it appears to be working correctly. I created a coupon for $5 off. My only problem is that it is applying the $5 off to each item, rather than the order total. Did I create the coupon incorrectly, or do I need to make a programming change somewhere?

Share this post


Link to post
Share on other sites

I have run into a problem with this contribution.

 

If a customer orders multiple quantites on the same product, it takes the discount for it and then multupies it times how many were purchased.

 

Here is an example:

 

Products

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

4 x product (xxxx) = $55.20

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

Discount Coupon SPRING applied: -$2.76

Sub-Total: $44.16

UPS Ground: $11.96

Total: $56.12

 

This coupon is for 5%.

 

It made the correct 5% discount, but it took the discount of $2.76 and multiplied it against the 4 that were ordered.

 

The sub total with discount should be $52.44 not $44.16.

 

Any ideas how to fix this?

Share this post


Link to post
Share on other sites

Ok, i havn't seen any suggestions yet so i thought i would start trying some things. Here is what i did. In catalog/checkout_confirmation.php, you are supposed to add

 

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

 

The lines

 

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

 

and

 

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

 

Seems to be giving me the problem so i added "/*" to the front and "*/" to the end of both. I believe this cancels the comments. Now it works for me. I really have no idea how to use code for this so i may have gotten rid of something important. Please let me know what I did. All i know is it works now but i want to make sure it is safe to work this way.

Edited by lil_cheeks

Share this post


Link to post
Share on other sites
Send me an email with your debug output (see the manual for help with getting debug output) and I will try to see what's going on.

Thanks KGT! I sent you an email the other day. I look forward to your response.

 

Cheers

GAM

Share this post


Link to post
Share on other sites
I have run into a problem with this contribution.

 

If a customer orders multiple quantites on the same product, it takes the discount for it and then multupies it times how many were purchased.

 

Here is an example:

 

Products

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

4 x product (xxxx) = $55.20

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

Discount Coupon SPRING applied: -$2.76

Sub-Total: $44.16

UPS Ground: $11.96

Total: $56.12

 

This coupon is for 5%.

 

It made the correct 5% discount, but it took the discount of $2.76 and multiplied it against the 4 that were ordered.

 

The sub total with discount should be $52.44 not $44.16.

 

Any ideas how to fix this?

 

Hi,

 

I have the same problem... if a customer orders 3 times a product the coupon value will also multiply with 3.

 

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

3 x test product 300.00EUR (incl tax)

 

Pickup Rate (Customer Pickup (Our Address)): 0.00EUR

Discount Coupon 87K8UT applied: -8.26EUR (excl tax)

Total: 270.00EUR

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

 

Coupon have a value 8.26 + tax = 10€. So total shoud be 290€.

 

Anyone can help us?

Share this post


Link to post
Share on other sites
Hi,

 

I have the same problem... if a customer orders 3 times a product the coupon value will also multiply with 3.

 

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

3 x test product 300.00EUR (incl tax)

 

Pickup Rate (Customer Pickup (Our Address)): 0.00EUR

Discount Coupon 87K8UT applied: -8.26EUR (excl tax)

Total: 270.00EUR

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

 

Coupon have a value 8.26 + tax = 10€. So total shoud be 290€.

 

Anyone can help us?

 

I'm having the same problem too. Others must be running into this problem also or don't know it exists until they've added multiple items and apply a percentage discount.

 

4 x whatever = 16.00

___________________

Sub-Total: $6.40

Discount Coupon OT15OFF applied: -$2.40

Table Rate (Best Way): $2.50

CA TAX 8.70%: $0.56

Total: $9.46

 

The coupon is only for 15% off...but like the others said, its muliplying the 15% of ALL to each item.

Share this post


Link to post
Share on other sites
That will be a change you'll want to make in the paypal module. I'm away right now, so it's not easy for me to look at it myself.

 

 

KGT,

 

Were you ever able to look into this? I would be interested as well.

 

Thanks!

Share this post


Link to post
Share on other sites

I never noticed the multiple discounts before either as I only use it for a discounted shipping, but I think I it's due to the fact that the discount is taken before the sub-total no matter where you place the sub-total or discount in the Orders Total module. It should actually be taken from the sub-total and that wouldn't happen.

 

I use CCGV(TRAD) along with this contrib. The CCGV takes it from the sub-total as it should if you place it after the sub-total in the sort order. I'm using the shipping option for the Coupons so it deducts for the shipping just fine, but it then removes that amount from the sub-total. Even if you use the option not to show it deducted from the sub-total it is.

 

1 - Item = 10.00

Sub-total= 10

10% discount = -0.95 CCGV(TRAD)

Shipping: 5.00

10% Shipping Discount: -0.50 (Discount coupons)

Total= 13.55

 

Above is an example of what this contrib is doing.

The discount for CCGV should be 1.00 not .95

The shipping discount is being subtracted from the sub-total.

 

I think this is how it's coded and not a bug. The multiple discounts is probably, but I think that is a result of it being forced to take before the sub-total and not from the sub-total. If taken from the sub-total it would benefit the customer which is what a coupon is for.

 

Just my two cents.


Currently running 76 contibutions.

Share this post


Link to post
Share on other sites
Above is an example of what this contrib is doing.

The discount for CCGV should be 1.00 not .95

The shipping discount is being subtracted from the sub-total.

 

Blasted edit button!

 

What I ment to say was:

 

Above is an example of what this contrib is doing.

The discount for CCGV should be 1.00 not .95

Just my opinon, but a shipping discount should not effect the sub-total, it's connected to the shipping price and not item price. Most stores apply shipping/tax after the sub-total and not before.


Currently running 76 contibutions.

Share this post


Link to post
Share on other sites

I'm still struggling with this update of the coupons...

I dont have the discount calculated in the total

 

Sub-Total: 5.00EUR

Shipping with TNT Dutch Post (Normal Shipping): 1.35EUR

Discount Coupon testTG 20.00EUR applied: -20.00EUR

Total: 6.35EUR

 

where is this calculated?

 

Cheers

Share this post


Link to post
Share on other sites

Anyone know what the lines in red do below? This coupon contribution only works if i delete these lines. If i don't i get a shipping error every time i try to check out.

 

 

catalog/checkout_confirmation.php, you are supposed to add

 

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

Share this post


Link to post
Share on other sites

Hi all,

 

Has anyone come up with this sort of bug as well?...

 

Sort order: discount before the subtotal

Display subtotal with applied discount?: true

Everything else default

 

and if any one product in my cart has a quantity of more than 1 the total amount is always wrong...

 

I got everything to work right using these setting but would like to use the above settings:

 

Sort order: subtotal before the discount

Display subtotal with applied discount?: false

Everything else default

 

I would appreciate any feedback,

Thanks in advance,

a8le


Thuan Nguyen

Share this post


Link to post
Share on other sites
Hi all,

 

Has anyone come up with this sort of bug as well?...

 

Sort order: discount before the subtotal

Display subtotal with applied discount?: true

Everything else default

 

and if any one product in my cart has a quantity of more than 1 the total amount is always wrong...

 

I got everything to work right using these setting but would like to use the above settings:

 

Sort order: subtotal before the discount

Display subtotal with applied discount?: false

Everything else default

 

I would appreciate any feedback,

 

Thanks in advance,

a8le

 

Like mentioned a couple posts up, I think this was written to take the discounts BEFORE the subtotal and not from the subtotal. I think that is why it gives the discount to each item in the cart and not the overall subtotal. It's a great contirbution, but really needs to have the ability to take the discount from either the item or subtotal of items based on where it is in the sort order and not be forced to use one method. Also the shipping discount option should not be applied to the subtotal as it is based on the amount of shipping and not subtotal, but is applied to it after being taken from the shipping. This throws off any other discounts you may have that discounts the subtotal which is supposed to be the subtotal of your items in cart.


Currently running 76 contibutions.

Share this post


Link to post
Share on other sites

What a great contribution. Easy to install and use. However, is there any way to allow multiple coupons on one order? For instance I would like to have a $30 discount and then allow a free shipping discount. I have searched the forums and cannot seem to find any mention of this issue. Thanks for any advice!

 

JP

Share this post


Link to post
Share on other sites
I just installed the newest version. Everything works great except when i when i get to the order confirmation page, it does not show a discount. I went back and made sure i have a valid sort value and i do. So i went back in and placed another order and still no discount comes up on the confirmation. So i did it again but put in a false coupon code, still goes right to the confirmation like nothing happened still not showing any discount.

 

I am having this same exact issue, the first one lil_cheeks mentions about the coupon not being applied. It was a perfect install no problems and everything seems to be working perfect no errors but after creating a coupon when you use it absolutely nothing happens. It doesn't discount on the checkout_confirmation page and it doesnt show any discount on the admin side. I have a huge feeling there is something I am missing.

 

Any ideas?

Share this post


Link to post
Share on other sites
I am having this same exact issue, the first one lil_cheeks mentions about the coupon not being applied. It was a perfect install no problems and everything seems to be working perfect no errors but after creating a coupon when you use it absolutely nothing happens. It doesn't discount on the checkout_confirmation page and it doesnt show any discount on the admin side. I have a huge feeling there is something I am missing.

 

Any ideas?

 

 

Please see the readme included in the installation zip file for help with this. If you still can get it working, post back here.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
What a great contribution. Easy to install and use. However, is there any way to allow multiple coupons on one order? For instance I would like to have a $30 discount and then allow a free shipping discount. I have searched the forums and cannot seem to find any mention of this issue. Thanks for any advice!

 

JP

 

 

No, it's limited to one coupon per order. I don't have any plans to add that in at this time.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Please see the readme included in the installation zip file for help with this. If you still can get it working, post back here.

 

Thanks for the quick response. Yes, it does have a unique sort order. Should've specified that before. I can't imagine it being something complicated seeing as how everything installed perfect with no error codes. Am i missing something here?

Share this post


Link to post
Share on other sites
Like mentioned a couple posts up, I think this was written to take the discounts BEFORE the subtotal and not from the subtotal. I think that is why it gives the discount to each item in the cart and not the overall subtotal. It's a great contirbution, but really needs to have the ability to take the discount from either the item or subtotal of items based on where it is in the sort order and not be forced to use one method. Also the shipping discount option should not be applied to the subtotal as it is based on the amount of shipping and not subtotal, but is applied to it after being taken from the shipping. This throws off any other discounts you may have that discounts the subtotal which is supposed to be the subtotal of your items in cart.

 

 

It does indeed take discounts before the subtotal and not from it. That point is made in the documentation for this contribution and several times in this very thread. The reason why has to do with how osCommerce calculates tax. You can't just take the discount from the subtotal. This would fail miserably for store owners who have multiple tax groups (think non-taxable products and taxable products in the same cart).

 

I'm not sure what you're talking about in regards to the shipping discount. I can't seem to duplicate a shipping discount being applied to the subtotal.


Contributions

 

Discount Coupon Codes

Donations

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

×