Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

Thanks for this suggestion kgt as I too want this to work with the google checkout ipn contribution.

 

At present google just ignores the coupon. I tried this but then it returned an error in the file when reaching the google site.

 

 

I'd love to help, but without an error message I can't exactly do anything.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

For those that display prices with tax, or have a desire to display the discounted tax (either as a separate line or combined with the discount), I have uploaded a new version which will allow you to toggle how you want the discounted tax to be displayed. (Version 3.2):

 

http://www.oscommerce.com/community/contributions,4269


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'd love to help, but without an error message I can't exactly do anything.

 

Sorry there was no specific message apart from the fact that when you reached google checkout it said there was an error in the file which was changed.

Share this post


Link to post
Share on other sites
Sorry there was no specific message apart from the fact that when you reached google checkout it said there was an error in the file which was changed.

 

 

It looks like there's some debugging options in that contribution. Please see what you can find out in the way of an error message.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
It looks like there's some debugging options in that contribution. Please see what you can find out in the way of an error message.

 

Sorry could not find before but here it is:

 

Error parsing XML; message from parser is: Invalid value for body of unit-price in checkout-shopping-cart/shopping-cart/items/item: This is not a number

Warnings: XML failed to validate against the schema at line: 15, column: 15, with error: cvc-datatype-valid.1.2.1: '--4.00' is not a valid value for 'decimal'.

XML failed to validate against the schema at line: 15, column: 15, with error: cvc-complex-type.2.2: Element 'unit-price' must have no element [children], and the value must be valid.

 

 

Line 15 =

 

<unit-price currency="GBP">--4.00</unit-price>

 

Many thanks as I love your contribution and really do want to use again!

Share this post


Link to post
Share on other sites
Sorry could not find before but here it is:

 

Error parsing XML; message from parser is: Invalid value for body of unit-price in checkout-shopping-cart/shopping-cart/items/item: This is not a number

Warnings: XML failed to validate against the schema at line: 15, column: 15, with error: cvc-datatype-valid.1.2.1: '--4.00' is not a valid value for 'decimal'.

XML failed to validate against the schema at line: 15, column: 15, with error: cvc-complex-type.2.2: Element 'unit-price' must have no element [children], and the value must be valid.

Line 15 =

 

<unit-price currency="GBP">--4.00</unit-price>

 

Many thanks as I love your contribution and really do want to use again!

 

 

Try changing line 213 from:

 

				  $discoun_value = number_format($GLOBALS[$class]->output[$i]['value'], 2, '.', '');

to

				  $discoun_value = abs(number_format($GLOBALS[$class]->output[$i]['value'], 2, '.', ''));


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Try changing line 211 if includes/modules/google.php from this:

 

if ($value == 'ot_coupon.php' || $value == 'ot_gv.php') {

to this:

if ($value == 'ot_discount_coupon.php' || $value == 'ot_coupon.php' || $value == 'ot_gv.php') {

 

I'm glad that I wasn;t the only one thinking about this, and that the issue has helped pothers too.

 

Works like a charm. Thanx!

 

Best regards,

 

Martin

 

 

PS If my ship ever comes in, remind me that I've invited you to the celebratory party.

 

http://rms-republic.com (my other passion)

Share this post


Link to post
Share on other sites
For those of you also running Separate Pricing Per Customer on your store, I've just uploaded an Add-On to Discount Coupon Codes v3 to allow you to exclude customer groups from using coupons :thumbsup:

 

I'm currently using SPPC w/PWA without any problems. I installled the Disocunt coupon codes with the mod I quoted above and it works fine for a registered user. I get the following SQL error if I try using a discount coupon via the Puchase Wihtout Acount

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND coupons_id="PF5VGC"' at line 4

SELECT dc2cg.customers_group_id FROM discount_coupons_to_customer_groups dc2cg WHERE customers_group_id= AND coupons_id="PF5VGC"

 

Here is the whole statement from the includes.classes/discount_coupon.php

$check_user_query = tep_db_query($sql = 'SELECT dc2cg.customers_group_id
																								FROM '.TABLE_DISCOUNT_COUPONS_TO_CUSTOMER_GROUPS.' dc2cg
																								WHERE customers_group_id='.$sppc_customer_group_id.'
																									AND coupons_id="'.tep_db_input( $code ).'"' );]

 

Not sure what to check.

 

Thanks


Currently running 76 contibutions.

Share this post


Link to post
Share on other sites

Really great contri!!

 

one problem,

- version 3.2 gives no reply when products are excluded, and by the reports he shows that the coupon is used.

so anyone can make a mistake and the coupon is used. thats not really nice fotmy customers.

 

sorry for my bad english :blink:

 

is there a solution for this?

 

regards,

Jan


Dreams can come true, if you help them a littlebit

Share this post


Link to post
Share on other sites
Really great contri!!

 

one problem,

- version 3.2 gives no reply when products are excluded, and by the reports he shows that the coupon is used.

so anyone can make a mistake and the coupon is used. thats not really nice fotmy customers.

 

sorry for my bad english :blink:

 

is there a solution for this?

 

regards,

Jan

 

extra information, this happens whem you leave the Min Order: zero


Dreams can come true, if you help them a littlebit

Share this post


Link to post
Share on other sites
Really great contri!!

 

one problem,

- version 3.2 gives no reply when products are excluded, and by the reports he shows that the coupon is used.

so anyone can make a mistake and the coupon is used. thats not really nice fotmy customers.

 

sorry for my bad english :blink:

 

is there a solution for this?

 

regards,

Jan

 

extra information, this happens whem you leave the Min Order: zero


Dreams can come true, if you help them a littlebit

Share this post


Link to post
Share on other sites
Really great contri!!

 

one problem,

- version 3.2 gives no reply when products are excluded, and by the reports he shows that the coupon is used.

so anyone can make a mistake and the coupon is used. thats not really nice fotmy customers.

 

sorry for my bad english :blink:

 

is there a solution for this?

 

regards,

Jan

 

i think something went wrong, three messages without my txt.

 

extra information about my question.

the above mentiond problem happens when you leave the Min Order: zero


Dreams can come true, if you help them a littlebit

Share this post


Link to post
Share on other sites

Sorry, if this has been answered but I need to ask: does this contrib support tracking the remainder for a gift certificate? Say a person gets a gift certificate for $100. He uses it once for $50. Will the system keep track so that the next he checks out and uses it, it can be redeemed for the remainding $50?

 

thanks

Edited by j_mac

Share this post


Link to post
Share on other sites
I have a problem in exclusions.

No exclusion is working.

I used 3.0 version.

 

Any idea?

 

 

Make sure you uploaded the newer version of the includes/classes/discount_coupon.php file from the install zip.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Really great contri!!

 

one problem,

- version 3.2 gives no reply when products are excluded, and by the reports he shows that the coupon is used.

so anyone can make a mistake and the coupon is used. thats not really nice fotmy customers.

 

sorry for my bad english :blink:

 

is there a solution for this?

 

regards,

Jan

 

 

It's not set up to provide any error message when items are excluded.

 

I will look into why it's marking coupons as used when all items are excluded. That shouldn't be happening.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Sorry, if this has been answered but I need to ask: does this contrib support tracking the remainder for a gift certificate? Say a person gets a gift certificate for $100. He uses it once for $50. Will the system keep track so that the next he checks out and uses it, it can be redeemed for the remainding $50?

 

thanks

 

 

These are discount coupons, not gift certificates. Discounts happen before tax, gift certificates happen after tax and apply to the entire order total. Two very different beasts.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I'm currently using SPPC w/PWA without any problems. I installled the Disocunt coupon codes with the mod I quoted above and it works fine for a registered user. I get the following SQL error if I try using a discount coupon via the Puchase Wihtout Acount
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND coupons_id="PF5VGC"' at line 4

SELECT dc2cg.customers_group_id FROM discount_coupons_to_customer_groups dc2cg WHERE customers_group_id= AND coupons_id="PF5VGC"

 

Here is the whole statement from the includes.classes/discount_coupon.php

$check_user_query = tep_db_query($sql = 'SELECT dc2cg.customers_group_id
																								FROM '.TABLE_DISCOUNT_COUPONS_TO_CUSTOMER_GROUPS.' dc2cg
																								WHERE customers_group_id='.$sppc_customer_group_id.'
																									AND coupons_id="'.tep_db_input( $code ).'"' );]

 

Not sure what to check.

 

Thanks

 

Hopefully Tracy will be able to chime in with some help if she's around.

 

For starters, you can make sure there's at least no ugly error message by changing that code to read:

 

$check_user_query = tep_db_query($sql = 'SELECT dc2cg.customers_group_id
																								FROM '.TABLE_DISCOUNT_COUPONS_TO_CUSTOMER_GROUPS.' dc2cg
																								WHERE customers_group_id='.(int)$sppc_customer_group_id.'
																									AND coupons_id="'.tep_db_input( $code ).'"' );]

 

 

Second, make sure you added the global $sppc_customer_group_id line to the beginning of that function.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hopefully Tracy will be able to chime in with some help if she's around.

 

For starters, you can make sure there's at least no ugly error message by changing that code to read:

 

$check_user_query = tep_db_query($sql = 'SELECT dc2cg.customers_group_id
																								FROM '.TABLE_DISCOUNT_COUPONS_TO_CUSTOMER_GROUPS.' dc2cg
																								WHERE customers_group_id='.(int)$sppc_customer_group_id.'
																									AND coupons_id="'.tep_db_input( $code ).'"' );]

Second, make sure you added the global $sppc_customer_group_id line to the beginning of that function.

 

Thanks a bunch...That seems to have done the trick. I have one more question for you;

 

I have the Customer Loyalty mod that I'm using also. I'm going to use the Discount coupon Codes to create a shipping coupon that provides everyone a percentage off on any purchase. I will have the code display during the checkout process. Sort order for me is:

 

Customer Loyalty Discount 1

Discount Coupon 2

Sub-total 3

tax 4

Shipping 5

Order Total 6

 

The coupon is a shipping coupon and is set for 10%. It gives the correct 10% figure, but what is happening is it applies it to the sub-total and the Customer Loyalty discount then kicks in based on that figure. So it is not giving the correct amount. I thought that whatever position the coupons were placed it, that would determine when the discount is taken. It seems the shipping discount is taken first no matter where I place it so the Loyalty discount is always off.

Since the customer loyalty discount is based on the product price and the shipping coupon is based on the shipping price they should not affect each other, but they seem too. I just need the loyal discount to apply first, then the discount coupon for shipping after that, but I can't get it to work that way.

 

Does this make any sense :'(

 

Thanks


Currently running 76 contibutions.

Share this post


Link to post
Share on other sites
Thanks a bunch...That seems to have done the trick. I have one more question for you;

 

I have the Customer Loyalty mod that I'm using also. I'm going to use the Discount coupon Codes to create a shipping coupon that provides everyone a percentage off on any purchase. I will have the code display during the checkout process. Sort order for me is:

 

Customer Loyalty Discount 1

Discount Coupon 2

Sub-total 3

tax 4

Shipping 5

Order Total 6

 

The coupon is a shipping coupon and is set for 10%. It gives the correct 10% figure, but what is happening is it applies it to the sub-total and the Customer Loyalty discount then kicks in based on that figure. So it is not giving the correct amount. I thought that whatever position the coupons were placed it, that would determine when the discount is taken. It seems the shipping discount is taken first no matter where I place it so the Loyalty discount is always off.

Since the customer loyalty discount is based on the product price and the shipping coupon is based on the shipping price they should not affect each other, but they seem too. I just need the loyal discount to apply first, then the discount coupon for shipping after that, but I can't get it to work that way.

 

Does this make any sense :'(

 

Thanks

 

 

In Modules > Order Total in your admin section, make sure the Discount Coupon option for applying the discount to the subtotal is set to false. Then I'd reorder the lines like this:

 

Customer Loyalty Discount 1

Sub-Total 2

Discount Coupon 3

tax 4

Shipping 5

Order Total 6

 

That might work out of the box for you. Otherwise, you'd need to get into the code.


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

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

Share this post


Link to post
Share on other sites

We want to allow new customers to enter a discount code during checkout that will do 2 things. Change the price of one 2oz product to $0.00 and make shipping free. Basically, we are running a special where a customer can receive a free 2oz of any of our products and get free shipping on their entire order. We don't process the credit card online, so if need be we can try to go about this a different way.

 

Any thoughts?


~Tracy
 

Share this post


Link to post
Share on other sites
We want to allow new customers to enter a discount code during checkout that will do 2 things. Change the price of one 2oz product to $0.00 and make shipping free. Basically, we are running a special where a customer can receive a free 2oz of any of our products and get free shipping on their entire order. We don't process the credit card online, so if need be we can try to go about this a different way.

 

Any thoughts?

 

That is something that I'm kind of doing. I wanted to discount shipping for everyone by a certain percentage each time they ordered. I also needed to be able to use discounts for certain things so I'm using this contrib for the shipping discount and CCGV(TRAD) for the other discounts. It tooks some tweaking to the order totals to get it to come out like I wanted, but it works great. Even works with the Gift Vouchers.

 

Not sure if that is what your looking to do.


Currently running 76 contibutions.

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

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

×