Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Discount Coupon Codes


kgt

Recommended Posts

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

 

 

Please review the changes you made to includes/classes/order.php and be sure you have all of the code included in the install instructions.

 

Also, if you have debug mode on, error messages will not work, as it says in the description of the debug module setting.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

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

 

 

Did you make edits to the paypal_ipn file? See, if the checkout process never gets to checkout_process.php, then the coupon code CANNOT be inserted into the table. It's not happening magically. That means you have edited the paypal_ipn file, which is where this is being inserted. My support for paypal IPN is limited - it's a payment module that pretty thoroughly alters the checkout process and I don't have time to keep up with all the versions of it. Double check the code you entered in that file. If you cannot figure it out, you may email it to me and I will see if I can fix it.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Did you make edits to the paypal_ipn file? See, if the checkout process never gets to checkout_process.php, then the coupon code CANNOT be inserted into the table. It's not happening magically. That means you have edited the paypal_ipn file, which is where this is being inserted. My support for paypal IPN is limited - it's a payment module that pretty thoroughly alters the checkout process and I don't have time to keep up with all the versions of it. Double check the code you entered in that file. If you cannot figure it out, you may email it to me and I will see if I can fix it.

 

Hi kqt,

thanks for your answer

 

I have read from your Readme file how I shold edit paypal_ipn and then I have made this edit but with this code in the discount_order table only order id is written (no coupon code) and therefore a coupon can be used always. therefore I have written in the paypal_ipn after this code

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

 

following code (I have changed your code because it doesn't write any coupon Id)

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 );

}

 

but in this case the coupon is inserted to table now and this cause the problem I have said.

can you please explain me how should the logic be to use copuon with paypal ipn? maybe I understand something wrong.

 

if I understand it correctly the code never goes to the checkout_process.php if we choose paypal_ipn???

 

thanks again

Link to comment
Share on other sites

Hi kqt,

thanks for your answer

 

I have read from your Readme file how I shold edit paypal_ipn and then I have made this edit but with this code in the discount_order table only order id is written (no coupon code) and therefore a coupon can be used always. therefore I have written in the paypal_ipn after this code

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

 

following code (I have changed your code because it doesn't write any coupon Id)

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 );

}

 

but in this case the coupon is inserted to table now and this cause the problem I have said.

can you please explain me how should the logic be to use copuon with paypal ipn? maybe I understand something wrong.

 

if I understand it correctly the code never goes to the checkout_process.php if we choose paypal_ipn???

 

thanks again

 

 

If you add the code that inserts into discount_coupons_to_orders to the checkout_confirmation page, what do you expect to happen??? You need to fix the code in the paypal IPN file. Some versions of that use $insert_id as the order id, some use $order_id, etc. It's too much for me to keep up with. You may email me your paypal_ipn file and I will take a look at it.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Please review the changes you made to includes/classes/order.php and be sure you have all of the code included in the install instructions.

 

Also, if you have debug mode on, error messages will not work, as it says in the description of the debug module setting.

 

 

Good man, as I hadn't changed anything in order.php I decided just to upload the pre-modified file that you provided in the DCC 3.0 package. I've tested it out with all shipping methods, with gift-wrap added, gift-wrap not added .. every scenario you can think of and it seems to be working just fine.

 

Very very happy with this module, I think you've done an excellent job spending time away from your consultancy to make it and I feel the users who make profit from it should make a few more donations for the time spent writing and re-writing the code. I'll send a donation over once I get a second ;)

 

Thanks again kgt,

 

 

Alan-Paul

[email protected]

Edited by idfresh
Link to comment
Share on other sites

Good man,
Woman. ;)
Good man, as I hadn't changed anything in order.php I decided just to upload the pre-modified file that you provided in the DCC 3.0 package. I've tested it out with all shipping methods, with gift-wrap added, gift-wrap not added .. every scenario you can think of and it seems to be working just fine.

 

Very very happy with this module, I think you've done an excellent job spending time away from your consultancy to make it and I feel the users who make profit from it should make a few more donations for the time spent writing and re-writing the code. I'll send a donation over once I get a second ;)

 

Thanks again kgt,

Alan-Paul

[email protected]

 

 

Thanks for the words of encouragement - support provided on this forum is free of course, and sometimes it's difficult to keep up with everyone's needs. As those who helped me test this latest version know, it's actually quite a long testing and debugging process to get a contribution like this working to the point where I feel it's stable enough to support. It's good to know it has largely been a problem-free release. That tells me the time and effort spent before publishing this latest version has been worth it.

 

Thanks to all who have helped out by testing and providing feedback.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hello all, just wanted to share some point of views with my addition to this great module. I added the special price exclusion mod to it, as per the contribution page. I have not had the time to throw up all the modifications I have made to the shopping cart, but this one I believed would be important for people who needed it. This mod I would say should (as I think) be added to the next release of this contribution, all it is lacking is admin support to switch it on and off if a user wishes. I have not had the time to fullfill that into the code, as my needs were simple enough to have this running all the time.

 

If you wish, when I have the time, I can add that support into it so it will be easier to throw into the next release?

-Jon

Link to comment
Share on other sites

Hello all, just wanted to share some point of views with my addition to this great module. I added the special price exclusion mod to it, as per the contribution page. I have not had the time to throw up all the modifications I have made to the shopping cart, but this one I believed would be important for people who needed it. This mod I would say should (as I think) be added to the next release of this contribution, all it is lacking is admin support to switch it on and off if a user wishes. I have not had the time to fullfill that into the code, as my needs were simple enough to have this running all the time.

 

If you wish, when I have the time, I can add that support into it so it will be easier to throw into the next release?

-Jon

Link to comment
Share on other sites

Hello all, just wanted to share some point of views with my addition to this great module. I added the special price exclusion mod to it, as per the contribution page. I have not had the time to throw up all the modifications I have made to the shopping cart, but this one I believed would be important for people who needed it. This mod I would say should (as I think) be added to the next release of this contribution, all it is lacking is admin support to switch it on and off if a user wishes. I have not had the time to fullfill that into the code, as my needs were simple enough to have this running all the time.

 

If you wish, when I have the time, I can add that support into it so it will be easier to throw into the next release?

-Jon

 

 

Is your contribution different from the module option that is already there for the 3.0 version to exclude specials? I'm just not sure I know what the difference is. I'm delighted to incorporate it into the whole package if it there's a difference.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Is your contribution different from the module option that is already there for the 3.0 version to exclude specials? I'm just not sure I know what the difference is. I'm delighted to incorporate it into the whole package if it there's a difference.

 

 

lol I guess I have not been watching for updates like I should of. Oh well I am just glad I was able to get more coding experience in.. It seems that the new release fixes that bug so the contrib I developed would be for versions under 2.0

 

Sorry for that! :-"

Link to comment
Share on other sites

Is your contribution different from the module option that is already there for the 3.0 version to exclude specials? I'm just not sure I know what the difference is. I'm delighted to incorporate it into the whole package if it there's a difference.

 

 

lol I guess I have not been watching for updates like I should of. Oh well I am just glad I was able to get more coding experience in.. It seems that the new release fixes that bug so the contrib I developed would be for versions under 2.0

 

Sorry for that! :-"

Link to comment
Share on other sites

Is your contribution different from the module option that is already there for the 3.0 version to exclude specials? I'm just not sure I know what the difference is. I'm delighted to incorporate it into the whole package if it there's a difference.

 

 

lol I guess I have not been watching for updates like I should of. Oh well I am just glad I was able to get more coding experience in.. It seems that the new release fixes that bug so the contrib I developed would be for versions under 2.0

 

Sorry for that! :-"

Link to comment
Share on other sites

There are a lot of posts and new additions to this contribution.

 

Sorry to ask this but..

 

I am not sure which contribution I should download? My site only has paypal for payment. I have os commerce

2.2...(I use the installed paypal module.)

 

Please advise..thank you.

I am a Jedi, like my father before me!

Link to comment
Share on other sites

Hello kgt

 

Thank you for this contribution.

 

All functions perfectly except the recording in the table discount_coupons_to_orders.

 

To the checkout_confirmation.php page, the reduction is well applied and when I click on confirm the order, it is not recorded in the data base.

 

Thank you for your assistance

Link to comment
Share on other sites

There are a lot of posts and new additions to this contribution.

 

Sorry to ask this but..

 

I am not sure which contribution I should download? My site only has paypal for payment. I have os commerce

2.2...(I use the installed paypal module.)

 

Please advise..thank you.

 

 

Install the 3 most recent packages made by me (kgt):

 

Discount Coupon Codes 3.0 discount_coupon class bugfix, 2 May 2007

Discount Coupon Codes 3.0 checkout_process bugfix, 26 Apr 2007

Discount Coupon Codes 3.0, 24 Apr 2007

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Hello kgt

 

Thank you for this contribution.

 

All functions perfectly except the recording in the table discount_coupons_to_orders.

 

To the checkout_confirmation.php page, the reduction is well applied and when I click on confirm the order, it is not recorded in the data base.

 

Thank you for your assistance

 

Did you install this in addition to the main package:

 

Discount Coupon Codes 3.0 checkout_process bugfix, 26 Apr 2007

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Did you install this in addition to the main package:

 

Discount Coupon Codes 3.0 checkout_process bugfix, 26 Apr 2007

 

Yes I modified this point.

 

Except scripts for the OrderCheck contribution all is indentic.

Link to comment
Share on other sites

I have no idea what this means.

 

If you use a contribution that modifies the checkout process, then that can cause this to happen. I am afraid I cannot help you without more information.

 

Here the list of the contributions installed:

 

- Automatic remove button in shopping cart = http://www.oscommerce.com/community/contributions,3326

- Login box V5.4 = http://www.oscommerce.com/community/contributions,2058

- Anti Robot Registration Validation 1.0 + images = http://www.oscommerce.com/community/contributions,1237/

- Colissimo (French Post) = http://www.oscommerce.com/community/contri...earch,Colissimo

- New Customer Emails v1.0 = http://www.oscommerce.com/community/contributions,2001/

- PDF Invoice = http://www.oscommerce.com/community/contributions,3027/

- fast easy checkout = http://www.oscommerce.com/community/contributions,3469

- Ultimate SEO URLs = http://www.oscommerce.com/community/contri...timate+seo+urls

- Previous - Next - With detailed info = http://www.oscommerce.com/community/contributions,1164/

- customers stats orders = http://www.oscommerce.com/community/contributions,2983/

- AJAX Attribute Manager = http://www.oscommerce.com/community/contributions,4063

- OrderCheck = http://www.oscommerce.com/community/contributions,1168

 

I hope that that will be able to contribute to the resolution of my problem.

 

I would be disappointed not to be able to use your contribution.

 

Where necessary I can provide you by email an access to the site with a login and a password to carry out tests.

 

Thank you for your assistance

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