Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal doesn't generate an order


diggermagoo

Recommended Posts

When a customer buys a product, he can pay with PayPal, and it all seems to work just fine and I get a payment notification from PayPal, but it does not generate anything in my "Orders" page in Admin so I have no way of knowing what they ordered, only the amount of the order (from the PayPal notification)

Link to comment
Share on other sites

  • Replies 98
  • Created
  • Last Reply

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

Link to comment
Share on other sites

Thanks that works well I was trying to get the pay pal IPN to work but have failed thus far this is an easier temporary fix for this problem. I do have one additional problem when testing I get to the last page confirmation of payment and hit continue and the url is wrong were do I change this value so it sends the customer back to my site? :rolleyes:

Link to comment
Share on other sites

Incorrect URLs are usually a problem with configure.php. For more help, please post the HTTP and WS defines from your configure.php as well as the incorrect URL and what it should be.

 

Hth,

Matt

Link to comment
Share on other sites

Thanks I wasn't sure were to go been playing with the IPN waht nightmare,

 

here is my configure.php file:

 

<?php

/*

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2003 osCommerce

 

Released under the GNU General Public License

*/

 

// Define the webserver and path parameters

// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', ''); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://www.trailexplorers.com'); // eg, https://localhost - should not be empty for productive servers

define('ENABLE_SSL', false); // secure webserver for checkout procedure?

define('HTTP_COOKIE_DOMAIN', '');

define('HTTPS_COOKIE_DOMAIN', 'www.trailexplorers.com');

define('HTTP_COOKIE_PATH', '');

define('HTTPS_COOKIE_PATH', '/catalog/');

define('DIR_WS_HTTP_CATALOG', '');

define('DIR_WS_HTTPS_CATALOG', '/catalog/');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');

define('DIR_FS_CATALOG', '/home/httpd/vhosts/trailexplorers.com/httpsdocs/catalog/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

// define our database connection

define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers

define('DB_SERVER_USERNAME', '********');

define('DB_SERVER_PASSWORD', '*******');

define('DB_DATABASE', '*******');

define('USE_PCONNECT', 'false'); // use persistent connections?

define('STORE_SESSIONS', ''); // leave empty '' for default handler or set to 'mysql'

?>

 

here is the url that doesn't work:

 

http://checkout_payment.php/?osCsid=46edf3...d2d307faab7cc10

 

it should read like this:

 

https://www.trailexplorers.com/catalog/chec...d2d307faab7cc10

 

or checkout_process.php if successful,

 

I just tested those urls and it worked ok a little slow with the checkout_process.php

but it fed the order back into the database as it should, I appreciate your help

 

Keeping the Adventure Alive, isn't that what it's all about

 

:blink: Doug

Link to comment
Share on other sites

chfields --

 

I replaced the code -- I'm pretty sure just as you said -- but I get this error now:

Fatal error: Call to undefined function: get_decimal_places() in /home/towerink/public_html/shop/includes/modules/payment/paypal.php on line 61

 

Here is the paypal.php script in it's entirety:

 

code = 'paypal';

$this->title = MODULE_PAYMENT_PAYPAL_TEXT_TITLE;

$this->description = MODULE_PAYMENT_PAYPAL_TEXT_DESCRIPTION;

$this->enabled = MODULE_PAYMENT_PAYPAL_STATUS;

}

 

// class methods

function javascript_validation() {

return false;

}

 

function selection() {

return false;

}

 

function pre_confirmation_check() {

return false;

}

 

function confirmation() {

global $checkout_form_action;

 

$checkout_form_action = 'https://secure.paypal.com/cgi-bin/webscr';

}

 

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

 

}

 

 

function before_process() {

return false;

}

 

function after_process() {

return false;

}

 

function output_error() {

return false;

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Allow PayPal', 'MODULE_PAYMENT_PAYPAL_STATUS', '1', 'Do you want to accept PayPal payments?', '6', '3', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPal ID', 'MODULE_PAYMENT_PAYPAL_ID', '[email protected]', 'Your buisness ID at PayPal. Usually the email address you signed up with. You can create a free PayPal account at http://www.paypal.com.', '6', '4', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_STATUS'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYPAL_ID'");

}

 

function keys() {

$keys = array('MODULE_PAYMENT_PAYPAL_STATUS', 'MODULE_PAYMENT_PAYPAL_ID');

 

return $keys;

}

}

?>

 

 

 

any thoughts?

Link to comment
Share on other sites

Thanks Matt made some changes to the lines you recommended and voilla it works actually I find this fix to be much simpler than the others it is a simple, yet very effective way to add information to the pay pal invoice, when I figure out the ipn I will definitely let ya know.

Link to comment
Share on other sites

the only problem with ipn is that there is an instruction file missing there are some changes to be made to order,php compare with paypal ipn v0.97 and you'll see the modifications that you have to make let me know if you have any question.

i need to also pass the tel#andfax#andcomments to the email from ipn.

i have not figured that out yet so if anybody got that please let me know

Link to comment
Share on other sites

I made some adaptations to Craig's posted script (quoted below) which was very helpful to me (thanks Craig).

 

First Adaptation

I copied some code from the script used for authorize.net and modified it to work within the paypal.php script. This includes the ability to send customer e-mail, address, phone, etc. to PayPal. If your customer is not yet a PayPal user, it will automatically fill in most of the information provided for their signup form. They can still edit their information for PayPal signup.

 

In order to make this work in PayPal I changed the Post command variables to this:

 

$process_button_string = tep_draw_hidden_field('cmd', '_ext-enter') .
tep_draw_hidden_field('redirect_cmd', '_xclick') .

 

One glitch that can occur is if someone has a PayPal cookie set to an existing PayPal account, the variables in the POST will be overidden by the Cookie information. If you want to test the script properly, you must first delete any PayPal cookies on your system. This will accurately simulate a new PayPal user signup directed from your site with pre-populated info.

 

Second Adaptation

I added some additional PayPal variables that add a Continue button on PayPal's final page. When the customer clicks the button, they are returned to your osCommerce cart and the order data is inserted into MySQL. This continue button is better than the previous link because it looks like it needs to be clicked to finalize the order.

 

Craig's script below includes my adaptations:

 

;)

 

 

 

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', '_ext-enter') .

tep_draw_hidden_field('redirect_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('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_c', $order->customer['telephone']) .

tep_draw_hidden_field('email', $order->customer['email_address']) .

tep_draw_hidden_field('lc', 'US') .

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;

}

 

 

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

Link to comment
Share on other sites

if you are using the paypal module that comes with osc, the customer must click the continue in paypal and comeback to your site for the order to show in your admin. this is just the way it is.solution is to use paypal ipn.there is a problem with instructions in ipn contribution that i explined in another post so make sure to read it before you start installing it .

Link to comment
Share on other sites

Neither of those are "fixes" to the problem-- the orders still didn't show up in the admin area Orders. The problem was the ot.class crud in the orders.php file. Remove that and it works. Buggy programming.

Link to comment
Share on other sites

Neither of those are "fixes" to the problem-- the orders still didn't show up in the admin area Orders. The problem was the ot.class crud in the orders.php file. Remove that and it works. Buggy programming.

Um, I'm afraid not.

 

If the OT class wasn't functioning on OSC2.2 MS2 and later, there would be THOUSANDS of complaints flooding this forum.

 

Perhaps you made a modification to your shop, or alttered it in some way that caused this problem. The stock OSC 2.2 MS2 works perfectly.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Neither of those are "fixes" to the problem-- the orders still didn't show up in the admin area Orders. The problem was the ot.class crud in the orders.php file. Remove that and it works. Buggy programming.

Um, I'm afraid not.

 

If the OT class wasn't functioning on OSC2.2 MS2 and later, there would be THOUSANDS of complaints flooding this forum.

 

Perhaps you made a modification to your shop, or alttered it in some way that caused this problem. The stock OSC 2.2 MS2 works perfectly.

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

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Um, well the snapshots Oct- 7th to 10th aren't working "perfectly." http://www.oscommerce.com/forums/index.php?showtopic=41103&st=0

 

I just wiped my directory clean, reinstalled the snapshot--orders in admin didn't work. Did the above with ot.class, and guess what? It worked. So please don't tell me I did something to make it not work--how do you explain a fresh install being fixed by the above thread's ot.class suggestion, eh? :blink:

Link to comment
Share on other sites

And by the way, the stock OS 2.2 does NOT work perfectly...there are lots of bugs in it, that's why people have outstanding questions with no answers to them. The answers from previous versions to similar problems do not apply to the MS 2.2 releases and its decendant snapshots. I'm getting ready to just dump MS 2.2 and go with the tep 2.1 version instead until 2.2 bugs are hammered out. :ph34r:

Link to comment
Share on other sites

  • 3 weeks later...

Hi

A friend of mine added this coding to his paypal.php file, as him too didn't get the order details, but he is getting everything (order and money). However, I have tested it as the buyer, and once on paypal I am asked to click "continue " (just after I get confirmation the payment has been successful), I get the following error message:

 

Warning: Cannot modify header information - headers already sent by

(output started at

/home/mvtqkof/public_html/shop/includes/modules/payment/paypal.php:119) in

/home/mvtqkof/public_html/shop/includes/functions/general.php on line 28

 

 

I am not sure what to do to sort the problem (the website is www.specialfxskins.co.uk if you need to know ).

 

Your help would be much appreciated

 

thanks

Louis1st

Link to comment
Share on other sites

  • 4 months later...
I made some adaptations to Craig's posted script (quoted below) which was very helpful to me (thanks Craig).

 

First Adaptation

I copied some code from the script used for authorize.net and modified it to work within the paypal.php script.  This includes the ability to send customer e-mail, address, phone, etc. to PayPal.  If your customer is not yet a PayPal user, it will automatically fill in most of the information provided for their signup form.  They can still edit their information for PayPal signup.

 

In order to make this work in PayPal I changed the Post command variables to this:

 

$process_button_string = tep_draw_hidden_field('cmd', '_ext-enter') .
tep_draw_hidden_field('redirect_cmd', '_xclick') .

 

One glitch that can occur is if someone has a PayPal cookie set to an existing PayPal account, the variables in the POST will be overidden by the Cookie information.  If you want to test the script properly, you must first delete any PayPal cookies on your system.  This will accurately simulate a new PayPal user signup directed from your site with pre-populated info.

 

Second Adaptation

I added some additional PayPal variables that add a Continue button on PayPal's final page.  When the customer clicks the button, they are returned to your osCommerce cart and the order data is inserted into MySQL.  This continue button is better than the previous link because it looks like it needs to be clicked to finalize the order.

 

Craig's script below includes my adaptations:

 

  ;)

 

 

 

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', '_ext-enter') .

tep_draw_hidden_field('redirect_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('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_c', $order->customer['telephone']) .

tep_draw_hidden_field('email', $order->customer['email_address']) .

tep_draw_hidden_field('lc', 'US') .

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;

}

 

 

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

This modification works great. It seems that state is not transferred over to Paypal. Does anyone know why this happens? The variables and the data appear to be correct. Thanks

Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...
  • 3 weeks later...

Just jumping in the middle of this thread. Glad to find this post. thanx mucho.

 

Seems like this is a known issue and has been for a while. For the last several hours I have been checking in the "payment modules" forum and all over the place like the knowledge base, etc. for a straightforward answer.

:'(

 

For now I have had to disable paypal module for my client's store. Getting the info printed out in the paypal notice is nice and I will make that change ASAP.

 

Setting the order to "pending" and writing to the db regardless of paypal results would be nice. It would allow the order to be placed and handled like a "sending check or money order" option.

 

Is this in the works or does someone have a place to point me to make it work that way? :D

Don't stand where I told you to stand. Stand where I told you to stand!

Link to comment
Share on other sites

  • 1 month later...

I have been using this snippet. All it reveals about the customer's order is the beginning of the title of the product's page. That narrows it down and helps a lot, but almost all of my products have attributes, so I still have to go into MySQL and figure it out. Is there a snippet that would grab up the attributes and item numbers as well? Thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...