arm1tage Posted March 28, 2005 Share Posted March 28, 2005 Thanks to an inspired tip from a member (IlColosso), the 2Checkout V2 problem has been solved. The oscid session generated in the URL was preventing the passback parameters from getting back to osc. The solution is to force cookies, however this does not work on sites with shared-SSL certs. The demo mode bug has also been fixed, and I have updated the installation instructions. Hopefully it will be easier to get working now. Download the updated contrib at: http://www.oscommerce.com/community/contributions,904 Please reply here if it works or doesn't work. Thanks! Quote Link to comment Share on other sites More sharing options...
wcx Posted March 29, 2005 Share Posted March 29, 2005 I just installed this contibution, and it seems to work great with the passbakcs and everthing. The only thing that I can not seem to get working is the deatiled cart contents. With 2checkout requiring us to have a detailed product list passed through to the 2checkout site as of March 31st, I dont see how to get this to work. If anyone has figured this out, please let me know how you did it. I am sure there are many people looking around trying to figure this out. Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 I have looked at implementing the c_prod parameter. The problem is if the customer orders 2 or more different items. Only the last item entered will show up on 2Checkout's "Order Details" page, since 2Checkout can only handle one type of product per order. This would confuse the customer and is pretty much useless. In addition, even with the c_prod and id_type params entered, the 'Incoming order processed' email from 2checkout still doesn't list what the customer bought, so what's the point? If you want to add it anyway, here is the /catalog/includes/modules/payment/pm2checkout.php. This will allow each recognized product to be automatically entered into the 2Checkout Products listing when purchased. However the item descriptions will be empty as I have not figured out which variables govern that. It would be a easy fix if you know. If you use this file, I recommend changing id_type to '2' on a live site. This will hide the incorrect 2Checkout Order Details page. <?php /* $Id: pm2checkout.php,v 1.19 2003/01/29 19:57:15 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License Updates May 13 2004 by http://www.rayservers.com */ class pm2checkout { var $code, $title, $description, $enabled; // class constructor function pm2checkout() { global $order; $this->code = 'pm2checkout'; $this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE; $this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_2CHECKOUT_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_2CHECKOUT_STATUS == 'True') ? true : false); $this->check_hash = ((MODULE_PAYMENT_2CHECKOUT_CHECK_HASH == 'True') ? true : false); $this->secret_word = MODULE_PAYMENT_2CHECKOUT_SECRET_WORD; $this->login_id = MODULE_PAYMENT_2CHECKOUT_LOGIN; if ((int)MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); // $this->form_action_url = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c'; $this->form_action_url = 'https://www2.2checkout.com/2co/buyer/purchase'; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_2CHECKOUT_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_2CHECKOUT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { global $order; $selection = array('id' => $this->code, 'module' => $this->title ); return $selection; } function pre_confirmation_check() { return false; } function confirmation() { global $HTTP_POST_VARS; //if (DEFAULT_CURRENCY <> 'CAD') //$title = $this->title . MODULE_PAYMENT_2CHECKOUT_CURRENCY_CONVERSITION; //else $title = $this->title; $confirmation = array('title' => $title); return $confirmation; } function process_button() { global $HTTP_POST_VARS, $order, $currency, $currencies, $demo; global $i, $n; //if (DEFAULT_CURRENCY <> 'CAD') //{ //$cOrderTotal = $currencies->get_value("CAD") * $order->info['total']; //} //else $cOrderTotal = $order->info['total']; if (MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') $demo = 'Y'; else $demo = ''; // fill 2Checkout V2 details with osc order info // these fields automate product creation on 2checkout's site. comment out all except c_prod if you do not want this feature for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { $process_button_string .= tep_draw_hidden_field('c_prod', $order->products[$i]['model'] . ',' . $order->products[$i]['qty']); $process_button_string .= tep_draw_hidden_field('c_name', $order->products[$i]['name']); $process_button_string .= tep_draw_hidden_field('c_price', $order->products[$i]['price']); $process_button_string .= tep_draw_hidden_field('c_description', ' '); // not sure how to input the description here } $process_button_string .= tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) . tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) . tep_draw_hidden_field('x_invoice_num', date('YmdHis')) . tep_draw_hidden_field('demo', $demo) . tep_draw_hidden_field('fixed', 'Y') . // If you set this parameter equal to Y, it will disable the following objects on the checkout page: ?Save Changes? button, quantity selector data field, ?Continue Shopping? button tep_draw_hidden_field('c_tangible', 'Y') . // change to N if you sell only non-tangible (ie downloadable) goods tep_draw_hidden_field('id_type', '1') . // corresponds with c_prod parameter. '1' for vendor_product_id, '2' for assigned_product_id tep_draw_hidden_field('x_first_name', $order->customer['firstname']) . tep_draw_hidden_field('x_last_name', $order->customer['lastname']) . tep_draw_hidden_field('x_address', $order->customer['street_address']) . tep_draw_hidden_field('x_city', $order->customer['city']) . tep_draw_hidden_field('x_state', $order->customer['state']) . tep_draw_hidden_field('x_zip', $order->customer['postcode']) . tep_draw_hidden_field('x_country', $order->customer['country']['title']) . tep_draw_hidden_field('x_email', $order->customer['email_address']) . tep_draw_hidden_field('x_phone', $order->customer['telephone']) . tep_draw_hidden_field('x_ship_to_first_name', $order->delivery['firstname']) . tep_draw_hidden_field('x_ship_to_last_name', $order->delivery['lastname']) . tep_draw_hidden_field('x_ship_to_address', $order->delivery['street_address']) . tep_draw_hidden_field('x_ship_to_city', $order->delivery['city']) . tep_draw_hidden_field('x_ship_to_state', $order->delivery['state']) . tep_draw_hidden_field('x_ship_to_zip', $order->delivery['postcode']) . tep_draw_hidden_field('x_ship_to_country', $order->delivery['country']['title']) . tep_draw_hidden_field('tco_currency', $currency) . // tep_draw_hidden_field('x_receipt_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . // 'Look & Feel' Settings take precendence over this setting tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE')); return $process_button_string; } function before_process() { /*global $HTTP_POST_VARS; if ($HTTP_POST_VARS['x_response_code'] != '1') { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE), 'SSL', true, false)); } // check the md4 hash if ($this->check_hash == true) { $compare_string = $this->secret_word . $this->login_id . $HTTP_POST_VARS['x_trans_id'] . $HTTP_POST_VARS['x_amount']; // make it md5 $compare_hash1 = md5($compare_string); // make all upper $compare_hash1 = strtoupper($compare_hash1); $compare_hash2 = $HTTP_POST_VARS['x_MD5_Hash']; if ($compare_hash1 != $compare_hash2) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_HASH_MESSAGE), 'SSL', true, false)); } }*/ return false; } function after_process() { return false; } function get_error() { global $HTTP_GET_VARS; $error = array('title' => MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR, 'error' => stripslashes(urldecode($HTTP_GET_VARS['error']))); return $error; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_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, set_function, date_added) values ('Enable 2CheckOut Module', 'MODULE_PAYMENT_2CHECKOUT_STATUS', 'True', 'Do you want to accept 2CheckOut payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '18157', 'Login/Store Number used for the 2CheckOut service', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Test', 'Transaction mode used for the 2Checkout service', '6', '3', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Merchant Notifications', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'True', 'Should 2CheckOut e-mail a receipt to the store owner?', '6', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_2CHECKOUT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Check MD5 hash', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'False', 'Should the 2CheckOut MD5 hash facilty to be checked?', '6', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Word', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD', 'tango', 'Secret word for the 2CheckOut MD5 hash facility', '6', '9', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'MODULE_PAYMENT_2CHECKOUT_ZONE', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD'); } } ?> Quote Link to comment Share on other sites More sharing options...
Farrukh Posted March 29, 2005 Share Posted March 29, 2005 arm The Demo test was successful Now do I "Set 'Direct Return' to 'No'" option to "Yes" Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 arm The Demo test was successful Now do I "Set 'Direct Return' to 'No'" option to "Yes" <{POST_SNAPBACK}> Yes direct return should now work. Quote Link to comment Share on other sites More sharing options...
Farrukh Posted March 29, 2005 Share Posted March 29, 2005 Yes, and I tested it with the demo and it worked. I have it on Production now . thanks alot for your effort Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 DOH! I need to get more sleep. Just realized I read 2Checkout's parameter syntax incorrectly. It's a simple fix to get the detailed order info working. This means the c_prod and id_type info will be submitted properly, so please update to the new pm2checkout.php for compliance. Check the contrib section for the updated file. If you have it installed already just replace your /catalog/includes/modules/playments/pm2checkout.php Quote Link to comment Share on other sites More sharing options...
Farrukh Posted March 29, 2005 Share Posted March 29, 2005 Thanks for the update arm Quote Link to comment Share on other sites More sharing options...
Farrukh Posted March 29, 2005 Share Posted March 29, 2005 (edited) Now, I updated the Module This is the email I received from 2Checkout after placing a Demo order. We attempted to create the following product but couldn't find all the required paramters. The following paramters are required for product creation: c_prod c_name c_price c_description For this product: c_prod_1 = ABM-064 We did NOT receive a name, it should have been sent as c_name_1 We did NOT receive a description, it should have been sent as c_description_1 We did NOT receive a price, it should have been sent as c_price_1 Edited March 29, 2005 by Farrukh Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 (edited) Sorry there is a typo in the contrib. I will upload a new pm2checkout.php Thanks for catching it. Edited March 29, 2005 by arm1tage Quote Link to comment Share on other sites More sharing options...
Luke99 Posted March 29, 2005 Share Posted March 29, 2005 Hi, I had a previously working V2 file, so I just added the new required params from your new contribute. Thanks for that btw.... I added the global variables and the 2 new params but not the ones below: c_name c_price c_description So, in demo mode all works fine but the email does not input the product_id nor the description. Is this a normal behavior? Thanks :thumbsup: Quote SS:20030317 Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 So, in demo mode all works fine but the email does not input the product_id nor the description.Is this a normal behavior? <{POST_SNAPBACK}> yes this is normal. i have submitted asked 2co about this, but i haven't heard back yet. hopefully they will update their order email to show the details like osc's email. Quote Link to comment Share on other sites More sharing options...
Farrukh Posted March 29, 2005 Share Posted March 29, 2005 here is the email after update We attempted to create the following product but couldn't find all the required paramters. The following paramters are required for product creation: c_prod c_name c_price c_description For this product: c_prod_2 = MUB-001 We did NOT receive a name, it should have been sent as c_name_2 We did NOT receive a description, it should have been sent as c_description_2 We did NOT receive a price, it should have been sent as c_price_2 Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 It looks as if you did not use the updated pm2checkout.php. Try replacing your /includes/modules/payment/pm2checkout.php with the latest version (2.0b) Quote Link to comment Share on other sites More sharing options...
Hasmik Posted March 29, 2005 Share Posted March 29, 2005 Help! installed the contrib and got the following message during the checkout, at the choose address stage. Warning: Cannot modify header information - headers already sent by (output started at /usr/home/durigch/public_html/osc/includes/modules/shipping/zones.php:214) in /usr/home/durigch/public_html/osc/includes/functions/general.php on line 29 what does this mean and how can I correct it? Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 29, 2005 Author Share Posted March 29, 2005 Help! installed the contrib and got the following message during the checkout, at the choose address stage. Warning: Cannot modify header information - headers already sent by (output started at /usr/home/durigch/public_html/osc/includes/modules/shipping/zones.php:214) in /usr/home/durigch/public_html/osc/includes/functions/general.php on line 29 what does this mean and how can I correct it? <{POST_SNAPBACK}> This might mean those files have incorrect syntax or extra spaces at the beginning or end of the file. Make sure the editor you use does not add any white spaces. None of the files in the contrib should cause this. Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 30, 2005 Author Share Posted March 30, 2005 Eric Webster from 2CO has been kind enough to point out some errors in the contrib, which I have fixed. Today's v2.0c should fix all c_prod related errors. Known issues: -does not work with downloadable goods -reported CAD currency problem (i have not tested this) Please try out the new version and let me know. And sorry for all the errors - I am not a programmer, just deperate to get my shop working. http://www.oscommerce.com/community/contributions,904 Quote Link to comment Share on other sites More sharing options...
freee Posted March 30, 2005 Share Posted March 30, 2005 It is still not working for me. I can only see cart total amount passed on and I can complete the checkout process. A question for those who got it working .......Do your charge your customers for the shipping. I did not see anywhere in 2CO's email that they required me to provide product info and what is in the cart.I was only told to upgrade fro V1 tp V2 by 31/03. I am based in Australia. What about "shipping value"? Maybe that is causing my problem. I use Oc to calculate shipping charges. PLEASE COMMENT ON THE SHIPPING ISSUE. Quote Link to comment Share on other sites More sharing options...
Fabien Posted March 31, 2005 Share Posted March 31, 2005 Same here. We only get a single cart ID with the total amount, even if there are several items in the cart :'( The readme file talk about HTTPS_COOKIE_DOMAIN but what about HTTPS_COOKIE_PATH ? What are we suppose to put there ? define('HTTPS_COOKIE_PATH', '/'); ? Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 31, 2005 Author Share Posted March 31, 2005 Same here. We only get a single cart ID with the total amount, even if there are several items in the cart :'( The readme file talk about HTTPS_COOKIE_DOMAIN but what about HTTPS_COOKIE_PATH ? What are we suppose to put there ? define('HTTPS_COOKIE_PATH', '/'); ? <{POST_SNAPBACK}> freee: yes shipping is calculated by osc and has nothing to do with 2checkout. their new requirement is that each order specify the details of each item sold using the c_prod parameter. if you do not see the product details in your cart and you have updated to the latest version (v2.0c), then i don't know what the problem is. you can check out my LIVE site at http://www.motorbags.com to see the contrib in action. get up to the Order Details screen and see the line by line product list without entering any cc info. Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 31, 2005 Author Share Posted March 31, 2005 With a working contrib, you will see the Order Detail page with a line by line listing of items in your cart. HOWEVER, when you get the confirmation email from 2CO, there will be no line by line listing, ONLY the unique cart number. Quote Link to comment Share on other sites More sharing options...
SavageSinister Posted March 31, 2005 Share Posted March 31, 2005 For the record, I just downloaded and installed the 2.0c 2COv2 contribution, and, while the transaction went through and processed, I also got a single 'Cart' entry when I reached the 2CO payment page -- no itemized list of products. I was very, very careful about following the provided installation instrux, since I didn't want to have to do it more than once. There's still something missing here, somewhere...? Quote Link to comment Share on other sites More sharing options...
arm1tage Posted March 31, 2005 Author Share Posted March 31, 2005 For the record, I just downloaded and installed the 2.0c 2COv2 contribution, and, while the transaction went through and processed, I also got a single 'Cart' entry when I reached the 2CO payment page -- no itemized list of products. I was very, very careful about following the provided installation instrux, since I didn't want to have to do it more than once. There's still something missing here, somewhere...? <{POST_SNAPBACK}> I am getting the same thing today. Earlier if I bought 3 items only 2 were listed. Now the itemized list is gone totally. I have heard that 2CO is updating and changing some things so expect some weirdness. Quote Link to comment Share on other sites More sharing options...
SavageSinister Posted March 31, 2005 Share Posted March 31, 2005 I have heard that 2CO is updating and changing some things so expect some weirdness. <{POST_SNAPBACK}> Heh. Let's hope that one of the things they update/change is making the v2 admin panel actually work - have you tried the "Find all sales not marked shipped" feature yet? Yikes. Eesh. These guys. Weirdness is an understatement. Quote Link to comment Share on other sites More sharing options...
freee Posted March 31, 2005 Share Posted March 31, 2005 (edited) freee: yes shipping is calculated by osc and has nothing to do with 2checkout. their new requirement is that each order specify the details of each item sold using the c_prod parameter. if you do not see the product details in your cart and you have updated to the latest version (v2.0c), then i don't know what the problem is. you can check out my LIVE site at http://www.motorbags.com to see the contrib in action. get up to the Order Details screen and see the line by line product list without entering any cc info. <{POST_SNAPBACK}> I have just visited your site and all I could see on "order details" page was Cart 20050331152759 $ 45.51 USD $ 45.51 USD . There were no individual products and shipping was not visable as a separate entry. I am now really confused beacuse that is exactly what I get and everybody is telling me that the contribution is working. Well, it is working but product details are not there just the order total value. Edited March 31, 2005 by freee Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.