Jump to content
kgt

[Contribution] Discount Coupon Codes

Recommended Posts

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

 

http://www.oscommerc...tributions,4269

 

 

 

Hii KGT

 

First i want to thank you for your grate contribution Discount coupon code module. I already installed that. But im having problem passing discounted total to paypal

 

Im using osCommerce 2.2-MS2 with osCommerce_PayPal_IPN_v2.3.3 and KGT Discount coupon code module dc_autoinstaller_2.14_2_1

 

And i did some changes found on forum.

But still my discount amount does not transfer to paypal.Posted Image It shows total amount without applying Discount percentage.

When i try with bank transfer payment method it shows correct amount. If i used paypal payment method after first using

bank transfer payment method, then paypal also shows correct discounted total amount.

But if i try paypal as a payment method at the first place, it doesn't show discounted total.

 

I tried installing different paypal IPNs and discount module versions. But still my problem same.

 

If you have any idea how to fix this error please help me. i really appreciate any level of help.

Thank you so much in advance.

 

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

i did following changes.

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

 

 

1) I selected aggregate instead of individual On transaction type.

 

 

 

2)

 

FIND around line 195:

 

//+1.4

$sql_data_array = array('orders_id' => $insert_id,

'orders_status_id' => $order->info['order_status'],

'date_added' => 'now()',

'customer_notified' => '0',

'comments' => $order->info['comments']);

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

//-1.4

 

 

 

ADD this code after:

 

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && is_object( $order->coupon ) ) {

$sql_data_array = array( 'coupons_id' => $order->coupon->coupon['coupons_id'],

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

 

 

 

FIND around line 493:

 

// unregister session variables used during checkout

tep_session_unregister('sendto');

tep_session_unregister('billto');

tep_session_unregister('shipping');

tep_session_unregister('payment');

tep_session_unregister('comments');

 

 

 

ADD this code after:

 

//kgt - discount coupons

tep_session_unregister('coupon');

//end kgt - discount coupons

 

 

3)

 

FOLLOWING CODE:

 

 

if(MOVE_TAX_TO_TOTAL_AMOUNT == 'True') {

$parameters['amount'] = number_format(($subtotal + $order->info['tax']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

} else {

// default

$parameters['amount'] = number_format($subtotal * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

$parameters['tax'] = number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

}

 

 

Updated to THIS :

 

 

if(MOVE_TAX_TO_TOTAL_AMOUNT == 'True') {

if (isset($order_total['ot_gv']) || isset($order_total['ot_coupon'])) {

//the discount will apply to the order total

$parameters['amount'] = number_format((($subtotal + $order->info['tax'] + $shipping) * $currencies->get_value($my_currency)) - $order_total['ot_gv'] - $order_total['ot_coupon'], $currencies->get_decimal_places($my_currency));

}else{

$parameters['amount'] = number_format(($subtotal + $order->info['tax'] + $shipping) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

}

 

} else {

// default

$parameters['amount'] = number_format(($subtotal + $shipping) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

$parameters['tax'] = number_format($order->info['tax'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));

}

Share this post


Link to post
Share on other sites

I have just installed this add-on to my web site - www.925silverexpress.com. But when I log onto my admin page and click on Catalog > Discount Coupons, it does not display the Discount Coupons configuration page. Rather, I receive the infamous HTTP 500 error message - "The website cannot dispplay the page". I have other contributions that are working. I can also access every other configuration options on the admin page. i have enabled Discount Coupons from Module > Order Total > Discount Coupon. Set the sort order to 2. As I am not great with PHP, it is difficult to know what to look for in the coupons.php file.

 

I am using OSC 2.3.1

 

Any help will be greatly appreciated.

 

Many Thanks

Edited by psseuro

Share this post


Link to post
Share on other sites

I have just installed this add-on to my web site - www.925silverexpress.com. But when I log onto my admin page and click on Catalog > Discount Coupons, it does not display the Discount Coupons configuration page. Rather, I receive the infamous HTTP 500 error message - "The website cannot dispplay the page". I have other contributions that are working. I can also access every other configuration options on the admin page. i have enabled Discount Coupons from Module > Order Total > Discount Coupon. Set the sort order to 2. As I am not great with PHP, it is difficult to know what to look for in the coupons.php file.

 

I am using OSC 2.3.1

 

Any help will be greatly appreciated.

 

Many Thanks

 

i have sorted the issue. I went through /admin/coupon.php again and discovered these two reference lines at the very top:

require('includes/application_top.php');

require( DIR_WS_FUNCTIONS.'coupons.php' );

 

Upon checking my /admin/includes/functions/ directory, somehow Ifailed to copy the 'coupons.php' file to that directory.Copying the 'coupons,php' to the /admin/functions/ directory, I can now open the Discount Coupons page and create a coupon.

Share this post


Link to post
Share on other sites

Hi,

 

I'm having a problem with the installation. In the Admin side I didn't have a problem, the module is installed, and I can Add/Edit new codes, but on the catalogue I can't see anywhere to enter the coupon code, it's not displaying at all, and I don't really know how to troubleshoot. I've double checked all the code changes have been made to all files and can't see anything missing and don't get an error anywhere, can you give me some ideas on where to look for problems!

 

Many thanks!

Share this post


Link to post
Share on other sites

At oscommerce 2.2MS2 control panel, when click at Catalog > Discount coupons, facing this issue:

 

Access Denied  

No Right Permission Access
Please contact your Web Administrator to request
more access or if you found any problem.

 

Try to makes /includes & /admin folder all files permission to 777, still can't solve it.

 

Any suggestion?

 

Many thanks in advance!

Share this post


Link to post
Share on other sites

Hi.

 

I have installed version 3.34 of this contribution together with the last two fixes on a 2.2rca shop and everything just works fine as far I can see. My only question is:

 

Has anybody achieved to link coupons to the order # a coupon has been used with? Is there any sollution if I would like to see for which order numbers a specific coupon code has been used with? Or even better: Is there a way to link the coupon to the products that it was used to purchase?

 

Any hint will be greatly appreciated.

tom

Edited by Tom172

Share this post


Link to post
Share on other sites

i solve my own question.

 

 

Access Denied

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem.

 

at admin, adminstrator, exclude file ( store/admin/admin_files.php ) , store the nessesary file under module folder.

Share this post


Link to post
Share on other sites

Hi everybody,

 

I am very new to all this and I am trying to install discount codes 3.4. I added the new files and manually added the code for existing ones. The website seems fine but in the admin panel when I click on the Discount Coupon under catalog I get the following error

 

[an error occurred while processing this directive]

 

I have no idea where to go from here. I have restored my files,tried it over and over and keep getting same error. I am running v2.2 rc2

 

Any help is greatly appreciated,

 

Dave

Share this post


Link to post
Share on other sites

Hi All,

 

Just installed this add on and all seems to be working ok except for one thing. I have set up a discount code to apply a £5 discount if the order total is above £20. The module is setup to allow product specials.

 

I have a product in my store:

Original Price: £21

Special Price: £15

 

If I add only this product to my basket and try to checkout using the discount code, it does NOT give me a message saying that the order total is too low to use this discount code. It applies the £5 discount to the sub total so that the total for the customer to pay is £10.

 

If I change the discount code to have minimum order total of £22, then I get the error message saying that this discount code will only work for order totals above £22 which is correct.

 

I assume that when this module is calculating the order total, it is calculating using the 'original' price of the item rather than the 'specials' price if it exists and this is why in the scenario when the minimum order total is set to £20, it does not give me the error message that the order total is too low.

 

Has anyone come across this issue and have you found a way around it?

 

I have been trying to find where the total is calculated and have looked in 'includes\classes\discount_coupon.php' but not been able to find where the order total is calculated.

 

Any help is much appreciated! thumbsup.gif

 

Thanks

Share this post


Link to post
Share on other sites

Hi All,

 

Just installed this add on and all seems to be working ok except for one thing. I have set up a discount code to apply a £5 discount if the order total is above £20. The module is setup to allow product specials.

 

I have a product in my store:

Original Price: £21

Special Price: £15

 

If I add only this product to my basket and try to checkout using the discount code, it does NOT give me a message saying that the order total is too low to use this discount code. It applies the £5 discount to the sub total so that the total for the customer to pay is £10.

 

If I change the discount code to have minimum order total of £22, then I get the error message saying that this discount code will only work for order totals above £22 which is correct.

 

I assume that when this module is calculating the order total, it is calculating using the 'original' price of the item rather than the 'specials' price if it exists and this is why in the scenario when the minimum order total is set to £20, it does not give me the error message that the order total is too low.

 

Has anyone come across this issue and have you found a way around it?

 

I have been trying to find where the total is calculated and have looked in 'includes\classes\discount_coupon.php' but not been able to find where the order total is calculated.

 

Any help is much appreciated! thumbsup.gif

 

Thanks

 

Hi all,

 

I managed to find a solution to this. I found that in the check_coupons_min_order() function in 'includes\classes\discount_coupon.php', it was adding the discount value to the order total before checking if the order total was above the threshold set for the discount coupon.

 

I commented out the following lines and it all seems to work ok.

 

foreach( $this->applied_discount as $discount ) {
		  $subtotal += $discount;
 }

 

Can anyone see a reason why this would cause a problem anywhere else? Seems to work fine for me.

 

The other problem I have at the moment is that the shipping discount is not being applied. The discount amount itself is being calculated correctly as it is shown on the 'checkout confirmation' page, but it is not applied to the total.

 

I have tried this with the code fix above uncommented as well but still the same issue, so this is not happening because I commented out those lines. I'm now a bit stumped!

 

Any ideas on how to fix this?

 

Thanks

Share this post


Link to post
Share on other sites

I have a question.

I'm using discount coupon for 2 year now, but I still have a problem.

I guess normally SELECT FROM discount_coupons ORDER BY discount_coupons.coupons_number_available coupons_number_available must decrease each time we use a coupon?

No

 

Because if no way to clear my coupon list, an delete the one use?

 

Does normally coupons_number_available decrease, where this is done?

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

I have a problem. The discount is not applied to the order.

 

You can see here www.virtualdrum.co.uk/store/ the coupon code is 8ZDQ2J

 

Everything looks fine, but the 50% discount is not applied.

 

Any ideas?

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

Check the sort order of the discount module, it should be "lower" than the order total

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

They were all unique. I do not think this is the problem, maybe it is that the code never get a chance to be processed?

 

After the page where the code is entered, the customer is sent directly to paypal. shouldn't there be a refreshing of the page

to apply the discount, or to go to an order confirmation page after entering the code?

Share this post


Link to post
Share on other sites

I've got Discount Coupon Code 3.3.4 installed on 2.3.1. and got some issue's.

The problems might occure because I've also got SPPC 4.2.2. installed.

 

The problems I'm facing are:

 

Calender is not showing when I click on the Up/Down arrow when creating a Coupon in the Admin module.

 

When creating a 100% coupon code it will automatically change to 10000% rusulting in following problem.

 

When applying a 100% coupon on a product with total price € 540,- it will be shown like this:

 

Discount Coupon 12345 applied: -€ 54,000.00

Sub-Total: € -53,460.00

Total: € 0.00

 

No error message is displayed in Firefox when inserted a wrong coupon code. I will see a red box on the right top in the browser. In IE 9 it is working fine.

 

Any help will be appreciated.

 

Thanks.

Share this post


Link to post
Share on other sites

I've got Discount Coupon Code 3.3.4 installed on 2.3.1. and got some issue's.

The problems might occure because I've also got SPPC 4.2.2. installed.

 

The problems I'm facing are:

 

Calender is not showing when I click on the Up/Down arrow when creating a Coupon in the Admin module.

 

When creating a 100% coupon code it will automatically change to 10000% rusulting in following problem.

 

When applying a 100% coupon on a product with total price € 540,- it will be shown like this:

 

Discount Coupon 12345 applied: -€ 54,000.00

Sub-Total: € -53,460.00

Total: € 0.00

 

No error message is displayed in Firefox when inserted a wrong coupon code. I will see a red box on the right top in the browser. In IE 9 it is working fine.

 

Any help will be appreciated.

 

Thanks.

 

I've got the problem with the 100% discount sorted. Always read first before you start.

Forgot to read this line:

 

For percentage or shipping discounts, enter a percentage as a decimal. Example: .10 for 10%

Share this post


Link to post
Share on other sites

I've got Discount Coupon Code 3.3.4 installed on 2.3.1. and got some issue's.

The problems might occure because I've also got SPPC 4.2.2. installed.

 

The problems I'm facing are:

 

Calender is not showing when I click on the Up/Down arrow when creating a Coupon in the Admin module.

 

When creating a 100% coupon code it will automatically change to 10000% rusulting in following problem.

 

When applying a 100% coupon on a product with total price € 540,- it will be shown like this:

 

Discount Coupon 12345 applied: -€ 54,000.00

Sub-Total: € -53,460.00

Total: € 0.00

 

No error message is displayed in Firefox when inserted a wrong coupon code. I will see a red box on the right top in the browser. In IE 9 it is working fine.

 

Any help will be appreciated.

 

Thanks.

 

Just one issue left.

The problem with the calander was caused by the css links. Recovered them, and it worked fine.

 

Only the problem with the error message in Firefox is still occurring.

Also got one more issue.

 

You should be able to set the dates to 'unlimited'. When you leave them blank they should be unlimited.

But when I'm leave them blank, it will automatically change to 00/00/0000 and therefore the Discount Coupon will be invalid.

Share this post


Link to post
Share on other sites

I am trying to develop the website and I put in the codes for this. My checkout_payment page is coming up with a blank white screen. No errors and no options. I have re-read and re-done the instructions that was provided and yet they still don't seem to work. I have uploaded the code to the checkout_payment.php file. Any advice would be great. This is with discount 3.3.4 on OSC 3.2.1

checkout_payment.php

Share this post


Link to post
Share on other sites

I installed this contribution before and my site got hacked. I tried to reinstall but still receive the same problem. Under admin/module/order total. It will not let me update the installation and under admin/catalog when I click on the discount coupon link I receive a "0". Any ideas.

 

Thanks for the help

Share this post


Link to post
Share on other sites

OK, I got the checkout screen to work and it's showing the discount code. However, the previous screen (checkout_shipping.php) is adding $10 for shipping. When I now go to checkout_payment.php, there are no shipping charges at all. Any Ideas? Attached is the new checkout_payment.php code.checkout_payment.php

Share this post


Link to post
Share on other sites

I have tried this and it asked me for an API key .. Well I not using that so is there a work around or do I need to work it out my self ?

Share this post


Link to post
Share on other sites

Right well, after a few more beers, I've managed to sort it...

 

I just added in checkout_payment.php - in the upper part of the code, right after the payment classes are declared, a default payment.

 

// load all enabled payment modules
 if ($order->info['total'] <= 0) {
$payment = 'freeofcharge';
if (!tep_session_is_registered('payment')) tep_session_register('payment');
tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
}

 

Took me all day to figure this out, but now I'm happy :-)

 

Let me know if you want the instructions...

 

I am trying to accomplish this exact same thing with the Free Product payment and the Discount coupon code contributions. What luck to stumble onto your posts! Can you send me the consolidated instructions?? I'm desperate!

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

×