Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

OK, i have found a problem with this contribute when using in 2.2RC1

 

In admin/includes/database_tables.php and /filenames.php there is no reference to define:administrators

 

insert this into /database_tables.php (line 16) define('TABLE_ADMINISTRATORS', 'administrators');

 

and

 

insert this into /filenames.php (line 14) define('FILENAME_ADMINISTRATORS', 'administrators.php');

 

 

that should do it!

 

 

The only prob i still have is getting PayPal IPN to recognise the discount in the total.

 

any help on this would be appreciated.

Share this post


Link to post
Share on other sites

I had this "Discount Coupons" contribution working the other day, but I noticed that my order totals were being doubled during the checkout process. So I had to make sure that I did not have any duplicates of a piece of code in my catalog/includes/classes/order.php file. I did have a duplicate, so I deleted one of them. I also accidentally dropped an index from my PHP Admin database, and I didn't know how to recover it. But anyway, after I did these things, I no longer see the discount amount showing up in the Order Confirmation page. I have everything else in tact. I am able to enter the discount code on the Payment Confirmation page. I have tried to uninstall the contribution and SQL database tables and reinstall it from the beginning, but I'm getting the same problem. Can you please help me. This contribution is exactly what I need for my store, and I really don't want to give up yet. Thanks a lot. I have browsed the forum, and I didn't see any solution for my problem. I have a unique sort order under Modules>Order Total. PLEASE HELP!! I've been trying to solve this problem for 3 days now. I'm going crazy. Thanks.

 

 

 

 

 

 

This is the support thread for the Order Total contribution Discount Coupon Codes found here:

 

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

Share this post


Link to post
Share on other sites

Hi Kristen,

 

Well - I'm baffled at this point. I setup a coupon that would discount $21.75 from an order provided one of three products was in the order - just using the basic product exclusion and coupon setup in the admin, no special coding.

 

The concept is to provide a free 2 oz product with free shipping.

 

But - somewhere the math goes goofy:

 

Here is what the customer sees:

 

Product Total $14.75

Discount applied: -$21.70

Sub-Total: -$6.95

Shipping: $6.95

Total: $8.88

 

Any idea why it isn't giving a $0.00 balance for the total? I'm not sure which bit of code to research for this one :huh:

 

Thanks! :blush:


~Tracy
 

Share this post


Link to post
Share on other sites
Any idea why it isn't giving a $0.00 balance for the total? I'm not sure which bit of code to research for this one :huh:

 

Thanks! :blush:

 

Here is what the backend prints out on the order:

 

<!--DEBUG<pre>Object order is: order Object
(
[info] => Array
	(
		[order_status] => 1
		[currency] => USD
		[currency_value] => 1.00000000
		[payment_method] => Credit Card
		[cc_type] => 
		[cc_owner] => Tracy TESTING
		[cc_number] => XXXXXX
		[cc_expires] => 
		[shipping_method] => Shipping (USPS)
		[shipping_cost] => 6.95
		[subtotal] => -6.95
		[tax] => 0
		[tax_groups] => Array
			(
				[Unknown tax rate] => -0
			)

		[comments] => TESTING
		[referred_by] => 
		[total] => 8.8817841970013E-16
	)

[totals] => Array
	(
	)

[products] => Array
	(
		[0] => Array
			(
				[qty] => 1
				[name] => Maxi-Milk - 2oz
				[model] => 1202
				[tax] => 0
				[tax_description] => Unknown tax rate
				[price] => 14.7500
				[final_price] => 14.75
				[weight] => 0.13
				[id] => 152
			)

	)

[customer] => Array
	(
		[firstname] => Tracy
		[lastname] => TESTING
		[company] => 
		[street_address] => xxxx
		[suburb] => 
		[city] => xxxx
		[postcode] => xxxxx
		[state] => xxxx
		[zone_id] => 37
		[country] => Array
			(
				[id] => 223
				[title] => United States
				[iso_code_2] => US
				[iso_code_3] => USA
			)

		[format_id] => 2
		[telephone] => xxxxxxxxxx
		[email_address] => xxxxxx
	)

[delivery] => Array
	(
		[firstname] => Tracy
		[lastname] => TESTING
		[company] => 
		[street_address] => xxxxx
		[suburb] => 
		[city] => xxxxx
		[postcode] => xxxxx
		[state] => xxxxx
		[zone_id] => 37
		[country] => Array
			(
				[id] => 223
				[title] => United States
				[iso_code_2] => US
				[iso_code_3] => USA
			)

		[country_id] => 223
		[format_id] => 2
	)

[content_type] => physical
[coupon] => discount_coupon Object
	(
		[messages] => Array
			(
			)

		[coupon] => Array
			(
				[coupons_id] => MGP0813
				[coupons_description] => Free Trial Offer
				[coupons_discount_amount] => 21.700000000000
				[coupons_discount_type] => fixed
				[coupons_date_start] => 2007-09-01 00:00:00
				[coupons_date_end] => 2007-10-01 00:00:00
				[coupons_max_use] => 1
				[coupons_min_order] => 14.7500
				[coupons_min_order_type] => price
				[coupons_number_available] => 0
			)

		[applied_discount] => Array
			(
				[Unknown tax rate] => 21.7
			)

		[cart_info] => Array
			(
				[valid_products] => Array
					(
						[count] => 1
						[line_items] => 1
						[total] => 14.75
					)

				[total_products] => Array
					(
						[count] => 1
						[line_items] => 1
						[total] => 14.75
					)

				[exclusions] => Array
					(
						[categories] => Array
							(
							)

						[products] => Array
							(
								[0] => 28
								[1] => 29
								[2] => 30
								[3] => 31
								and continues up to
								[321] => 398
							)

						[manufacturers] => Array
							(
							)

					)

			)

	)

[billing] => Array
	(
		[firstname] => Tracy
		[lastname] => TESTING
		[company] => 
		[street_address] => xxxxxx
		[suburb] => 
		[city] => xxxxxx
		[postcode] => xxxxx
		[state] => xxxxx
		[zone_id] => 37
		[country] => Array
			(
				[id] => 223
				[title] => United States
				[iso_code_2] => US
				[iso_code_3] => USA
			)

		[country_id] => 223
		[format_id] => 2
	)

)
</pre>-->

 

Hopefully that helps you some with seeing where the math is going wrong :blush:


~Tracy
 

Share this post


Link to post
Share on other sites

I have put the DCC contribution on another site I built a few months ago, and at that time I needed to install the earlier version and then work my way up because of changes needed in the DB. I love this contribution and want to add it to a new site I just finished.

 

In what order do I need to install the Discount Coupon Codes Contribution? Meaning do I need to start at ver 1.4 and go up or can I just install the latest version now?

 

Thanks for your help

Share this post


Link to post
Share on other sites

is there a way i can offer the discount coupons in the store? like use them as a gift certificate?

 

and make it automated so when a person orders one they can enter like recievers email and have the discount coupon emailed to them?

Share this post


Link to post
Share on other sites
is there a way i can offer the discount coupons in the store? like use them as a gift certificate?

 

and make it automated so when a person orders one they can enter like recievers email and have the discount coupon emailed to them?

 

 

Not really. These are coupons, not gift certificates, and there is a pretty important distinction between them. You want CCGV.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I have put the DCC contribution on another site I built a few months ago, and at that time I needed to install the earlier version and then work my way up because of changes needed in the DB. I love this contribution and want to add it to a new site I just finished.

 

In what order do I need to install the Discount Coupon Codes Contribution? Meaning do I need to start at ver 1.4 and go up or can I just install the latest version now?

 

Thanks for your help

 

 

You should be able to install the latest version without installing the previous ones first.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites

Hi . .I had this contrib working perfectly until I installed the USPS Methods module. Could you point me in the right direction to look for my error? When I click to edit the attributes of this contrib in the admin section I also get the options of my shipping module.

 

Could you tell me where this info is being pulled from so that I can correct it?

 

Thanks!

Share this post


Link to post
Share on other sites
You should be able to install the latest version without installing the previous ones first.

 

Thanks KGT - I will start working on this tonight.

Share this post


Link to post
Share on other sites
I didn't study your question in enough detail to know if this is the problem, but I just installed the module and discovered the "New Install" instructions are missing a line for catalog/includes/classes/order.php. They need to say to add the following after line 15:

//kgt - discount coupon

var $coupon;

//end kgt - discount coupon

 

The above code is in the sample order.php file provided, it's just not mentioned in the instructions.

 

Thank you for pointing this out.

Share this post


Link to post
Share on other sites
Install 3.3 version

 

i need SQL file Scripts

 

 

See the README. SQL statements are listed in the Common Problems section.

 

The module should install the tables when you install the module in your osCommerce admin section. You only need to run the statements yourself if your user doesn't have CREATE TABLE privileges or you're getting an error.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi . .I had this contrib working perfectly until I installed the USPS Methods module. Could you point me in the right direction to look for my error? When I click to edit the attributes of this contrib in the admin section I also get the options of my shipping module.

 

Could you tell me where this info is being pulled from so that I can correct it?

 

Thanks!

 

 

I'm not sure why the USPS Methods module would interfere. And it's odd that the shipping attributes display when you try to edit this. I have not seen that problem before. Since it was working, I assume the problem arose when you installed the USPS Methods. Does that make changes to admin/modules.php?

 

Also look in your database and be sure you have entries in the configuration table for configuration_key's starting with MODULE_ORDER_TOTAL_DISCOUNT_COUPON.

 

I don't know what else to suggest. Does it work when you try to use a coupon during checkout? If not, what happens?


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I had this "Discount Coupons" contribution working the other day, but I noticed that my order totals were being doubled during the checkout process. So I had to make sure that I did not have any duplicates of a piece of code in my catalog/includes/classes/order.php file. I did have a duplicate, so I deleted one of them. I also accidentally dropped an index from my PHP Admin database, and I didn't know how to recover it. But anyway, after I did these things, I no longer see the discount amount showing up in the Order Confirmation page. I have everything else in tact. I am able to enter the discount code on the Payment Confirmation page. I have tried to uninstall the contribution and SQL database tables and reinstall it from the beginning, but I'm getting the same problem. Can you please help me. This contribution is exactly what I need for my store, and I really don't want to give up yet. Thanks a lot. I have browsed the forum, and I didn't see any solution for my problem. I have a unique sort order under Modules>Order Total. PLEASE HELP!! I've been trying to solve this problem for 3 days now. I'm going crazy. Thanks.

 

 

Double check the code you have in includes/classes/order.php with the installation instructions. Most likely that is where the error is.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
OK, i have found a problem with this contribute when using in 2.2RC1

 

In admin/includes/database_tables.php and /filenames.php there is no reference to define:administrators

 

insert this into /database_tables.php (line 16) define('TABLE_ADMINISTRATORS', 'administrators');

 

and

 

insert this into /filenames.php (line 14) define('FILENAME_ADMINISTRATORS', 'administrators.php');

that should do it!

The only prob i still have is getting PayPal IPN to recognise the discount in the total.

 

any help on this would be appreciated.

 

 

For all:

 

PLEASE NOTE RC1 was released AFTER the latest version of Discount Coupon Codes. Though it should work if you do an manual installation, DO NOT COPY OVER EXISTING FILES with the files from the installation zip if you have RC1.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
When I check out using PayPal, and have a discount applied, checkout_confirmation incorrectly calculates the "amount" output to PayPal.

 

$1.00 Price

$1.00 Sub Total

$2.25 Shipping

-$2.25 Shipping Discount Applied

 

$1.00 Total

 

 

Is your coupon set up as a shipping discount or an item discount? If it's an item discount, you need to make it a shipping discount. Otherwise the item price really is -1.25.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hello,

Great contribution by the way. I only have one problem, Im using the latest OSC and have managed to pretty much get the whole contribution working. The only file giving me problems is order.php in classes. As when I try to update this file using the instructions the order total automatically goes to 0.

 

My order.php shows the following code

        $shown_price = $currencies->calculate_price($this->products[$index]['final_price'], $this->products[$index]['tax'], $this->products[$index]['qty']);
       $this->info['subtotal'] += $shown_price;

 

Where as the instructions ask me to edit the following code

        $shown_price = tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'];
       $this->info['subtotal'] += $shown_price;

 

The contribution code does not have $currencies->calculate_price, I dont know if this is the only issue. I am using 2.2 RC1, if anyone knows a workaround it would be greatly appreciated it.

 

Kind regards

 

M PArmar

 

That's the right line. Replace it with the code provided in the install instructions. It should work fine.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
The "Display subtotal with applied discount?" when set to FALSE is not working. Subtotal still showing the discounted price. Is there a way to make this works?

 

I asked because I have shipping based on price. For order above $50, I give free shipping. If below that, I charged $10 shipping.

 

When a customer purchased a $70 product and use a $30 discount coupon, the subtotal becomes $40 and there will still be $10 shipping charged to it. This is wrong and I do not want to charge customer shipping based on subtotal after discount. It should be FREE SHIPPING as the original purchase is already over $50.

 

How to solve this?

 

 

The "Display subtotal with applied discount?" is not there for fun. It's supposed to work. If it's not, then I don't know what to tell you. Try getting a debug output and send that to me for review.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I went through the instructions for Discount Coupon Code 3.3 but when I go to open the module in admin/modules./order total the "discount code" module does not exist for me to install...what am I missing?

 

 

Not sure what you mean... you are trying to "open" the module in your administration interface, correct?


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I recently installed v 3.3 but I am getting wacky results. At first I thought it wasn't working. Everything works fine on the admin side. However, on the customer side, they can enter the code, but it doesn't always apply the discount.

 

1) Discount only works with the "shipping discount" and will not work with "percentage discount" or "fixed amount"

2) If there is a minimum requirement for product quantity or price total, it will not work and results in an error message, even though the requirement is met.

Any help would be greatly appreciated!

 

 

See the README for help getting debug output.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
Hi guys/girls,

 

I'm having an issue getting the discount coupons offering a postage cost reduction to work. They just don't seem to ammend the price at all?

 

Sorry if this has been questioned before. I scanned through and searched but I may well have missed it!

 

Thanks

 

:)

 

 

 

Please see the README for help generating debug output.


Contributions

 

Discount Coupon Codes

Donations

Share this post


Link to post
Share on other sites
I got a problem.

 

Few days ago I installed the contribution without any problem, and it is working fine after testing.

 

However, today, after upgrading PERL from 5.8.7 to 5.8.8, I notice that there are now some problem with the discount coupon. The TOTAL is not right, discount coupon is not being deducted. Eg.:

 

Sub-Total: RM349.50

PosLaju / EMS Shipping (1~2 business days to arrive): RM0.00

Discount Coupon SHASHINKI-01 applied:: -RM5.00

Total: RM349.50 (Should be RM344.00)

 

I am not sure if this is due to PERL upgrade or not, but can anybody help me or teach me what I should check? :'(

 

 

The PERL upgrade should not affect anything. Please see the README for help generating a debug output.


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

×