Guest Posted October 28, 2002 Posted October 28, 2002 How can this be done upon checkout to save the customers some time and save some transactions? Transferring osc customer data to paypal form...
pbreit Posted October 30, 2002 Posted October 30, 2002 https://www.paypal.com/cgi-bin/webscr?cmd=p...-signup-outside Patrick Breitenbach
Guest Posted October 31, 2002 Posted October 31, 2002 Yeah I saw that but have no idea how or where to implement that code! Can anyone help on this?
Guest Posted October 31, 2002 Posted October 31, 2002 here is the paypal module from catalogincludesmodulespaymentpaypal.php <?php /* $Id: paypal.php,v 1.29 2002/08/13 16:00:42 dgw_ Exp $ The Exchange Project - Community Made Shopping! http://www.theexchangeproject.org Copyright © 2000,2001 The Exchange Project Released under the GNU General Public License */ class paypal { var $code, $title, $description, $enabled; // class constructor function paypal() { $this->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; $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) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->currencies['USD']['value'], 2)) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value('USD'), 2)) . 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; } } ?> Patrick, you guys have a clue how to stick your fields in with the oscommerce format?
dahammer2 Posted October 31, 2002 Posted October 31, 2002 function process_button() { global $order, $currencies; $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) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->currencies['USD']['value'], 2)) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value('USD'), 2)) . 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; } That is the function you want to edit. I don't know if this will work but try adding this in, add after "$process_button_string = tep_draw_hidden_field('cmd', '_xclick') ." tep_draw_hidden_field("redirect_cmd", "_xclick") . then for each piece of membership info.. (look at above url) tep_draw_hidden_field("first_name", $firstname) . tep_draw_hidden_field("last_name", $lastname) . i.e. modified function function process_button() { global $order, $currencies; $process_button_string = tep_draw_hidden_field('cmd', '_xclick') . tep_draw_hidden_field("redirect_cmd", "_xclick") . tep_draw_hidden_field("first_name", $firstname) . tep_draw_hidden_field("last_name", $lastname) . tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) . tep_draw_hidden_field('item_name', STORE_NAME) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->currencies['USD']['value'], 2)) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value('USD'), 2)) . 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; } You can probably just test that quickly to see if goings to work. And you will have to get the customer information and shipping information from somewhere too.. This would be another good contribution :)
Guest Posted October 31, 2002 Posted October 31, 2002 Ok, this is the problem, the paypal checkout for osc first goes to a paypal login page with checkout total that asks if the client is already a paypal user or if he/she needs to create a paypal account. So no user information is sent to that page at all, just the checkout total. then the user either logs or creates a new account.... this second page is where the fields need to be added from osc. I cant figure out if that is possible or not.
dahammer2 Posted November 1, 2002 Posted November 1, 2002 ok here's a start to a modified function function process_button() { global $order, $currencies, $customer_id; $result = tep_db_query("Select customers_firstname, customers_lastname from customers where customers_id = '$customer_id'"); $line = mysql_fetch_assoc($result); $first_name = $line['customers_firstname']; $last_name = $line['customers_lastname']; $process_button_string = tep_draw_hidden_field('cmd', '_ext-enter') . tep_draw_hidden_field("redirect_cmd", "_xclick") . tep_draw_hidden_field("first_name", $first_name) . tep_draw_hidden_field("last_name", $last_name) . tep_draw_hidden_field("city", $order->customer['city']) . tep_draw_hidden_field("state", $order->customer['state']) . tep_draw_hidden_field("zip", $order->customer['postcode']) . tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) . tep_draw_hidden_field('item_name', STORE_NAME) . tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->currencies['USD']['value'], 2)) . tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value('USD'), 2)) . 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; } Use Patricks link above to find the rest of values you need to add. I'm under the hammer here to meet some deadlines so I can't do it all at the moment. THis worked for me tho, it pre populated a few fields. Take now, the phone number requires the 3 parts separately. So unless you collect those parts separately on your site this could be tricky. i.e. (123) 1234 1234 perhaps you could guess? take numbers working backwards or something...
wizardsandwars Posted November 1, 2002 Posted November 1, 2002 Reap, By far, the easiest thing to do would be to install Pablo's "PayPal IPN" contribution. It already includes the code to pre-populate the fields, and you are going to need it anyway, trust me. ------------------------------------------------------------------------------------------------------------------------- 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.
hairdeals Posted September 1, 2003 Posted September 1, 2003 I installed Paypal IPN, and it is still not working. I think that perhaps PayPal decided to disable the prepopulate feature. Does anyone have it working on their website?
azer Posted September 4, 2003 Posted September 4, 2003 this subject interesst me also , so i write a note MS2
hairdeals Posted September 5, 2003 Posted September 5, 2003 Nevermind, it was working all along, I just had to configure my environment (ie. delete the Paypal cookies). :lol:
Guest Posted November 6, 2003 Posted November 6, 2003 can this code be added to the join function for a membership to a cart? would really be interested to know how to make a paid membership since I am a theme author and only want to allow paid memberships to access my enhancements off my server. Kel www.kelsthemes.com
Recommended Posts
Archived
This topic is now archived and is closed to further replies.