Guest Posted February 27, 2004 Posted February 27, 2004 Dear members, I am not sure if you were aware or not, or if this was an isolated case, but I have found some very material errors in the way checkout_paypalipn.php and paysystems.php handle the checkout procedure. These modules will work without flaw if the customer does not switch their billing address. If the customer decides to use an alternative billing address, the modules will input their customer file as the billing address regardless of what they want to use. Furthermore, I found it very annoying that the PayPalIPN did not pre-populate the customer's state in the registration form. I have also fixed that. Follow the instructions below to patch your paysystems.php and checkout_paypalipn.php files: Firstly, checkout_paypalipn.php changes: Locate the following code, it should be on line 255 aproximately: tep_redirect("https://www.paypal.com/cgi-bin/webscr?cmd=_ext-enter&redirect_cmd=_xclick&business=".MODULE_PAYMENT_PAYPALIPN_ID."&item_name=".urlencode(STORE_NAME)."&item_number=".$insert_id."¤cy_code=".$paypal_ipn_currency."&amount=".$paypal_ipn_order_amount."&shipping=".$paypal_ipn_shipping_amount."&tax=".$paypal_ipn_tax_amount."&first_name=".urlencode($order->customer['firstname'])."&last_name=".urlencode($order->customer['lastname'])."&address1=".urlencode($order->customer['street_address'])."&city=".urlencode($order->customer['city'])."&state=".urlencode($order->customer['state'])."&zip=".urlencode($order->customer['postcode'])."&email=".$order->customer['email_address']."&bn=oscommerce-osmosis-0.971m1&return=".tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')."&cancel_return=".tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')."¬ify_url=".MODULE_PAYMENT_PAYPALIPN_NOTIFY_URL); Replace with: tep_redirect("https://www.paypal.com/cgi-bin/webscr?cmd=_ext-enter&redirect_cmd=_xclick&business=".MODULE_PAYMENT_PAYPALIPN_ID."&item_name=".urlencode(STORE_NAME)."&item_number=".$insert_id."¤cy_code=".$paypal_ipn_currency."&amount=".$paypal_ipn_order_amount."&shipping=".$paypal_ipn_shipping_amount."&tax=".$paypal_ipn_tax_amount."&first_name=".urlencode($order->billing['firstname'])."&last_name=".urlencode($order->billing['lastname'])."&address1=".urlencode($order->billing['street_address'])."&city=".urlencode($order->billing['city'])."&state=".urlencode($state_code)."&zip=".urlencode($order->billing['postcode'])."&email=".$order->customer['email_address']."&bn=oscommerce-osmosis-0.981&return=".tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')."&cancel_return=".tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')."¬ify_url=".MODULE_PAYMENT_PAYPALIPN_NOTIFY_URL); The above code fixes the problem of alternative billing addresses being ignored. NOW, just above the code you entered (so on line 254), enter the following code: $state_code = tep_get_zone_code($order->billing['country_id'], $order->billing['zone_id'], $order->billing['state']); This code enables the module to Pre-Populate the state field in the PayPal sign-up form. Save, close, and upload checkout_paypalipn.php, of course test to make sure it works. It works wonderfully on my platform. Next, paysystems.php: Go to aproximately line 102 where it says: $process_button_string = tep_draw_hidden_field('product1',$products_list) . You will notice that all the b_* fields (the billing fields) are being populated with the $order->customer variable. This is incorrect, all you need to do is change all occurences of $order->customer to $order->billing. After your done your code should be the following: tep_draw_hidden_field('b_firstname', $order->billing['firstname']) . tep_draw_hidden_field('b_middlename','') . tep_draw_hidden_field('b_lastname', $order->billing['lastname']) . tep_draw_hidden_field('b_address', $order->billing['street_address']) . tep_draw_hidden_field('b_city', $order->billing['city']) . tep_draw_hidden_field('b_state', $order->billing['state']) . tep_draw_hidden_field('b_zip', $order->billing['postcode']) . tep_draw_hidden_field('b_country',$order->billing['country']['iso_code_2']) . tep_draw_hidden_field('b_tel', '') . As I said before, this may be an isolated issue with my configuration, however, I have tested this extensively on MS 2.2 and it seems to work perfectly now. Thanks guys, please give me feedback!
nextwave Posted April 20, 2004 Posted April 20, 2004 stumbked across this thread and noticed no replies seems a worthy fix!
coldclimber Posted April 23, 2004 Posted April 23, 2004 i agree with nextwave a worthy fix not that i have done it yet but i am about to looks like everyone has just fixed there paypal without the thanks so thankyou from every to you Climb to Live, Live to climb
angelo11 Posted April 28, 2004 Posted April 28, 2004 Hey peformancepartz, Not sure if this is the place to do this so I applogize in advance if I'm over stepping my boundaries. What would you charge to configure OSCoomerce for PayPal for e-merchandise and physical merchandise AND incorporate the look and feel into my website? Thanks! Angelo
angelo11 Posted April 28, 2004 Posted April 28, 2004 Hey peformancepartz, Not sure if this is the place to do this so I applogize in advance if I'm over stepping my boundaries. What would you charge to configure OSCoomerce for PayPal for e-merchandise and physical merchandise AND incorporate the look and feel into my website? Thanks! Angelo Nevermind. I got a handle on it. Thank you for the PayPal fix...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.