Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

i have a problem.. I just installed this contribution.. which i cant wait to use :)

 

Uploaded all the files, used the php query text on the readme to create the tables every thing looks great and works admin side... except

 

when i am checking out on the store it get the following on page http://www.markedfordeathpaintball.com/cat...out_payment.php

 

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/content/M/i/x/MixmasterChris/html/catalog/includes/header.php:149) in /home/content/M/i/x/MixmasterChris/html/catalog/includes/boxes/categories.php on line 13

 

 

i really need some help.. right now no one can checkout on my store

 

thanks!

Link to comment
Share on other sites

Hello again

 

I dindn't get any answer and therefore I have tried it and it works :) but I have some questions

 

1) if a coupon has Number Available = 1. customer write this coupon code in checkout_payment page and then is forwarded to checkout_confirmation page at this time the coupon information is written in discount_coupons_to_orders table (which is used to check whether the coupon is still available to use - if coupon entity in this table < number available then this copuon can be used.) and if at this time customer can buy something before he press to confirm order button. but in this case he can not use this coupon because it is already written in the table. (even if customer don't use it yet)

 

is this a bug? should we take insert table part in checkout_confirmation page? do I think something wrong?

 

2) I use paypal_ipn 2.2 and I have tried the both code (one of them is in contribution page added by kqt) and as following

 

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && $order->info['coupon'] != '' ) {

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

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

but in the readme file of Discount Coupon Codes 3.0 version there is something else

 

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->code,

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

 

I have tried the both of them but in any case the coupon information didn't write in the discount_orders table and then I have tried it with the following code

 

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

and it works. can anybody check this failures give me a feedback??

 

many thanks

 

best regards

 

 

has anybody checked these errors?

 

will be very happy if I get an answer :)

 

best wishes

Link to comment
Share on other sites

Hello again

 

I dindn't get any answer and therefore I have tried it and it works :) but I have some questions

 

1) if a coupon has Number Available = 1. customer write this coupon code in checkout_payment page and then is forwarded to checkout_confirmation page at this time the coupon information is written in discount_coupons_to_orders table (which is used to check whether the coupon is still available to use - if coupon entity in this table < number available then this copuon can be used.) and if at this time customer can buy something before he press to confirm order button. but in this case he can not use this coupon because it is already written in the table. (even if customer don't use it yet)

 

is this a bug? should we take insert table part in checkout_confirmation page? do I think something wrong?

 

2) I use paypal_ipn 2.2 and I have tried the both code (one of them is in contribution page added by kqt) and as following

 

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && $order->info['coupon'] != '' ) {

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

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

but in the readme file of Discount Coupon Codes 3.0 version there is something else

 

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->code,

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

 

I have tried the both of them but in any case the coupon information didn't write in the discount_orders table and then I have tried it with the following code

 

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

and it works. can anybody check this failures give me a feedback??

 

many thanks

 

best regards

 

 

has anybody checked these errors?

 

will be very happy if I get an answer :)

 

best wishes

Link to comment
Share on other sites

Hi there!

 

I'm still fighting with my problem of discount not being taken in account in the subtotal...

 

kgt was asking me if I had altered the shop with some other contribution..

 

I didnt alter the checkout process was itself. However I added some contribution as payment module (EU bank transfer) and shipping (mtmz).

Other contribution are not related to the checkout process so I guess they should not interfere with this process right?

 

thanks for the advices

Link to comment
Share on other sites

have a problem.. I just installed this contribution.. which i cant wait to use smile.gif

 

Uploaded all the files, used the php query text on the readme to create the tables every thing looks great and works admin side... except

 

when i am checking out on the store it get the following on page http://www.markedfordeathpaintball.com/cat...out_payment.php

 

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/content/M/i/x/MixmasterChris/html/catalog/includes/header.php:149) in /home/content/M/i/x/MixmasterChris/html/catalog/includes/boxes/categories.php on line 13

 

 

i really need some help.. right now no one can checkout on my store

 

thanks!

Link to comment
Share on other sites

anyone? i really need some hlep here my store was fine until i added this contribution.. now im pretty much stuck and my store cant check anyone out

Link to comment
Share on other sites

Hi, what file is this change for? I need to fix this right away!

 

I installed this contrib and I get

Sub-Total: $220.75

Discount: May coupon applied: -$10.00

Standard (First-Class Mail): $6.00

Total: $226.75

 

And not $216.75

 

Besides this I didn't have any other errors. Since this customer paid with a credit card I'm able to run the corrected total.

 

Thanks for the contrib and any advice in advance

~Sharon

 

 

Please double check your module settings in Modules > Order Total > Discount Coupon. You need to tell the module not to apply the discount to the subtotal if that's what you want.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hello again

 

I dindn't get any answer and therefore I have tried it and it works :) but I have some questions

 

1) if a coupon has Number Available = 1. customer write this coupon code in checkout_payment page and then is forwarded to checkout_confirmation page at this time the coupon information is written in discount_coupons_to_orders table (which is used to check whether the coupon is still available to use - if coupon entity in this table < number available then this copuon can be used.) and if at this time customer can buy something before he press to confirm order button. but in this case he can not use this coupon because it is already written in the table. (even if customer don't use it yet)

 

is this a bug? should we take insert table part in checkout_confirmation page? do I think something wrong?

 

2) I use paypal_ipn 2.2 and I have tried the both code (one of them is in contribution page added by kqt) and as following

 

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && $order->info['coupon'] != '' ) {

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

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

but in the readme file of Discount Coupon Codes 3.0 version there is something else

 

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->code,

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

 

I have tried the both of them but in any case the coupon information didn't write in the discount_orders table and then I have tried it with the following code

 

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

and it works. can anybody check this failures give me a feedback??

 

many thanks

 

best regards

 

 

The code that inserts the coupon as "used" in the discount_coupons_to_orders table should be in checkout_process.php. If you have it in checkout_confirmation.php, then you edited the files incorrectly.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I just installed this contib and it works up to checkout_confirmation.php.

 

It shows the coupon being applied with the correct discount, but after clicking the confirm order button the order finishes properly, but the order is does not have the discount applied so my customer gets charged the full amout of the order.

 

I am using paypal website payments pro.

 

For some reason, when it submits and completes the order, it loses the discount and they are charged the full amount.

 

 

I haven't used website payments pro, so I'm not sure how it works, so I can't really answer this.

 

If you use paypal normally, you must use aggregate totals for the discount to display, because paypal doesn't have any way to accept discount lines.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

lol okay fixed that ..

 

the coupon codes work but paypal cart doesnt reflect the coupon

 

 

Your other problem is likely related to the fact that you're using a template, which I can't really help you with.

 

The paypal problem depends on how you have your store and paypal set up. Paypal must accept only aggregate totals from osCommerce since they have no way of accepting a discount line.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Ok point 2 is irrelevant then...

 

back to point 1 then

I didnt alter the checkout process was itself. However I added some contribution as payment module (EU bank transfer) and shipping (mtmz).

Other contribution are related to the checkout process so I guess they should interfer with this process right?

 

Thanks for the super fast reply BTW!

 

 

Do you have your module set to apply the discount to the subtotal? Modules > Order Total > Discount Coupons. If it's set to true, the discount has already been applied to the subtotal.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hi,

 

I've pretty sure i made all the changes, i just tried the file bundled with the contribution and that didn't make the debug work either?

 

I do have a min order contrib installed but was pretty sure I was above my limit for that. But I've just come accross it again actually, I had enough order value to get past my min value check so got to checkout, put in the coupon and instead of getting a error message on checkout process i get taken back to the cart (is this because the orde-total would have been changed with the discount), even by bumping up the value of the cart i can't get back to the checkout?

 

On a new issue I tried a fixed discount of £3.00, it comes up on the checkout page as 3.22? (this is with the discount_coupon bundled with V3.)

When i have a product total of 11.97 the £3.00 turned into £3.32, when i had £15.96 it turned into £3.37?

 

Also how does the minimum order value work as a order total price. I had some items in the cart that added up to a sub-total of £19.98 (£17.00exVAT @17.5%) and had a coupon min order set to £19.00 - this worked. I change the coupon min value to £19.01 and it doesn't allow me to use it? The grand total with the discount should be £21.48 inc postage. I can't see where £19.00 comes into it?

I thought maybe it rounded up to the nearest pound so I tried another one. This time an order total inc VAT of £27.97 (£25.51 exVAT) should give a grand total with discount of £30.47 after postage. I tried £28.50 which worked but £28.60 didn't so the cut-off point was somewhere in between?

What does it check the min order total against?

 

In relation to my previous question regarding the seamingly wrong breakdown of costs (I know one problem at a time!).

Using the discount_coupon that came with V3 (not the latest bugfix)

With 'Display subtotal with applied discount?' set to true:

 

Values seem corrrect for a discount of 10% (my TAX is 17.5%)

 

Now with 'Display subtotal with applied discount?' set to false:

The grand total is correct but the VAT and sub-total Excl. are wrong. VAT should be £2.41. (£2.17 is actually 15.5% of £14.00)

It seems all to work when 'Display subtotal with applied discount?' is set to true which is fine I just don't know why it's not working when set to false. it seems the sub_total ex VAT is dividing the product of 16.17 total by 1.155 to give 14.00 and then the VAT is 16.17-14.00.

When I was using the new discount_coupons bugfix version the grand total was always wrong by several tens of pence. I can't think straight anymore so I'm going to go home :) Any help/infomation would be greatly appreciated.

 

Hope you can follow all this-i've been at it all day!

 

Many Thanks

 

Becki

 

 

I'm going to need that debug printout before I can get any farther with this.

 

In checkout_confirmation.php, change this line:

 

if( MODULE_ORDER_TOTAL_DONATION_DEBUG == 'true' ) print_r( "<!-- Donations DEBUG\n".print_r( $order, true )."\nEnd Donations DEBUG-->" );

 

to this:

 

print_r( "<!-- Donations DEBUG\n".print_r( $order, true )."\nEnd Donations DEBUG-->" );

 

And then View Source in your browser to get the output. Send that to me in an email please and I will take a look at it.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

I haven't used website payments pro, so I'm not sure how it works, so I can't really answer this.

 

If you use paypal normally, you must use aggregate totals for the discount to display, because paypal doesn't have any way to accept discount lines.

 

I added the option for pay by check to help eliminate paypal as a problem. I get the same results.

 

Could the multi vendor contribution be part of the problem?

 

Any other ideas for something else for me to check?

 

Thanks,

Brian

Link to comment
Share on other sites

I added the option for pay by check to help eliminate paypal as a problem. I get the same results.

 

Could the multi vendor contribution be part of the problem?

 

Any other ideas for something else for me to check?

 

Thanks,

Brian

 

 

MVS could be the problem, but I don't think it is.

 

The discount should be applied to the total in includes/classes/order.php. Double check your changes to that file, especially the last block of code that needs to be added. That last block is where the discount is actually applied to the order lines.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

MVS could be the problem, but I don't think it is.

 

The discount should be applied to the total in includes/classes/order.php. Double check your changes to that file, especially the last block of code that needs to be added. That last block is where the discount is actually applied to the order lines.

 

I got it working good now.

 

I went back for a third time and re-checked all of the code I inserted. It looks like I overlooked this one thing, more than once I guess looking at it a couple of days later helped.

 

In checkout_confirmation.php

 

After this block of code is where I went wrong:

 

if (is_array($payment_modules->modules)) {

$payment_modules->pre_confirmation_check();

}

 

I placed the new code before "}" and not after it as listed in the instructions.

 

Thanks for the help and great contribution!!!

 

I am using the paypal website payments pro contribution. If a customer uses express checkout, they don't go to the traditional payment page so they don't get a chance to enter the coupon.

 

Maybe a new addition to this module would be to add the coupon redemtion in the shopping cart. Have it show the box to enter the coupon in the shopping cart and click a button that says apply coupon to order, then once the button is clicked, it would refresh the screen showing the shopping cart again, but with the coupon applied. This way the coupon would be able to be used for express checkout users. Could you show me how to implement this feature?

 

Thanks,

Brian

Link to comment
Share on other sites

Hi all,

 

I've installed DCC and can see it both in the Modules and Catalog boxes within the admin panel. I've added a discount code and ensured all the settings are correct. I've also made sure that discounts are displayed in a unique sort order. The box for "do you have a coupon" is showing on the correct page and I'm not getting any error message even in the nav bar when I pass this page even though I have debug mode on.

 

The discount doesn't apply and doesn't show at all in the next page although everything else does (shipping, sub-total, giftwrap etc). Additionally I had this warning after trying to enter the coupon:

 

Warning: Missing argument 2 for discount_coupon() in /home/idfreshc/public_html/includes/classes/discount_coupon.php on line 18

 

Here's a snippet of my code from this file:

 

  class discount_coupon {

  var $messages, $coupon, $applied_discount, $cart_info;

  function discount_coupon( $code, $delivery ) {
		$this->messages = array();
		$this->coupon = array();
  $this->applied_discount = array();
  $this->cart_info = array( 'valid_products' => array( 'count' => 0, 'line_items' => 0, 'total' => 0 ),
							'total_products' => array( 'count' => 0, 'line_items' => 0, 'total' => 0 ),
							'exclusions' => array() );
		$this->get_coupon( $code, $delivery );

 

I need to have this running by tonight as the website will 'go live' tomorrow morning so as I'm sure you know, all and any help is very appreciated!! Let me know if anyone has any idea how to rectify this error :)

Link to comment
Share on other sites

The code that inserts the coupon as "used" in the discount_coupons_to_orders table should be in checkout_process.php. If you have it in checkout_confirmation.php, then you edited the files incorrectly.

 

Hi kgt

 

no I have the code that inserts the coupon as "used" in the discount_coupons_to_orders table in checkout_process.php as it is described in installation file. and it works fine with creditcard but my question is related with ipn 2.2 module.

 

if we choose paypal_ipn as payment type then the code is not forwarded to the checkout_process.php after checkout_confirmation.php instead it is forwarded to the paypal page. and the problem is following

if we choose paypal ipn the coupon is inserted in the discount_coupons_to_orders table before we go to to the checkout_confirmation page. and in checkout_confirmation page we have the chance to go to shopping cart and buy something else. but this means this coupon will be inserted 2 times to the table and if this coupon can only be used 1 time in the shop it causes a failure and we can not use it .

 

I hope that I can explain my problem.

 

If I couldn't please try the following then you will understand it :)

create a coupon with Number Available = 1

than buy somethin in the shop in checkout_payment choose the paypal ipn. type your coupon code and continue

now in checkout_confirmation page click the Cart Contents and buy something and go to checkout_payment page

and this time you can not use your code because it is already written in the table. an d it means you can not use this coupon.

 

how can we fix this? do you have any suggestion?

 

thanks a lot

Link to comment
Share on other sites

Still stuck on this if anyone can help? :(

 

Hi all,

 

I've installed DCC and can see it both in the Modules and Catalog boxes within the admin panel. I've added a discount code and ensured all the settings are correct. I've also made sure that discounts are displayed in a unique sort order. The box for "do you have a coupon" is showing on the correct page and I'm not getting any error message even in the nav bar when I pass this page even though I have debug mode on.

 

The discount doesn't apply and doesn't show at all in the next page although everything else does (shipping, sub-total, giftwrap etc). Additionally I had this warning after trying to enter the coupon:

 

Warning: Missing argument 2 for discount_coupon() in /home/idfreshc/public_html/includes/classes/discount_coupon.php on line 18

 

Here's a snippet of my code from this file:

 

  class discount_coupon {

  var $messages, $coupon, $applied_discount, $cart_info;

  function discount_coupon( $code, $delivery ) {
		$this->messages = array();
		$this->coupon = array();
  $this->applied_discount = array();
  $this->cart_info = array( 'valid_products' => array( 'count' => 0, 'line_items' => 0, 'total' => 0 ),
							'total_products' => array( 'count' => 0, 'line_items' => 0, 'total' => 0 ),
							'exclusions' => array() );
		$this->get_coupon( $code, $delivery );

 

I need to have this running by tonight as the website will 'go live' tomorrow morning so as I'm sure you know, all and any help is very appreciated!! Let me know if anyone has any idea how to rectify this error :)

Link to comment
Share on other sites

Please help.

 

I just installed the contrib and if i go to checkout i get this error:

1054 - Unknown column 'coupons_date_start' in 'where clause'

 

SELECT dc.* FROM discount_coupons dc WHERE coupons_id = '125' AND ( coupons_date_start <= CURDATE() OR coupons_date_start IS NULL ) AND ( coupons_date_end >= CURDATE() OR coupons_date_end IS NULL )

 

[TEP STOP]

 

If i click in the admin area on Discount Coupons i get this error:

 

1054 - Unknown column 'cd.coupons_date_end' in 'order clause'

 

select * from discount_coupons cd order by cd.coupons_date_end, coupons_date_start limit 0, 30

 

[TEP STOP]

 

Please help me because my customers can't order properly anymore.

 

Thanks Desiree

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