fox Posted November 22, 2003 Posted November 22, 2003 Hi, I've searched through the previous post of problems similar to this but each issue was not exactly the same... Orders that I test with Credit Cards go through fine and show up in the orders list on the admin. Except for PayPal orders. There is no record of them, even in the databse. I found this because I have one live order--the PayPal account is updated with the transaction, but can't find it in the DB. And I can't find a way to test PayPal transactions--is there a way? Any suggestions on why PayPal orders are not showing up? Thanks
chfields Posted November 22, 2003 Posted November 22, 2003 Generally, paypal doesn't show in admin when customer doesn't click on the continue button at the end of the transaction. I'm told adding the paypal IPN contrib can solve this. You can also install this following code and the e-mail you get back from paypal will include the items purchased but will not update orders in admin or db. Just in case someone doesn't click continue to get back to your site here is a mod to include into your PayPal module to you can see what the customer ordered on your PayPal payment notification (just in case they don't return to your site to complete the process and generate an invoice) - BACK UP BACK UP BACK UP change the following code: function process_button() { global $order, $currencies, $currency; if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') { $my_currency = $currency; } else { $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5); } if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) { $my_currency = 'USD'; } $xx = ''; for ($i=0; $i<sizeof($order->products); $i++) { $xx .= $order->products[$i]['qty'] . '-' . ($order->products[$i]['name']) . '**'; } $process_button_string = tep_draw_hidden_field('cmd', '_xclick') . tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) . tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . tep_draw_hidden_field('currency_code', $my_currency) . tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); return $process_button_string; } the above code snippet replaces the code snippet in the catalog/includes/modules/payment/paypal.php file look for function process_button() { and then copy and paste and replace that section of code with the code above
Guest Posted November 22, 2003 Posted November 22, 2003 That code works, but I've been using the PayPal IPN system with a great success rate for a few weeks now. It's a fairly easy contribution to install, and it will ensure that the order is listed in your admin and your stock is updated as necessary.
fox Posted November 23, 2003 Author Posted November 23, 2003 Thanks for the suggestions. I am going to try to fix my store with this and see what happens.
Guest Posted November 23, 2003 Posted November 23, 2003 Hi, I also ran into fox's problem and was greatful to find the above answers. I've changed my paypal.php code to the snippet found in chfields' post. I would much prefer the system that allows for order logging and stock updates. However, I'm new to shopping carts and OScommerce and am not sure what the PayPal IPN system/contribution/contrib/"thingie" :-) is or where it would go once found :-/. Any assistance would be appreciated :-) Blessings, Joani
chfields Posted November 23, 2003 Posted November 23, 2003 Just click on contributions in the upper right corner of the screen and then do a search for paypal
skullkeepers Posted November 26, 2003 Posted November 26, 2003 HELP! I have messed up my paypal payment php file can someone please send me a replacement file? Also can you add the info so I can see the products in paypal Thanks Mark
turmz Posted December 2, 2003 Posted December 2, 2003 Skullkeepers the post recommending altering your file he said "BACK UP BACK UP BACK UP"... I'm not even sure what file everyone is talking about but a client I'm helping is having this problem as well. And I guess although Oscommerce seems to be a great program. I am wondering if its worth the trouble? But what do I know. Anyway... I guess I'll look around for a paypal.php file.
pogue Posted December 4, 2003 Posted December 4, 2003 Generally, paypal doesn't show in admin when customer doesn't click on the continue button at the end of the transaction. I'm told adding the paypal IPN contrib can solve this. You can also install this following code and the e-mail you get back from paypal will include the items purchased but will not update orders in admin or db. Just in case someone doesn't click continue to get back to your site here is a mod to include into your PayPal module to you can see what the customer ordered on your PayPal payment notification (just in case they don't return to your site to complete the process and generate an invoice) - BACK UP BACK UP BACK UP change the following code: function process_button() { global $order, $currencies, $currency; if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') { $my_currency = $currency; } else { $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5); } if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) { $my_currency = 'USD'; } $xx = ''; for ($i=0; $i<sizeof($order->products); $i++) { $xx .= $order->products[$i]['qty'] . '-' . ($order->products[$i]['name']) . '**'; } $process_button_string = tep_draw_hidden_field('cmd', '_xclick') . tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) . tep_draw_hidden_field('item_name', STORE_NAME . ' ' . $xx) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . tep_draw_hidden_field('currency_code', $my_currency) . tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); return $process_button_string; } the above code snippet replaces the code snippet in the catalog/includes/modules/payment/paypal.php file look for function process_button() { and then copy and paste and replace that section of code with the code above Can someone tell me what file I need to edit to make those changes? Or do I need to install the Paypal ICN contrib file. There is also more than one, which one do I need? Thanks for the clarification.
sjd256 Posted December 4, 2003 Posted December 4, 2003 Ok, Option 1 You can install the Paypal IPN contribution but it does have a couple of install issues apparently. What the Paypal IPN (Instant Payment Notification) does is allow for the order to be passed to your Orders List even if the customer fails to press the continue button at the end of the Paypal process. What is happening is that at the moment some customers don't press continue after paying with the result that the order is not passed to the cart - so you don't know what to ship. The only downside I would say to the IPN module and this is down to Paypal is that it can sometimes not be clear in your admin whether the order has indeed been paid or not. Option 2 The other option that can be employed is to use code similar to the one above - with this code the products are detailed within the Paypal email. This means that if the customer fails to press the continue button after paying, you still get info as to what they have ordered. I have decided to use the second method for the moment until I can get the IPN module working properly. I used the code but modified it slightly so that if the customer doesn't have a Paypal account it would populate the signup page meaning less work for the customer. Some of the fields were already catered for but I have added a few extra meaning that all fields are now carried over to Paypal. I have also added the products ID number to the email so that it makes it easier to identify the product purchased. However for a couple of fields I have hardcoded the options instead of taking it from the customer database as it makes the signup process easier (this is not a pretty way of doing it) . You will note that as my store will be UK based the code reflects that but you can easily change it to meet your needs if it helps. Please note credit for the original code goes to the original author: ** Backup your file first ** Replace this function in your catalog>includes>modules>payment>paypal.php with the code detailed below function process_button() { global $order, $currencies, $currency; if (MODULE_PAYMENT_PAYPAL_CURRENCY == 'Selected Currency') { $my_currency = $currency; } else { $my_currency = substr(MODULE_PAYMENT_PAYPAL_CURRENCY, 5); } if (!in_array($my_currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD'))) { $my_currency = 'GBP'; } $xx = ''; for ($i=0; $i<sizeof($order->products); $i++) { $xx .= $order->products[$i]['qty'] . ' x ' . ($order->products[$i]['name']) .' ID:'. ($order->products[$i]['id']). ' ***'; } $process_button_string = tep_draw_hidden_field('cmd', '_ext-enter') . tep_draw_hidden_field('redirect_cmd', '_xclick') . tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) . tep_draw_hidden_field('item_name', $xx) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . tep_draw_hidden_field('currency_code', $my_currency) . tep_draw_hidden_field('first_name', $order->billing['firstname']) . tep_draw_hidden_field('last_name', $order->billing['lastname']) . tep_draw_hidden_field('address1', $order->billing['street_address']) . tep_draw_hidden_field('city', $order->billing['city']) . tep_draw_hidden_field('state', $order->billing['state']) . tep_draw_hidden_field('zip', $order->billing['postcode']) . tep_draw_hidden_field('night_phone_a', '44') . tep_draw_hidden_field('night_phone_b', $order->customer['telephone']) . tep_draw_hidden_field('email', $order->customer['email_address']) . tep_draw_hidden_field('lc', 'GB') . tep_draw_hidden_field('rm', '2') . tep_draw_hidden_field('notify_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); return $process_button_string; } Hope the above is helpful Cheers Steve
pogue Posted December 4, 2003 Posted December 4, 2003 Hope the above is helpful Cheers Steve I assume in the above code I would change $my_currency = 'GBP'; to 'USD' for US payments, correct? I used the code posted above by chfields and the customer was charged 6 cents for an order, which is not correct. Is that the only thing I need to change to be able to be notified what people have ordered through paypal?
chfields Posted December 4, 2003 Posted December 4, 2003 I have been using this code for quite awhile w/no problems. I like the changes made to the code, I too am curious if that is the only changes needed to be US compatible
sjd256 Posted December 5, 2003 Posted December 5, 2003 Hi, To modify the code I posted earlier to make it USA compatible you would change the following lines: $my_currency = 'GBP'; and tep_draw_hidden_field('lc', 'GB') . and finally tep_draw_hidden_field('night_phone_a', '44') . the 44 should be changed to the international dialling code of the USA. The above two are a bit naughty because your assuming that they come from in your case the USA and not taking it from the customers account. Having said that 99% of my orders come from the UK so adding the code above means a lot of people save time and just a few have to make amendments. To Pogue - your problem is likely to be a setting in your Paypal account check the settings and make sure that your not adding tax etc. I don't think the problem is related to the code. Hope the above helps Cheers Steve P.S. As always backup your code and use at your own risk ;-)
pogue Posted December 5, 2003 Posted December 5, 2003 tep_draw_hidden_field('lc', 'GB') . To Pogue - your problem is likely to be a setting in your Paypal account check the settings and make sure that your not adding tax etc. I don't think the problem is related to the code. Hope the above helps Cheers Steve P.S. As always backup your code and use at your own risk ;-) I assume the tep_draw_hidden_field('lc', 'GB') should be changed to tep_draw_hidden_field('lc', 'US') or am I missing something here? Everything else I've fixed, so hopefully that should be working now. I didn't have tax setup in paypal, but I do have a flat shipping rate setup which may be causing the problem. I'll go through and check it again and hopefully make it work. Thanks for the help guys :)
sjd256 Posted December 5, 2003 Posted December 5, 2003 Pogue, Not quite sure but try US or USA - got to be one of them. Cheers Steve
Dangeo1 Posted December 7, 2003 Posted December 7, 2003 Has anyone implemented this? I am receiving payment notifications from paypal, but my admin page does not show any activity. The customer is there, but there is no order information at all.
chfields Posted December 7, 2003 Posted December 7, 2003 I have implemented the original code I posted and it works very well. I have not tried this new code, to create new accounts in paypal
sjd256 Posted December 7, 2003 Posted December 7, 2003 Dangeo1, Did you install the original code posted by chfields or the modified one posted by me sjd ?? Either way all the modifications do is to pass info that's in the customers record to Paypal so that they can prepopluate the account setup form. The original code added the customers order to the Paypal email so that regardless of whether the customer presses continue at the end of the payment process the store owner would still get info on the order. The second modification does exactly the same but also adds the customers details as mentioned above. Both pieces of code appear to work and I have tried both and the order information is passed over to the appropriate section. The two things that you can check is: 1) At the top of the Orders Page if you change the Status selection to "processing" does it show you the order you are looking for?? 2) The other thing is - are you sure that the Continue button has been pressed after the customer has paid through Paypal?? Once they have paid there is a continue button which should take the customer to your page that shows congratulations etc... Please let me know if you resolve this issue but as I said earlier it is working fine at this end. Cheers Steve
Dangeo1 Posted December 8, 2003 Posted December 8, 2003 I have not implemented any "fixes" to the PayPal module as of yet. :blink: I was curious as to the success of the fixes listed here before putting the time effort into it. (measure twice, cut once... as they say ;) ) 1) Searching for "processing" orders does not show any orders. 2) I have done some more investigation and discovered that the customer has not pressed "continue" upon returning from the paypal screens. The order is still in the customers basket as an incomplete transaction. I am investigating implementation of the PayPal IPN module. This is said to eliminate the problem of OSC losing orders mid-transaction. Thank you for your response.
sjd256 Posted December 8, 2003 Posted December 8, 2003 Dangeo1 Thanks for letting us know. With regard to IPN it does mean that the problem of customers not pressing continue is resolved. However * I believe* that it does mean that if the customer decides to cancel the order whilst at Paypal then the order is still recorded in the OSC orders section and you then have to check whether they have paid or not yourself. six of one, half a dozen of the other I think.. Anyway thanks again. Cheers Steve
Dangeo1 Posted December 8, 2003 Posted December 8, 2003 I guess I'd rather have the packing slip and invoice that OSC generates than having to make one up by hand. And, I get a paypal e-mail whenever I get funds input. Soooo.... I guess I'll take less writing over guessing what products were ordered and what shipping method was chosen.
sjd256 Posted December 8, 2003 Posted December 8, 2003 Yes that makes sense for your situation. We process all the orders through Sage Accounts so have to reproduce the invoice anyway and with the changes in the Paypal code the products and shipping are detailed in the email so it doesn't make that much difference to us in our situation. I mentioned previously that this wouldn't be suitable for everyone with some people choosing to go down the IPN route but judging from the number of emails I have received quite a few must use the standard Paypal Module. Anyway all the best Cheers Steve
Kinky Clothes Posted December 10, 2003 Posted December 10, 2003 lo ppl, the problem i was having is that as we sell clothing, all our items have options and i had to make a mod that would show all the options the customer selected.... only problem is, the item name field is limited to 128 or 127 characters :( some of my items have 5+ options so that filled up the name field. if anyone wants the mod, it's fine for people who only have 1 or 2 options let me know and i'll paste the bit here.
djmonkey1 Posted December 14, 2003 Posted December 14, 2003 Hey Lisa- I would love to have that mod, our catalog only has a few options so it should work great! Thanks Stew p.s. Thanks to Steve for that great contribution! Do, or do not. There is no try. Order Editor 5.0.6 "Ultra Violet" is now available! For support or to post comments, suggestions, etc, please visit the Order Editor support thread.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.