Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

I am having a strange issue with the order totals. I have experimented and have discovered the following quirk in in the checkout process:

 

Here is what the total looks like when you do NOT use a coupon code:

Sub-Total: $39.17

Federal Express: $8.24

Total: $0.00

 

Here is what the total looks like when you DO use a coupon code:

Discount Coupon 7777 applied: -$2.74

Sub-Total: $39.17

Federal Express: $8.24

Total: $-2.74

 

This would cause me to believe that my total is equal to my discount. When no coupon code is entered it is $0, and when you do enter a coupon code, the total is set to the amount of the discount. (In this case, -$2.74.)

 

I have read throught this thread, but I can't see where anyone else had had the same issue. Any info would be appreciated. Thanks in advance.

 

Send me the code you have for includes/classes/order.php in an email or via a PM.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hello,

 

Great contribution, started to implement the 2.1 version, everything seemed ok, until I got to checkout and tried to apply a test coupon.

 

Getting the following error:

 

"Fatal error: Class 'discount_coupon' not found in /var/www/vhosts/craftymama.net/httpdocs/catalog/checkout_confirmation.php on line 73"

 

I double checked checkout_confirmation.php and here is what I currently have on line 73.

 

$this_coupon = new discount_coupon( tep_db_prepare_input( $HTTP_POST_VARS['coupon'] ) );

 

Is it possible that I may have made a typo on another file? Or is the error there and I'm just not seeing it?

 

If you need to see more code from the rest of the file, please let me know.

 

Most likely this is a problem with the code in includes/classes/order.php. Please send me the code you have for that file in an email or via a PM.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Yes, I have auto-return on and it does return to checkout_process.php

 

 

I'd need some debug information. On line 47/48 of checkout_process.php, please add the following code and perform a test transaction:

 

die( '<pre>'.print_r( $_SESSION, true).print_r( $order, true ).'</pre>' );

 

It should appear after this code:

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites


I'd need some debug information. On line 47/48 of checkout_process.php, please add the following code and perform a test transaction:

 

die( '<pre>'.print_r( $_SESSION, true).print_r( $order, true ).'</pre>' );

 

It should appear after this code:

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

Thanks for your continued help with this!

 

This is the information you require:-

 

Array

(

[cart] => shoppingcart Object

(

[contents] => Array

(

[1075] => Array

(

[qty] => 1

)

 

)

 

[total] => 2.99

[weight] => 9

[cartID] =>

[content_type] => physical

[total_virtual] => 2.99

[weight_virtual] => 279

)

 

[language] => english

[languages_id] => 1

[currency] => GBP

[navigation] => navigationhistory Object

(

[path] => Array

(

[0] => Array

(


=> index.php

[mode] => NONSSL

[get] => Array

(

[path] => 36_105_191

[products_id] => 1075

[prodid] => 1075

[action] => buy_now

)

 

=> Array

(

)

 

)

 

[1] => Array

(


=> checkout_process.php

[mode] => NONSSL

[get] => Array

(

)

 

=> Array

(

)

 

)

 

)

 

[snapshot] => Array

(

)

 

)

 

[shipping] => Array

(

[id] => uk1strec_uk1strec

[title] => Royal Mail (Orders processed by the next working day)

[cost] => 1.693

)

 

[customer_id] => 13

[customer_default_address_id] => 17

[customer_first_name] => Roger Smith

[customer_country_id] => 222

[customer_zone_id] => 0

[sendto] => 17

[cartID] =>

[comments] =>

[billto] => 17

[payment] => paypal_ipn

[coupon] => 8NMBV867

[cart_PayPal_IPN_ID] => -620

)

order Object

(

[info] => Array

(

[order_status] => 5

[currency] => GBP

[currency_value] => 1.00000000

[payment_method] => PayPal (Credit / Debit Cards)

[cc_type] =>

[cc_owner] =>

[cc_number] =>

[cc_expires] =>

[shipping_method] => Royal Mail (Orders processed by the next working day)

[shipping_cost] => 1.693

[subtotal] => 2.99

[tax] => 0.2963829787234

[tax_groups] => Array

(

[(incl. VAT @ 17.5%)] => 0.2963829787234

)

 

[coupon] => 8NMBV867

[applied_discount] => Array

(

[(incl. VAT @ 17.5%)] => 1

)

 

[comments] =>

[total] => 3.683

)

 

[totals] => Array

(

)

 

[products] => Array

(

[0] => Array

(

[qty] => 1

[name] => Mini Solid Brass Stencils - Full Heart

[model] => ATD-MS-205

[tax] => 17.5

[tax_description] => (incl. VAT @ 17.5%)

[price] => 2.5447

[final_price] => 2.5447

[weight] => 9.00

[id] => 1075

)

 

)

 

[customer] => Array

(

[firstname] => Roger

[lastname] => Smith

[company] => Cute'n'Crafty

[street_address] => 2 Titan Way

[suburb] =>

[city] => Lichfield

[postcode] => WS14 9TT

[state] =>

[zone_id] => 0

[country] => Array

(

[id] => 222

[title] => United Kingdom

[iso_code_2] => GB

[iso_code_3] => GBR

)

 

[format_id] => 1

[telephone] => 01543 253400

[email_address] => [email protected]

)

 

[delivery] => Array

(

[firstname] => Roger

[lastname] => Smith

[company] => Cute'n'Crafty

[street_address] => 2 Titan Way

[suburb] =>

[city] => Lichfield

[postcode] => WS14 9TT

[state] =>

[zone_id] => 0

[country] => Array

(

[id] => 222

[title] => United Kingdom

[iso_code_2] => GB

[iso_code_3] => GBR

)

 

[country_id] => 222

[format_id] => 1

)

 

[content_type] => physical

[billing] => Array

(

[firstname] => Roger

[lastname] => Smith

[company] => Cute'n'Crafty

[street_address] => 2 Titan Way

[suburb] =>

[city] => Lichfield

[postcode] => WS14 9TT

[state] =>

[zone_id] => 0

[country] => Array

(

[id] => 222

[title] => United Kingdom

[iso_code_2] => GB

[iso_code_3] => GBR

)

 

[country_id] => 222

[format_id] => 1

)

 

)

Link to comment
Share on other sites

hello,

 

i may be about to try out this contribution but i just had a little question that should be easy to answer.. i was just wondering if the discount could equal the order amount including tax & shipping and therefore give the person a free order? (so i can offer like a gift voucher for a fixed amount)..

 

thanks :)

kev.

Link to comment
Share on other sites

Hi,

 

Thanks for this contribution it works for me. However I have a couple of issues and wondered if anyone else had addresed them?

 

1. If the shopper goes back to edit their cart or credit card the discount amount "sticks" and seems not to recalculate. Is there any way to reset the coupon in the same way the credit card number is reset?

 

2. I have some items that I don't want discounted. Has anyone worked on an item flag that would exclude the item from discounting? Or is this too hard? I almost want it the other way around i.e a flag that includes only certain items.

 

Anyone got any ideas?

 

 

James

Edited by jringrose
Link to comment
Share on other sites

I read about this on some earlier posts (from June). I have installed v2.1 and made all of the changes. Everything seems to be working great except on the Confirmation page. I have created a coupon in the admin area with no issue and can enter this coupon on the Payment info page. When I go to the Conf page, the discount does not show up or get applied to the subtotal.

 

I saw some code changes in the earlier revs of the contribution and have assumed these fixes are in the current rev.

 

the oder in the module is

 

Subtotal 1

Discount 2

Shipping 3

Tax 4

Total 5

 

Not sure if I did something wrong, but any help would be great.

 

Thanks for all of the work you have done on this module. It looks great.

 

Mike

Link to comment
Share on other sites

Discount not being shown in order confirmation emails

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

Hi, thanks for a great contribution. Please could someone help with a problem I have: the discount is not shown in emails sent to the customer or the store owner. Also, The sub-total in the email does not include the discount

 

However, the discount is shown in the invoice you see in the OSC admin panel, and is correctly calculated when payment is made.

 

I'd really appreciate some help.

 

Kind regards

Peter

Link to comment
Share on other sites

Discount not being shown in order confirmation emails

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

Hi, thanks for a great contribution. Please could someone help with a problem I have: the discount is not shown in emails sent to the customer or the store owner. Also, The sub-total in the email does not include the discount

 

However, the discount is shown in the invoice you see in the OSC admin panel, and is correctly calculated when payment is made.

 

Do you have a custom email contribution installed? There are no changes this contribution makes to the email code. As far as the email code is concerned, the discount is like any other order total module (subtotal, shipping, etc). So it almost requires another contribution be interfering with how the email is created in order for this to happen.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I read about this on some earlier posts (from June). I have installed v2.1 and made all of the changes. Everything seems to be working great except on the Confirmation page. I have created a coupon in the admin area with no issue and can enter this coupon on the Payment info page. When I go to the Conf page, the discount does not show up or get applied to the subtotal.

 

I saw some code changes in the earlier revs of the contribution and have assumed these fixes are in the current rev.

 

the oder in the module is

 

Subtotal 1

Discount 2

Shipping 3

Tax 4

Total 5

 

First please verify that you have correctly installed all code on checkout_confirmation.php. Second, tell me what other contributions you have installed.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hi,

 

Thanks for this contribution it works for me. However I have a couple of issues and wondered if anyone else had addresed them?

 

1. If the shopper goes back to edit their cart or credit card the discount amount "sticks" and seems not to recalculate. Is there any way to reset the coupon in the same way the credit card number is reset?

 

2. I have some items that I don't want discounted. Has anyone worked on an item flag that would exclude the item from discounting? Or is this too hard? I almost want it the other way around i.e a flag that includes only certain items.

 

Anyone got any ideas?

James

 

 

1. Not 100% sure what you mean. If they change credit card, does the cart total change? If they edit the cart, and change the order total, then the discount should be recalculated. What other contributions do you have installed?

 

 

2. This is something that I have worked on for others, but have not yet gotten together to put up in the contributions section.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

hello,

 

i may be about to try out this contribution but i just had a little question that should be easy to answer.. i was just wondering if the discount could equal the order amount including tax & shipping and therefore give the person a free order? (so i can offer like a gift voucher for a fixed amount)..

 

thanks :)

kev.

 

If you want to use gift vouchers, then use the gift voucher contribution, also known as CCGV.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

First please verify that you have correctly installed all code on checkout_confirmation.php. Second, tell me what other contributions you have installed.

 

 

I don't have any other contributions installed as of yet. I am using a template, not the default install of OSCom.

 

I went through and made the changes to the checkout_confirmation.php page twice to make sure I didn't screw anything up. If it would help, I could email you the page from the site. I'm very NOT versed in PHP, so I barely understand the language. sorry for my ignorance.

 

thanks a lot for your help

 

Mike

Link to comment
Share on other sites

I don't have any other contributions installed as of yet. I am using a template, not the default install of OSCom.

 

I went through and made the changes to the checkout_confirmation.php page twice to make sure I didn't screw anything up. If it would help, I could email you the page from the site. I'm very NOT versed in PHP, so I barely understand the language. sorry for my ignorance.

 

Using a template is generally equivalent to seriously altering your store. You may send me the checkout_confirmation.php file for me to look at, but I'm afraid it would probably require digging through the code to find the problem.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Using a template is generally equivalent to seriously altering your store. You may send me the checkout_confirmation.php file for me to look at, but I'm afraid it would probably require digging through the code to find the problem.

 

KG,

 

I will have a friend of mine take a look at the code with me tonight. I don't want to bother you with this, unless I get desparate. Thanks for your info and all of the hard work you've put into this contribution.

 

I will let you know how I make out.

 

Mike

Link to comment
Share on other sites

Hi, first of all thank you for this great contribution. I just installed the contribution (the newest version 2.1), and I have few questions regarding this.

 

1) When I enter max order value & min order value, the max order value automatically set to the value of min order, no matter what I enter in max order value. So both value set to same amount. Anyway to fix this?

 

2) In discount coupon, the “Available” column always stays the same, even though it used up. But I think actual limit of Max Use and Available are working fine (its just not displaying right for Available column). I already tested the max use limit and its working perfectly.

 

3) What will be the date format for start date and end date?

 

 

4) Though error_message=The+coupon+code+you+have+…….. showed up in browser address bar, no message showed up in the webpage itself.

 

Thank you very much.

Link to comment
Share on other sites

HI:

 

I am having a problem where the coupon option is not showing up during the purchase process. Any ideas on why you never get the option to enter a coupob code? I made a coupon and have done a few test orders, but it doesnt show up anywhere.

 

Thanks,

shawn

If it was easy, anyone could do it!

Link to comment
Share on other sites

Hi

 

I am having the same problem. I installed 2.1 version. Everything in admin seems to work well but, when i try to buy something there is no where to put the code.

I'll wait for help.

 

Thanks

Rui Ganga - www.lizardstore.net - Loja Radical

Rui Ganga

Link to comment
Share on other sites

Hi, first of all thank you for this great contribution. I just installed the contribution (the newest version 2.1), and I have few questions regarding this.

 

1) When I enter max order value & min order value, the max order value automatically set to the value of min order, no matter what I enter in max order value. So both value set to same amount. Anyway to fix this?

 

2) In discount coupon, the “Available” column always stays the same, even though it used up. But I think actual limit of Max Use and Available are working fine (its just not displaying right for Available column). I already tested the max use limit and its working perfectly.

 

3) What will be the date format for start date and end date?

4) Though error_message=The+coupon+code+you+have+…….. showed up in browser address bar, no message showed up in the webpage itself.

 

Thank you very much.

 

1. Not sure what you mean. I can't imagine how this could happen as a bug, so please describe in more detail what you're doing. What other fields are you filling in, etc.

 

2. The available column and others display the coupon's static limits. To see remaining number available, use the reporting tool.

 

3. The date format required is pulled from your own settings in admin/includes/application_top.php.

 

4. The error messages not being displayed is almost always because you are using a template and for some reason template makers like to leave out the code that displays those errors.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I am having a problem where the coupon option is not showing up during the purchase process. Any ideas on why you never get the option to enter a coupob code? I made a coupon and have done a few test orders, but it doesnt show up anywhere.

 

 

You need to ensure that you have made the changes to checkout_payment.php as described in the install instructions. Also, the module must be set to "active" in your admin section.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

1. Not sure what you mean. I can't imagine how this could happen as a bug, so please describe in more detail what you're doing. What other fields are you filling in, etc.

 

Actually, this happen only when I enter value in fixed discount, and when I look at the following code in coupon.php, I think that’s how it suppose to work, as for fixed discount only min order value is required.

 

if( !empty( $HTTP_POST_VARS['coupons_discount_fixed'] ) && !empty( $HTTP_POST_VARS['coupons_min_order'] ) ) {

$HTTP_POST_VARS['coupons_max_order'] = $HTTP_POST_VARS['coupons_min_order'];

 

………………

 

Sorry for the confusion.

 

2. The available column and others display the coupon's static limits. To see remaining number available, use the reporting tool.

 

3. The date format required is pulled from your own settings in admin/includes/application_top.php.

 

4. The error messages not being displayed is almost always because you are using a template and for some reason template makers like to leave out the code that displays those errors.

 

Got it. I really appreciate your help. Thank you for your great work.

Edited by arya2000
Link to comment
Share on other sites

Actually, this happen only when I enter value in fixed discount, and when I look at the following code in coupon.php, I think that’s how it suppose to work, as for fixed discount only min order value is required.

 

 

This is correct for when you use a fixed discount. A fixed discount is technically still a percentage discount where the maximum amount applied is equal to the order minimum. This gives a "fixed" discount.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...