Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

Here is what I wanted:

 

So I wanted the subtotal to be entered in the customers total report.

 

When I do the following:

 

the customers total report is showing the grand total including shipping and taxes, minus the discount. Again what we want in the customers total report is the subtotal sales (sales minus taxes, shipping, and the discount).

 

So in the code I gave you, change 'ot_total' to 'ot_subtotal'...

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

First I'd like to say THANK YOU for an Awesome Contribution!! :thumbsup:

 

I have Discount Coupon Code 2.1 and Reports installed and running as it should! (which is something I've only had with a few contributions *before* posting to their forum). ;)

 

I do have two questions though:

 

1. I'm not sure I understand. Are you saying the "do not allow free shipping if discount brings order subtotal below minimum" is not working at all, or are you saying it's not working like you want it to?

 

With your contribution, I suspect there is a change to exactly how free shipping is handled. If so, then that would affect whether or not the DCC is able to recognize there's free shipping.

 

2. I do not need programmers to test, I need people who will be using this to test. I need people to go through the install instructions and test the calculations to make sure everything is working as it should. These are big changes waiting to come out, and I don't want to support buggy code (and I can't stand the thought of releasing something I won't support). Time frame - beginning of next week unless a big problem is found.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Great Contribution!

 

I have install the latest version and try it. It seems not working with the table rate shipping.

 

Can anyone point me to the right direction?

 

 

This contribution has little to do with shipping and this is a vague description of the problem, so it's difficult to say without more information.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I am having an odd problem with this contribution and hopefully someone out there can shed some light on what I may or may not be doing wrong.

 

I have set up a discount of $150

 

This is to cover the cost of two items and their shipping almost exactly. Whenever I run it through a test on my shopping cart, it calculates the total incorrectly. Wildly incorrectly.

 

The total for the two items together is $140. It then discounts it $120 when I need it to discount the full $140 (and the $6 shipping if that's possible)

 

Here is how I have it configured:

Desired Fixed Discount: 150.00

Max Use: 1

Min Order: $1.

Max Order: $1

Number Available: 1

 

Note: For some reason, the Max order field always defaults to the Min order field's value.

 

Now the weird thing is that when I go back and do coupons in $10 increments, it calculates everything correctly. It's only when I get into the $120-$150.

 

I've gone through about 20 pages and not found an answer. My thanks in advance.

Link to comment
Share on other sites

So in the code I gave you, change 'ot_total' to 'ot_subtotal'...

Works great. Thank you so much. You are about the only contributor besides toyicebear that responds in a timely manner.

 

I need help on one other item that is somewhat related to discount coupon codes. It is credit card totals report contrib.

This contrib summarizes the subtotals of cash and various credit card orders.

 

When I have orders that have a discount, the totals this contrib generates are totally off. It grabs the discount amount (10% figure) for the subtotal of an order, instead of the actual subtotal.

 

I am hoping it is an easy fix that you can give me. I understand if you can't do it-I just cannot get any help on this and I have posted in three different forums.

 

P.S. Also, I would like the credit card totals report to summarize the Grand Total instead of subtotals.

 

Here is the code from the stats_bath_report.php that I believe that needs to be edited.

//begin query

 

$batch_query_raw ="select ot.value, ot.title, ot.class, o.date_purchased, o.orders_id, o.cc_type, o.cc_number, o.payment_method from ". TABLE_ORDERS . " o , " . TABLE_ORDERS_TOTAL . " ot where o.orders_id = ot.orders_id AND o.date_purchased between '" . $date1 . "' AND '" .$date2 ."'";

$batch_query = tep_db_query($batch_query_raw);

$total_accumulator = 0.00;

$card1_accumulator = 0.00;

$card2_accumulator = 0.00;

$card3_accumulator = 0.00;

$card4_accumulator = 0.00;

$card5_accumulator = 0.00;

$non_cc_accumulator = 0.00;

// $loop=0;

while ($orders = tep_db_fetch_array($batch_query)){

if ($orders['class']=='ot_total'){

$total_accumulator += round($orders['value'],2) ;

$loop +=1;

if ($orders['payment_method']=='Credit Card'){

switch($orders[cc_type]){

case dbCARD1:

$card1_accumulator += round($orders['value'],2) ;

break;

case dbCARD2:

$card2_accumulator += round($orders['value'],2);

break;

case dbCARD3:

$card3_accumulator += round($orders['value'],2);

break;

case dbCARD4:

$card4_accumulator += round($orders['value'],2);

break;

default:

$card5_accumulator += round($orders['value'],2) ;

}

 

}

else {

$non_cc_accumulator += round($orders['value'],2);

}

 

This takes the above order totals and combines them into a summary. Don't think you need this code, but included it anyways.

 

<table >

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom"><?php echo CARD1 ?></td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($card1_accumulator,2)); ?></td></tr>

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom"><?php echo CARD2 ?></td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($card2_accumulator,2)); ?></td></tr>

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom"><?php echo CARD3 ?></td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($card3_accumulator,2)); ?></td></tr>

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom"><?php echo CARD4 ?></td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($card4_accumulator,2)); ?></td></tr>

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom"><?php echo CARD5 ?></td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($card5_accumulator,2)); ?></td></tr>

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom"><?php echo NOTCARD ?></td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($non_cc_accumulator,2)); ?></td></tr>

<tr class="dataTableHeadingRow" ><td class="dataTableHeadingContent" width='70' align='right' valign="bottom">TOTAL</td><td class="dataTableContent" width='100' align='right'><?php echo ("$" . number_format($total_accumulator,2)); ?></td></tr>

Link to comment
Share on other sites

This question has already been answered in this thread. The answer is not at this time, unless you change the code. The new version will allow you to exclude specials. It is in testing now. If you want it sooner, volunteer to test - I need more people to test before it's ready.

 

Hi, thanks for a speedy reply, I'd be happy to volunteer to test the new code, just let me know what you need from me.

Link to comment
Share on other sites

1. I'm not sure I understand. Are you saying the "do not allow free shipping if discount brings order subtotal below minimum" is not working at all, or are you saying it's not working like you want it to?

 

With your contribution, I suspect there is a change to exactly how free shipping is handled. If so, then that would affect whether or not the DCC is able to recognize there's free shipping.

 

2. I do not need programmers to test, I need people who will be using this to test. I need people to go through the install instructions and test the calculations to make sure everything is working as it should. These are big changes waiting to come out, and I don't want to support buggy code (and I can't stand the thought of releasing something I won't support). Time frame - beginning of next week unless a big problem is found.

 

Thank you for your quick reply! I cannot say that the DCC code is not working for free shipping at all because I'm sure it's the fact that I'm not using the standard Admin->Modules->Order Total->Shipping option to setup free shipping.

 

However, if the discount brings the order subtotal below the minimum amount required for free shipping it is still offering free shipping to the customer. So - in effect, it is not working.

 

The two ways in which customers receive free shipping are controlled by Table Rate (stock with osC) and the Free Shipping with Minimum Amount contribution. I'm just not sure if I would need to edit code in those two modules or if I would need to edit code in the DCC module in order to get it all working together :blush:

 

I would be happy to help you test the new release :thumbsup:

~Tracy
 

Link to comment
Share on other sites

Thank you for your quick reply! I cannot say that the DCC code is not working for free shipping at all because I'm sure it's the fact that I'm not using the standard Admin->Modules->Order Total->Shipping option to setup free shipping.

 

However, if the discount brings the order subtotal below the minimum amount required for free shipping it is still offering free shipping to the customer. So - in effect, it is not working.

 

The two ways in which customers receive free shipping are controlled by Table Rate (stock with osC) and the Free Shipping with Minimum Amount contribution. I'm just not sure if I would need to edit code in those two modules or if I would need to edit code in the DCC module in order to get it all working together :blush:

 

I would be happy to help you test the new release :thumbsup:

 

The change would need to be made in includes/classes/discount_coupon.php. As far as how to do it, I'm positive it can be done, but I cannot tell you how without looking into it more deeply than I have time to right now. It would not necessarily be an easy thing to do.

 

Please send me an email or PM with your email address so I can send you instructions for testing.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Works great. Thank you so much. You are about the only contributor besides toyicebear that responds in a timely manner.

 

I need help on one other item that is somewhat related to discount coupon codes. It is credit card totals report contrib.

This contrib summarizes the subtotals of cash and various credit card orders.

 

When I have orders that have a discount, the totals this contrib generates are totally off. It grabs the discount amount (10% figure) for the subtotal of an order, instead of the actual subtotal.

 

I am hoping it is an easy fix that you can give me. I understand if you can't do it-I just cannot get any help on this and I have posted in three different forums.

 

P.S. Also, I would like the credit card totals report to summarize the Grand Total instead of subtotals.

 

Here is the code from the stats_bath_report.php that I believe that needs to be edited.

 

I don't understand. As I read that code, it appears to be displaying the grand total for the orders, not the subtotals.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I don't understand. As I read that code, it appears to be displaying the grand total for the orders, not the subtotals.

 

Note this is Contribution: http://www.oscommerce.com/community/contri...rch,stats+batch

 

Here is an example from my credit card batch report

Order ID Purchase Date Order SubTotal Credit Card Used Action

47 2007 -01-04 16:06:00 $-2.20 - - - -

46 2007-01-04 15:30:04 $10.00 - - - -

45 2007-01-04 1 3:24:15 $1.00 - - - -

44 2007-01-04 13:20:38 $13.99 - - - -

 

It is actually more messed up than I thought.

 

Order #47 was $10.99 with a discount of $2.20, so its subtotal should have been $8.79. The report says it is $-2.20.

It obviously is taking the discount figure as the subtotal.

(Note this order had a shipping charge which comes after the subtotal)

 

Order #46 is accurate for the subtotal-no coupon code used for this order.

(It had shipping which comes after the subtotal)

 

Order #45 was $13.99 and had a discount of $2.80, so it should have been $11.19. But what it is showing is the SALES TAX amount.

(Note this order had free shipping)

 

So here is a recap from what I can tell.

 

1. Orders that have discounts are handled differently based upon if shipping fee is involved or not.

If there is a shipping fee the report shows the discount fee.

If no shipping is involved, the report shows sales tax.

 

2. If there is no coupon code the credit card batch report shows the correct figures.

 

So, home how there is a problem when coupon code is used.

Link to comment
Share on other sites

I am sorry if these questions have already been answered.

 

1. How do I change how the discount appeared on the order confirmation page? I want the subtotal before the discount. I also want to bold or underline the coupon #.

ex:

Discount Coupon 5 applied: -$5.00

Customer Pickup (Local Customers): $0.00

Sub-Total: $16.95

Total: $11.95

 

2. I unable to go back and edit a coupon.

 

HELP Please.......

Link to comment
Share on other sites

Note this is Contribution: http://www.oscommerce.com/community/contri...rch,stats+batch

 

Here is an example from my credit card batch report

It is actually more messed up than I thought.

 

Order #47 was $10.99 with a discount of $2.20, so its subtotal should have been $8.79. The report says it is $-2.20.

It obviously is taking the discount figure as the subtotal.

(Note this order had a shipping charge which comes after the subtotal)

 

Order #46 is accurate for the subtotal-no coupon code used for this order.

(It had shipping which comes after the subtotal)

 

Order #45 was $13.99 and had a discount of $2.80, so it should have been $11.19. But what it is showing is the SALES TAX amount.

(Note this order had free shipping)

 

So here is a recap from what I can tell.

 

1. Orders that have discounts are handled differently based upon if shipping fee is involved or not.

If there is a shipping fee the report shows the discount fee.

If no shipping is involved, the report shows sales tax.

 

2. If there is no coupon code the credit card batch report shows the correct figures.

 

So, home how there is a problem when coupon code is used.

 

I cannot see how the code you posted can possibly give these results. I have also downloaded the contribution and looked at the code, and I still cannot see what could be wrong. When I run the report against my orders with discounts, the results are perfectly correct. Did you ever modify this file? Try downloading the most recent version and replacing what you have with that file.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I am sorry if these questions have already been answered.

 

1. How do I change how the discount appeared on the order confirmation page? I want the subtotal before the discount. I also want to bold or underline the coupon #.

ex:

Discount Coupon 5 applied: -$5.00

Customer Pickup (Local Customers): $0.00

Sub-Total: $16.95

Total: $11.95

 

2. I unable to go back and edit a coupon.

 

HELP Please.......

 

 

Please read the manual, as both of these questions are answered. You can edit the text in the module settings, and you cannot edit certain fields for existing coupons.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

hello,

 

my site is bowhuntgear.com . we've recently upgraded from a cart software called line9 to oscommerce, and i'm kinda disappointed that it doesn't have the same coupon code functionality.

 

what we want is a way to make coupon codes that will give discounts on particular items, instead of on the total amount of one's cart. is there a better way to do this or not? if not, such an add-on would be GREATLY appreciated.

Link to comment
Share on other sites

I am sorry if these questions have already been answered.

 

1. How do I change how the discount appeared on the order confirmation page? I want the subtotal before the discount. I also want to bold or underline the coupon #.

ex:

Discount Coupon 5 applied: -$5.00

Customer Pickup (Local Customers): $0.00

Sub-Total: $16.95

Total: $11.95

 

2. I unable to go back and edit a coupon.

 

HELP Please.......

 

Check your manual to see if you can have the sub-total show before discount and total afterwards - but you can change the order they appear through your Admin->Modules->Order Total by changing the Sort Order :thumbsup:

~Tracy
 

Link to comment
Share on other sites

I cannot see how the code you posted can possibly give these results. I have also downloaded the contribution and looked at the code, and I still cannot see what could be wrong. When I run the report against my orders with discounts, the results are perfectly correct. Did you ever modify this file? Try downloading the most recent version and replacing what you have with that file.

 

My error.

I could never get the 1.5 version to work (stats_batch_report.php). It would not show any purchases at all.

 

So I uninstalled it and installed the 1.01 (cc_card_report.php).

 

So I am unable to get either contrib to work.

They are as straightforward as can be but I have spent hours trying to get them to work. This is the final contrib (besides anti-robot) for me to get working before going live tonight. I have installed over 20 contribs on my store. Probably contribbed out and missing something easy.

 

Since you have a credit card batch report to work on your site with the discount contrib, please give me the name of the zip file you downloaded for the ccbr contrib. It is somewhat confusing because there are two contribs with same name but different zip files and a 3rd zip.

 

Credit_Card_Bacth_Report_v1.01.zip

Credit_Card_Batch_Report_v1.01_1.zip

Credit_Card_Batch_Report_v1.5.zip

 

Sorry for bugging you on this.

Link to comment
Share on other sites

My error.

I could never get the 1.5 version to work (stats_batch_report.php). It would not show any purchases at all.

 

So I uninstalled it and installed the 1.01 (cc_card_report.php).

 

So I am unable to get either contrib to work.

They are as straightforward as can be but I have spent hours trying to get them to work. This is the final contrib (besides anti-robot) for me to get working before going live tonight. I have installed over 20 contribs on my store. Probably contribbed out and missing something easy.

 

Since you have a credit card batch report to work on your site with the discount contrib, please give me the name of the zip file you downloaded for the ccbr contrib. It is somewhat confusing because there are two contribs with same name but different zip files and a 3rd zip.

 

Credit_Card_Bacth_Report_v1.01.zip

Credit_Card_Batch_Report_v1.01_1.zip

Credit_Card_Batch_Report_v1.5.zip

 

Sorry for bugging you on this.

To help keep me from being confused (easy right now), please also let me know the file name of the ccbr you are using:

cc_card_report.php

or

stats_batch_report.php

 

BTW, does the report you are using have the credit card grand totals or subtotals of orders. I would like grand totals.

Link to comment
Share on other sites

To help keep me from being confused (easy right now), please also let me know the file name of the ccbr you are using:

cc_card_report.php

or

stats_batch_report.php

 

BTW, does the report you are using have the credit card grand totals or subtotals of orders. I would like grand totals.

After more testing here is what I have come up with.

 

The stats_batch_report.php file does the totals properly including orders with discounts. YEAH!!!!!

 

But here is the problem with it and why I thought it was not working at all for me. This is not related to the discount coupon code, but I will post here since it was discussed here.

 

The Start and End date feature is not working properly (or how I would think it should work).

If you want the totals for today's date (the same day that the sales took place) , the Start date must be today and the End date must be tomorrow.

i.e. Todays date is 1/4/07 so enter 1/4/07 start 1/5/07 end

 

If you have the Start and End date the same, it will not show any totals.

i.e. Todays date is 1/4/07 so enter 1/4/07 start 1/4/07 end no totals shown

 

Not sure what happens if you run the report a few days later.

i.e. if it is 1/5/07 and you want 1/4/07 totals. If you put 1/4/07 start and 1/5/07 end, will you get the sales of 1/5/07 also? I assume not.

 

Thanks again to kgt for great help in pointing me in right direction.

Link to comment
Share on other sites

hello,

 

my site is bowhuntgear.com . we've recently upgraded from a cart software called line9 to oscommerce, and i'm kinda disappointed that it doesn't have the same coupon code functionality.

 

what we want is a way to make coupon codes that will give discounts on particular items, instead of on the total amount of one's cart. is there a better way to do this or not? if not, such an add-on would be GREATLY appreciated.

 

 

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.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I am having an odd problem with this contribution and hopefully someone out there can shed some light on what I may or may not be doing wrong.

 

I have set up a discount of $150

 

This is to cover the cost of two items and their shipping almost exactly. Whenever I run it through a test on my shopping cart, it calculates the total incorrectly. Wildly incorrectly.

 

The total for the two items together is $140. It then discounts it $120 when I need it to discount the full $140 (and the $6 shipping if that's possible)

 

Here is how I have it configured:

Desired Fixed Discount: 150.00

Max Use: 1

Min Order: $1.

Max Order: $1

Number Available: 1

 

Note: For some reason, the Max order field always defaults to the Min order field's value.

 

Now the weird thing is that when I go back and do coupons in $10 increments, it calculates everything correctly. It's only when I get into the $120-$150.

 

I've gone through about 20 pages and not found an answer. My thanks in advance.

 

 

Please comment out line 116 of includes/classes/discount_coupon.php and see if that fixes the problem.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

This contribution has little to do with shipping and this is a vague description of the problem, so it's difficult to say without more information.

 

Hi Kgt,

 

Thank you for the response!

 

I have test the contribution (Discount Coupon Code) again. It does work with table rate shipping. However, if I select the shipping charge Tax Class with YES, the shipping cost line will go missing in the billing information. See the difference is as follow.

 

Option 1: Select: Product Price With Tax, Shipping Charge Tax Class (No)

 

Discount Coupon DISCOUNT applied: -$20.00

Sub-Total: $180.00 (inc Tax)

Shipping Charge: $10.00

inc Tax: $16.36

Total: $190.00

 

Option 2: Select: Product Price With Tax, Shipping Charge Tax Class (Yes)

 

Discount Coupon DISCOUNT applied: -$20.00

Sub-Total: $180.00 (inc Tax)

Tax: $16.36(10%)

Total: $180.00

 

 

It happens if the shipping zone is selected.

 

Also, Why the edit and remove function is not appeared in admin. area?

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?

Edited by lcc
Link to comment
Share on other sites

I'm preparing to install Discount Coupon Code 2.1 and the installation instructions list some files to modify in the Catalog folder. I do not have a catalog folder. The files that it list to modify are in the root of my shop folder. Any suggestions?

Link to comment
Share on other sites

I'm preparing to install Discount Coupon Code 2.1 and the installation instructions list some files to modify in the Catalog folder. I do not have a catalog folder. The files that it list to modify are in the root of my shop folder. Any suggestions?

 

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:

~Tracy
 

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