Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal_Shopping_Cart_IPN


devosc

Recommended Posts

Marcus,

 

Try in catalog/includes/functions/general.php in the tep_redirect function near the top: this is change is based on a comment found here on php.net. I'll let you decide this time :D.

tep_session_close();

header('Location: ' . $url);

//tep_exit();

exit();

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

  • Replies 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Forget about the above, something is peculiar here, whether it is becasue of a race condition I'm not sure, there is soemthing puzzling about the way things are stored in the session db but I can't speculate for sure right now.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Greg,

Forget about the above, something is peculiar here, whether it is becasue of a race condition I'm not sure, there is soemthing puzzling about the way things are stored in the session db but I can't speculate for sure right now.

 

i had a look at /catalog/includes/modules/payment/paypal.php (v1.7) again:

 

If you look at these lines:

      } else if (isset($_GET['referer']) && $_GET['referer'] == 'paypal' && MODULE_PAYMENT_PAYPAL_IPN_AUTO_RETURN) {
         //Assume the IPN has been processed already,
         //which because PayPal gives no guarantee the following is 'currently'
         //not the ideal thing to be doing.
         $cart->reset(true);
         // 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');
         tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'paypal=redirect', 'SSL'));

 

I was too fed up with the bug of not clearing the $_SESSION data in mysql that i did not search for what:

$cart->reset(true);

 

actually does, but nevertheless i am almost sure that i fixed the problem.

 

I have no clue what negative impacts might occure when doing this but this is what i added anyway:

 

          tep_session_unregister('shoppingcart');

 

The whole part of code from above looks now like this:

      } else if (isset($_GET['referer']) && $_GET['referer'] == 'paypal' && MODULE_PAYMENT_PAYPAL_IPN_AUTO_RETURN) {
         //Assume the IPN has been processed already,
         //which because PayPal gives no guarantee the following is 'currently'
         //not the ideal thing to be doing.
         $cart->reset(true);
         // 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');
         tep_session_unregister('shoppingcart');
         tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'paypal=redirect', 'SSL'));

 

 

The shopping cart is empty when being redirected from paypal (as before) and the session variable 'shoppingcart' is now cleared as well which means your shopping cart is not refilled anymore when surfing to any other link in the shop. :D

 

I am not sure whether it is the purpose of

$cart->reset(true);

to do exactly this (clearing the session variable 'shoppingcart'), but adding the session unregister function definately cures the problem with me.

 

Tell me what you think and if this is the definite solution for this odd little bug, i want the next upgrade for free ;)

 

...oh....it is already.....well... :blink:

 

Best regards,

Marcus

Link to comment
Share on other sites

OK, now I'm sure this is a problem other people have had as well, so I apologise if I'm asking a repeat question. I am unable to figure out what I need to do based on previous posts.

 

My problem is this.

 

a) a customer uses paypal to make a payment

B) on completing the transaction they click continue

c) they get an error telling them checkout_process.php cannot be found.

 

Now as far as I can tell, OSc or the module is sending Paypal the wrong return URL. Changing the redirect URL in paypal makes no difference.

 

What do I need to change to get this to work. I understand the redirect can be hardcoded into the PHP files, but I don't know what I need to modify.

 

Can anyone give me some pointers?

Link to comment
Share on other sites

Marcus, hmm well if it's working then thats great, I don't think it should cause any problems, provided that the IPN has been received already, will look more later, thanks for letting me know.

 

Mr eel, I wouldn't neccessarily recommend hardcoding the url, first when your on the osC confirmation page view the source and find where the retrun url is being specified, what's there? Also have you made any changes in includes/filenames.php ?

The retrun url is being specified in osC in modules/paypment/paypal.php and it shoudl say soemthing like FILENAME_CHECKOUT_PROCESS

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

Hi again guys and gals,

 

I recently started to set up this great contribution, and after a small problem during the installation process, I believe that I had installed everything correctly.

Well earlier today, I went about installing the PayPal option again, after initially uninstalling it after starting this contribution.

 

However, I am getting a slight porblem at the moment.

 

When the customer goes through the checkout process, after they have selected PayPal as the method with which to pay, on the checkout_confirmation.php page, the continue button at the bottom does not appear, so there is nowhere to go from this stage.

 

If I change the payment method to either a money order/cheque or Bank transfer, the continue button appears and the order can be processed.

Has anyone got any idea why the continue button is not appearing with the PayPal method.

 

I installed PayPal as the instructions in the IPN contribution said, so I am not sure if or where I have done something wrong. Below are the PayPal options I have used...

 

 

PayPal

 

Enable PayPal Module

True

 

E-Mail Address

[email protected]

 

Business ID

[email protected]

 

Transaction Currency

Selected Currency

 

Payment Zone

--none--

 

Set Order Status

default

 

Sort order of display.

1

 

Background Color

0

 

Enable Store Logo

1

 

Store logo

oscommerce.gif

 

PayPal Page Style Name

Shop_Around_Greece

 

Include a note with payment

0

 

Shopping Cart Method

1

 

Enable PayPal Shipping Address

0

 

Using PayPal Auto-Return

1

 

Email Notifications

2

 

Test Mode

0

 

Notification Address

[email protected]

 

Return URL behavior

2

 

 

If anyone wants to have a look for themselves at the problem I am having, you can have a look at my site .... shop.aroundgreece.com

 

User name is [email protected]

Password is tester

 

Any help or advice is very grateful.

 

Thank you

 

Alex

Link to comment
Share on other sites

This is a great contribution. however after I installed the v1.7. The credit , coupon class stopped working properly. All numbers are fine within my site (the discounts, total....).but the value it passes to the paypal screen is the amount before any discount... anyone has idea how could I fix this? thanks a lot!!!

 

btw, do I suppose to get the order recorded in admin even if the customer doesn't click on the "continue" button?

 

Kevin

Edited by khymotor
Link to comment
Share on other sites

Thanks for the quick reply Greg.

 

 

The return URL in the osC confimation page is shown as

 

<input type="hidden" name="return" value="checkout_process.php?osCsid=...">

 

Obviously wrong.

 

No I haven't edited the includes/filenames.php, but since someone else has maintained this site before me, it's possible. I'll check it against an original version.

 

"The retrun url is being specified in osC in modules/paypment/paypal.php and it shoudl say soemthing like FILENAME_CHECKOUT_PROCESS"

 

Can I then edit this URL to point to the right address? What is the syntax for this? Sorry to ask, but I'm not a PHP coder.

Link to comment
Share on other sites

The filenames.php file hasn't been edited.

 

I tried changing FILENAME_CHECKOUT_PROCESS in the incl/mod/pmt/paypal.php file to the absolute URL to the checkout_process.php

 

As far as paypal is concerned this seemed to work. But, my next problem is that instead of loading the site, I'm just getting a blank page. Looking at the source just shows head and body tags with nothing else.

Link to comment
Share on other sites

Hi Greg,

 

I have IPN 1.7 installed currently. I started with 1.5, and everything worked fine there, redirected back to the right place etc.. (db and codebase backed up at that working point)

 

Then I tried incremental upgrades from then ...

 

What I'm getting currently is:

 

Payment from Paypal (this works fine, and has the right item details).

Confirmation email to store informing who's bought what

Confirmation email to buyer from Paypal that they've paid and for what item

 

Here's where the peculiarities start:

 

IPN entry with blank details (summary has 0.01 for the web_accept item)

Order entry with blank details and order total of 0.00

 

checkout_success (the return page) gives me the last item which was successfully entered into the Orders part of the Admin page (it seems), and NOT the item the customer just paid for.

 

 

I also don't know at this stage what the change from checkout_process.php to purely the ipn.php will cause in terms of problems with the other modules I have installed:

 

Master Products (seems okay)

AuctionBlox (unused as yet, I notice - after reading through 44 pages - you're collaborating)

Gift Voucher - anyone have IPN 1.7 working with this? ... not that I'm worried at the moment, as I don't have IPN delivering correct order info back to osAdmin....

 

 

TIA

Edited by veral
Link to comment
Share on other sites

veral,

I also don't know at this stage what the change from checkout_process.php to purely the ipn.php will cause in terms of problems with the other modules I have installed:

 

Master Products (seems okay)

AuctionBlox (unused as yet, I notice - after reading through 44 pages - you're collaborating)

Gift Voucher - anyone have IPN 1.7 working with this? ... not that I'm worried at the moment, as I don't have IPN delivering correct order info back to osAdmin....

 

 

TIA

 

You will need to add all modifications for contributions you have in checkout_process.php to the checkout_process part in ipn.php as well as only the ipn.php will be used when payment is done via paypal.

 

Note: Make a backup first!

 

Marcus

Link to comment
Share on other sites

Hmm, will do - any pointers on the blank order/last successful order info? Something osC is expecting that I've missed out?

 

I notice that I have the AUctionblox change from which shipping.php -> superShipping.php, but there's no reference to shipping in the ipn.php

 

Anywhere that new change might be found?

Edited by veral
Link to comment
Share on other sites

And I'm not sure where to add this (in original checkout_process.php) - should I put them at the end, after the else statment, but before the application_bottom.php?

 

 

// load the after_process function from the payment modules

$payment_modules->after_process();

 

//$cart->reset(true);

 

//+++AUCTIONBLOX.COM

$cart->reset(true, $insert_id);

//+++AUCTIONBLOX.COM

 

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

if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');

$order_total_modules->clear_posts();//ICW ADDED FOR CREDIT CLASS SYSTEM

 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 

require(DIR_WS_INCLUDES . 'application_bottom.php');

Link to comment
Share on other sites

Apologies for the spam...

 

Looking through my mysql tables:

 

Reasons have been noted for the 'pending' statuses I've been getting (normal check/MO gives 'processing') for these blank orders.

 

Information is being put into the PAYPAL_IPN_* tables, but not into the orders tables. The item referred to when the user comes back to 'checkout_success' is definitely the last successfully entered item that the user purchased - in the ORDERS tables.

 

The pending_reason value in the PAYPAL_IPN is '0', but there is no such entry in the PAYPAL_IPN_PENDING_REASON table, so I can't relate that to the order status in my osAdmin area.

 

It looks as if the order is just not being passed into the orders table, so the Admin area has nothing to reference to - but I don't understand why checkout success is referring to the last item successfully purchased, unless it's because when it returns the user to the site, it expects the data to be in the orders table already as the last item the user successfully paid for...

 

... or something. Am I making any sense? Does this help pinpoint the bit I'm missing =(

 

Again, sorry for the spam...

Link to comment
Share on other sites

Hi Guys,

 

Sorry can't through everything to day, but Veral, how is your customer being returned to the site, Auto-Return or are they still clicking to continue?

 

You say the IPN info is in the db table, this would also mena that there is an order tto, but it may well be blank, mainly zeros, of which you do not have a customer with an customer_id that equals zero.

 

Pending reason this is relation to Pending Payments, so far this might be in relation to e-checks, if the paid by credit card etc, the money would be instant no there is no pending reason. In admin/moduls/payment/PayPal look and see what is set as the order status, I think by default it is processing.

 

If you're using the Auto-Return I would suggest that you still prompt the customer to click continue, i.e. don't use Auot-Return, this will the IPN a few more seconds to get to your site, because if your customer returns prior to the IPN being received with the Auto-Retrun Method that order information will be lost and you will get a blank order in the orders table.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

I thought I would have a look at the source code on my page which is not displaying a continue button, so the customer is not able to go any further than to select paypal as their payment method.

 

However, on viewing the source, I found this part of code .........

 

<td align="center" class="main">

<form name="checkout_confirmation" action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="osCsid" value="87e4636937353cdd6ec126e0c9d53310" /><input type="hidden" name="cmd" value="_ext-enter"><input type="hidden" name="business" value="[email protected]"><input type="hidden" name="image_url" value="https://sslrelay.com/shop.aroundgreece.com/images/oscommerce.gif?osCsid=87e4636937353cdd6ec126e0c9d53310"><input type="hidden" name="return" value="https://sslrelay.com/shop.aroundgreece.com/checkout_process.php?referer=paypal&osCsid=87e4636937353cdd6ec126e0c9d53310"><input type="hidden" name="cancel_return" value="https://sslrelay.com/shop.aroundgreece.com/checkout_payment.php?osCsid=87e4636937353cdd6ec126e0c9d53310"><input type="hidden" name="notify_url" value="https://sslrelay.com/shop.aroundgreece.com/ipn.php"><input type="hidden" name="bn" value="osc-ipn-v1"><input type="hidden" name="no_shipping" value="1"><input type="hidden" name="item_name" value="Shop Around Greece"><input type="hidden" name="redirect_cmd" value="_xclick"><input type="hidden" name="amount" value="9.00"><input type="hidden" name="shipping" value="7.20"><input type="hidden" name="rm" value="2"><input type="hidden" name="custom" value="87e4636937353cdd6ec126e0c9d53310"><input type="hidden" name="currency_code" value="EUR"><input type="hidden" name="email" value="[email protected]"><input type="hidden" name="first_name" value="Glenn"><input type="hidden" name="last_name" value="Dee"><input type="hidden" name="address1" value="3 landseer house frampton street"><input type="hidden" name="address2"><input type="hidden" name="city" value="london"><input type="hidden" name="state" value="0"><input type="hidden" name="zip" value="nw8 8lg"><input type="hidden" name="lc" value="GB"><input type="hidden" name="night_phone_a" value="333"><input type="hidden" name="night_phone_b" value="333"><input type="hidden" name="night_phone_c" value="3"><input type="hidden" name="day_phone_a" value="333"><input type="hidden" name="day_phone_b" value="333"><input type="hidden" name="day_phone_c" value="3"><input type="hidden" name="no_note" value="0"><input type="hidden" name="cn" value="Add Comments About Your Order"><input type="hidden" name="cs" value="0"><input type="hidden" name="page_style" value="Shop_Around_Greece"><input<input type="image" src="includes/languages/english/images/buttons/button_confirm_order.gif" border="0" alt="Confirm Order" title=" Confirm Order "></form>

</td>

 

However, there is nothing being displayed on the screen where this code is. Is this normal ?? What should be here so that the customer can proceed with the transaction.

 

Before I installed this contribution, the customer would simply be taken to the PayPal site after clicking the continue button, which for me at the moment is not there.

 

Any suggestions or help please ?? :( :(

 

I just need to get the PayPal working and then I can put my site live, which a few small design changes.

 

Thanks

 

Alex

Link to comment
Share on other sites

Anthony,

 

Thanks for yoru reply. I didnt see the extra <input tag when I was looking at the code a while back. I can't understand what it is doing there, or if the end part of that piece of code has actually been cut off.

 

I fixed the code for that and viewed the page from my pc, and the link continue (or confirm) button did appear, and when I clicked it, I was taken to the PayPal site, so I am getting the impression that the <input tag is an extra bit of code here.

 

Does anyone have any ideas why this is appearing ?? Would it have something to do with the installation configuration for this PayPal Contribution ??

 

Does anyone have a url that they could show me for this page where I can have a look at the source and compare it to what my page is showing ??

 

Thanks

 

Alex

Link to comment
Share on other sites

Sorry can't through everything to day, but Veral, how is your customer being returned to the site, Auto-Return or are they still clicking to continue?

 

You say the IPN info is in the db table, this would also mena that there is an order tto, but it may well be blank, mainly zeros, of which you do not have a customer with an customer_id that equals zero.

 

Pending reason this is relation to Pending Payments, so far this might be in relation to e-checks, if the paid by credit card etc, the money would be instant no there is no pending reason. In admin/moduls/payment/PayPal look and see what is set as the order status, I think by default it is processing.

 

If you're using the Auto-Return I would suggest that you still prompt the customer to click continue, i.e. don't use Auot-Return, this will the IPN a few more seconds to get to your site, because if your customer returns prior to the IPN being received with the Auto-Retrun Method that order information will be lost and you will get a blank order in the orders table.

Paypal autoreturn is enabled on osAdmin, but afaik, the customer still has to click 'continue' to make it through to the 'checkout_success.php' page.

 

I tried waiting also - so, clicked on 'Pay' in paypal ... just waited for about 1 minute before checking osAdmin (nothing), then clicked on 'Continue' - which returned me, as mentioned before to the last recorded ordered item for that customer.

 

I've looked in ORDERS: You're right, the customers_id is 0 for the blank transactions, payment_method also blank, orders_status = 1, and the paypal_ipn_id is correct (I checked in PAYPAL_IPN_ORDERS).

 

Default order status is processing, yup, but for these blank ones I get 'pending'.

 

 

So if I understand you correctly, I shouldn't use Auto-Return? What happens if the customer goes through paypal, then decides not to Continue - I thought that's what the benefit of using 1.5a+ was =)

 

(Sorry if I've misunderstood)

 

Update: I turned off Auto-return in osAdmin, then bought an item - no change. Still blanks in the ORDERS table, but an IPN entry in the PAYPAL_IPN_ORDERS table.

Edited by veral
Link to comment
Share on other sites

An admin should do some maintenance on this thread. Its 50!!!! pages long. I am a new user and i am spending enough time trying to get stuff (web) to work reading 50!!! pages is not something i look forward to doing. And a lot of the earlier posts are in reference to older versions. Having a new version means that those problems are fixed. (i hope)

 

Please do some maintenance and make one post with all the important information.

 

I don?t fully understand the IPN and i am not going to set through 50!! Pages and read other ppl problem that only confuses me more. :(

Link to comment
Share on other sites

Hi - I have just installed this contribution - everything works fine and I can see the extra options in admin modules payment paypal but if I try to edit the options I get the following:

 

 

Fatal error: Call to undefined function: tep_array_shift() in /home/f/l/floralart/public_html/catalog/admin/includes/classes/table_block.php on line 31

 

Any ideas please?

 

Paul

Link to comment
Share on other sites

David I'm sure people can agree with your frustration but considering this whole project is a free development and the efforts of peoples free labor I think your request is a little demanding eh...

Link to comment
Share on other sites

Guys Ive got the current version installed and verified and Im having some problems. Ive even turned off SSL since im having problems with so that way it wouldnt be a factor but Im still getting errors. Any Help would be greatly appreciated.

 

This is the error I recieve on CheckOut_Confirmation.php

 

Fatal error: Call to a member function on a non-object in /homepages/3/d93781876/htdocs/store/catalog/includes/modules/payment/paypal.php on line 214

 

Any ideas would be greatly appreciated as Im pulling my hair out to understand what could be wrong.

Woody

Link to comment
Share on other sites

Well the offline version of my site works, when I edit the strange <input tage from the code for this module on the checkout_confirmation.php page, but the live page is still having this problem with the continue button not appearing.

 

Every time I view the source on the page, it shows me the code I listed above earlier with that extra half of an input tag.

 

I can only think that something in the following part of code is causing this to happen, as the other payment methods are all still working fine.

 

 

<td align="center" class="main">

<?php

if (isset($$payment->form_action_url)) {

$form_action_url = $$payment->form_action_url;

} else {

$form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

}

 

echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 

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

echo $payment_modules->process_button();

}

 

echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";

?>

</td>

 

I am a newbie to PHP so I really cannot see what could be causing this extra half of a tag to appear.

 

Is it something that I did in the installation of this contribution ?? Should I download and reinstall all the files again ?? Would that make a difference ??

 

Can anyone here please give me some advise on how to fix this ????

 

Thanks

 

Alex

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...