Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Just consider the "catalog" part of the filepath as "root" in your case. I am setup the same way - the rest of the structure is the same. So whenever I see "catalog/includes" I think "root/includes" ;)

 

You can choose on install to have osC setup with a catalog folder or to use the root folder as your catalog folder. So you will find contributions that reference the catalog folder, and ones that do not :thumbsup:

 

So, Will I have to modify any of the Coupon Code to point to root/something? Guess I'm trying to ask with is there any code in the Coupon Code that references catalog/something that I'll need to do a find/replace on and change it to root/something? Thanks for your help.

Link to comment
Share on other sites

So, Will I have to modify any of the Coupon Code to point to root/something? Guess I'm trying to ask with is there any code in the Coupon Code that references catalog/something that I'll need to do a find/replace on and change it to root/something? Thanks for your help.

 

 

No. It could be installed in

 

/

or

/catalog/

or

/some/really/long/file/path/

 

And all three should work exactly the same (providing you have your store set up correctly - basically, if your store works with whatever path system you have, this contribution should work fine as well).

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Error in Discount Coupon codes 2.1

 

the subtraction of the % it is wrong.

Discount Coupon Codel 2.1 ago this:

example: €150 - 20% discount = €120 (total wrong)

 

the correct formula is this:

example: €150 / 1.20 discount = €125 (total exact)

 

 

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

in fact if to €125 it is added + 20% the total one is = € 150

 

and not as in the first case € 120 + 20% = € 144

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

 

Attention it takes a fix

Link to comment
Share on other sites

Error in Discount Coupon codes 2.1

 

the subtraction of the % it is wrong.

Discount Coupon Codel 2.1 ago this:

example: €150 - 20% discount = €120 (total wrong)

 

the correct formula is this:

example: €150 / 1.20 discount = €125 (total exact)

 

 

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

in fact if to €125 it is added + 20% the total one is = € 150

 

and not as in the first case € 120 + 20% = € 144

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

 

Attention it takes a fix

 

This contribution takes a percentage discount. So a 20% discount off the price is equivalent to 80% of the price. That is the way it is intended to work.

 

150 * .20 = 30

150 - 30 = 120

 

and

 

150 * .80 = 120

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

This may be a dumb question, but I have to ask. Do I upload the files to the http section or https section

 

but do you return you account? this is a resounding error of mathematics.

 

explain then me because 120 + 20% come 144 and not 150

Link to comment
Share on other sites

but do you return you account? this is a resounding error of mathematics.

 

explain then me because 120 + 20% come 144 and not 150

 

 

This is correct for when your calculating a percentage addition (like tax). You find this number by taking the total percent (100%) and adding the percentage addition (20%):

 

total = 1 * subtotal + .20 * subtotal

 

This is equivalent to:

 

total = subtotal * ( 1 + .20 )

 

And simplified:

 

total = 1.20 * subtotal

 

If you are given only the total and the percentage addition, then you can calculate the subtotal as:

 

subtotal = total / 1.20

 

 

 

When you're calculating a percentage discount, you need to find the total percent (100%) minus the discount amount (20%). So 100% of the subtotal minus 20% of the subtotal:

 

total = 1 * subtotal - .20 * subtotal

 

This is equivalent to:

 

total = subtotal * ( 1 - .20 )

 

And simplified:

 

total = subtotal * .80

 

If you are given only the total and the percentage addition, then you can calculate the subtotal as:

 

subtotal = total / .80

 

 

 

So, 150 * .80 = 120 and 120 / .80 = 150. We can still rewrite both of the above equations. For percent addition:

 

total = 1 * subtotal + .20 * subtotal

total = subtotal + .20 * subtotal

 

Thus, given a cart subtotal of 150:

 

total = 150 + .20 * 150

total = 150 + 30

total = 180

 

This would be for a tax rate of 20%. The inverse would be:

 

total = 1 * subtotal + .20 * subtotal

total = subtotal * ( 1 + .20 )

total / ( 1 + .20 ) = subtotal

total / 1.20 = subtotal

 

It's the exact same inverse function as I came up with before. For a percent discount:

 

total = 1 * subtotal - .20 * subtotal

total = subtotal - .20 * subtotal

 

Thus, given a cart subtotal of 150:

 

total = 150 - .20 * 150

total = 150 - 30

total = 120

 

And the inverse function is:

 

total = 1 * subtotal - .20 * subtotal

total = subtotal * ( 1 - .20 )

total / ( 1 - .20 ) = subtotal

total / .80 = subtotal

 

Again, same as the first one.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

This may be a dumb question, but I have to ask. Do I upload the files to the http section or https section

 

Normally you should only need to upload files to http section. If your host requires you to manually also upload files to an https section, I would recommend finding a new host! That would be a nightmare.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

We have installed the coupon code and ran the sql statements, but we are having problems.

 

1. I don't have an option to create coupon codes via the admin console.

2. I don't have an option during checkout to enter a coupon code.

3. The Payment confirmation page doesn't load. I only get a blank web page.

 

Please help!!

Link to comment
Share on other sites

Well we've corrected it and we now have an option to enter a coupon code during checkout. But, I still don't have the option to create a coupon via the admin console. :(

 

 

Revisit the install instructions for the admin section. You're missing the changes made to the catalog box.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

The next version of this, which is currently being tested, will allow you to exclude products, categories, manufacturers, and even customers. You should have no problem creating coupons and excluding all but one product so that you have a coupon for a product. The only disadvantage to this method is the contribution currently only allows one coupon to be used per order.

do you have an ETA on this new release?

i would appreciate a reply ASAP. thanks.

Link to comment
Share on other sites

do you have an ETA on this new release?

 

i would appreciate a reply ASAP. thanks.

 

 

This has been answered multiple times in this very thread. The answer is "probably sometime this week, but it depends on how the testing goes."

 

If you would like to speed the process along, please volunteer to test by sending me your email address in either a PM or email.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I am new to osCommerce, php, and Sql if that gives you any idea.

Saw this on previous posts but I am getting this message after install:

 

1146 - Table 'osCommerce.discount_coupons' doesn't exist

 

select count(*) as total from discount_coupons cd

 

[TEP STOP]

 

I know the instructions say I need to go to myphpadmin and run the statements via the sql tab- I am hosting with Yahoo and see everything in a file manager section. After I installed myphpadmin I could go there and log in but then came osCommerce and after installing it, when I try to enter myphpadmin I am brought back to my admin section for osCommerce.

 

Does this make any sense? Please remember that while I am very willing to learn all this, I am what is know as a reverse engineering kinda person. If I can see it, I can do it but I usually am not the one to think of it first. :)

Is there any other way for getting these lines of coding where they need to be- a specific file to add them to, perhaps re-installing myphpadmin, etc.

Any technical help is very much appreciated.

Thanks,

Pattie

Link to comment
Share on other sites

Update to above post - this is rather worrying, If I set "Number available" on a discount to "1" I can go and use it any number of times so there is no logging of my discount codes going on ?? I have no error messages - have i missed something obvious here ??

 

only other main contirb I'm running is Paypal IPN and I made sure I installed the patch for it.

Link to comment
Share on other sites

Should I have an admin folder in my httpdocs/shop folder? I have one in the httpsdocs/shop folder, but not httpdocs/shop?

 

I can't tell you for sure what you should have, since every server is set up differently. I can tell you if your store works, then it's 99% likely everything is fine.

 

Also, it is unusual, but not impossible for you to have to manually install the changes to httpsdocs as well.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I know the instructions say I need to go to myphpadmin and run the statements via the sql tab- I am hosting with Yahoo and see everything in a file manager section. After I installed myphpadmin I could go there and log in but then came osCommerce and after installing it, when I try to enter myphpadmin I am brought back to my admin section for osCommerce.

 

 

The problem you are having is indeed because you have not run the SQL statements. If you cannot get into your Yahoo phpMyAdmin, then I'd suggest reinstalling it (last time I had to work with them, they had a goofy click to install link for phpMyAdmin instead of just providing it).

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Update to above post - this is rather worrying, If I set "Number available" on a discount to "1" I can go and use it any number of times so there is no logging of my discount codes going on ?? I have no error messages - have i missed something obvious here ??

 

only other main contirb I'm running is Paypal IPN and I made sure I installed the patch for it.

 

 

The coupons can be used more than once because they are not being logged as used when the order is processed. Please send me your paypal ipn file in a PM or email and I will make sure it looks correct.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

ok, We're able to add coupons via the admin console now. We can even enter coupons during check out. However, the checkout process never completes. After I enter the credit card and discount code info and click continue I get a blank white page when the checkout_confirmation.php page tries to load. HELP!

Link to comment
Share on other sites

ok, We're able to add coupons via the admin console now. We can even enter coupons during check out. However, the checkout process never completes. After I enter the credit card and discount code info and click continue I get a blank white page when the checkout_confirmation.php page tries to load. HELP!

 

 

Most likely you're getting a fatal error. Add these two lines to the top of includes/application_top.php:

 

error_reporting( E_ALL );

ini_set( 'display_errors', 1 );

 

You should now see an error when you get the checkout_confirmation.php.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

The problem you are having is indeed because you have not run the SQL statements. If you cannot get into your Yahoo phpMyAdmin, then I'd suggest reinstalling it (last time I had to work with them, they had a goofy click to install link for phpMyAdmin instead of just providing it).

I did reinstall and then when I went into the catalog/ directory the phpMyAdmin screen popped up and I clicked the SQL tab...now I have never done this before but I kept getting and error message there:

SQL query:

 

CREATE TABLE discount_coupons(

 

coupons_id VARCHAR( 32 ) NOT NULL DEFAULT '',

coupons_description VARCHAR( 64 ) NOT NULL DEFAULT '',

coupons_discount_percent DECIMAL( 7, 4 ) DEFAULT NULL ,

coupons_date_start DATETIME DEFAULT NULL ,

coupons_date_end DATETIME DEFAULT NULL ,

coupons_max_use INT( 3 ) NOT NULL DEFAULT 0,

coupons_min_order DECIMAL( 15, 4 ) NOT NULL DEFAULT '0.0000',

coupons_max_order DECIMAL( 15, 4 ) NOT NULL DEFAULT '0.0000',

coupons_number_available INT( 3 ) DEFAULT 0 NOT NULL ,

PRIMARY KEY ( coupons_id )

)

MySQL said:

 

#1044 - Access denied for user 'pattie'@'localhost' to database 'CREATE TABLE discount_coupons ('

 

Any idea why this is happening- I am not familar with Sql or php so any suggestions is helpful.

Thanks,

Pattie

Link to comment
Share on other sites

I did reinstall and then when I went into the catalog/ directory the phpMyAdmin screen popped up and I clicked the SQL tab...now I have never done this before but I kept getting and error message there:

SQL query:

 

CREATE TABLE discount_coupons(

 

coupons_id VARCHAR( 32 ) NOT NULL DEFAULT '',

coupons_description VARCHAR( 64 ) NOT NULL DEFAULT '',

coupons_discount_percent DECIMAL( 7, 4 ) DEFAULT NULL ,

coupons_date_start DATETIME DEFAULT NULL ,

coupons_date_end DATETIME DEFAULT NULL ,

coupons_max_use INT( 3 ) NOT NULL DEFAULT 0,

coupons_min_order DECIMAL( 15, 4 ) NOT NULL DEFAULT '0.0000',

coupons_max_order DECIMAL( 15, 4 ) NOT NULL DEFAULT '0.0000',

coupons_number_available INT( 3 ) DEFAULT 0 NOT NULL ,

PRIMARY KEY ( coupons_id )

)

MySQL said:

 

#1044 - Access denied for user 'pattie'@'localhost' to database 'CREATE TABLE discount_coupons ('

 

Any idea why this is happening- I am not familar with Sql or php so any suggestions is helpful.

Thanks,

Pattie

 

You must select your oscommerce database from the list of databases in phpMyAdmin, then run the sql statements.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Most likely you're getting a fatal error. Add these two lines to the top of includes/application_top.php:

 

error_reporting( E_ALL );

ini_set( 'display_errors', 1 );

 

You should now see an error when you get the checkout_confirmation.php.

 

 

This is the error that returned

 

Fatal error: Cannot redeclare class discount_coupon in /usr/local/psa/home/vhosts/piercedobsession.com/httpdocs/shop/includes/classes/discount_coupon.php on line 14

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