joekilo Posted July 20, 2003 Share Posted July 20, 2003 Does anyone know where the above code should go? Quote jk Link to comment Share on other sites More sharing options...
pilot1 Posted July 20, 2003 Share Posted July 20, 2003 <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF"> <p>the best place to put the code is where you want it to show</p> <script language="JavaScript" src="http://www.worldpay.com/cgenerator/cgenerator.php?instId=' . MODULE_PAYMENT_WORLDPAY_ID . '"></script> <p> </p> </body> </html> Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
pilot1 Posted July 21, 2003 Share Posted July 21, 2003 Has anyone had worldpay working with MS2 yet? Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
Ian-San Posted July 21, 2003 Share Posted July 21, 2003 thanks but i dont know where i have to put it? im new to the coding side of things and have got by so far by the good advice within this forum... so if you know where i place this within which file i would be greatful thanks Well, assuming that you are using a clean copy of OSC, then my suggestion would be to start by putting the images into the conditions file like this: Find catalog/includes/languages/english/conditions.php Look for: define('TEXT_INFORMATION', 'Put here your Conditions of Use information.'); And paste the above code in say like this: define('TEXT_INFORMATION', ' We accept the following credit cards:<br><center> <script language="JavaScript" src="http://www.worldpay.com/cgenerator/cgenerator.php?instId=' . MODULE_PAYMENT_WORLDPAY_ID . '"></script></center> '); Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
joekilo Posted July 21, 2003 Share Posted July 21, 2003 i want the images to be at the footer of my site i guess, but i still dont know where to put....if i put in conditions of use...they will not be seen until entering that file ?? can these be placed at in the footer? or does it need enlarging? if it can please advise how? thanks Quote jk Link to comment Share on other sites More sharing options...
fawess Posted July 25, 2003 Share Posted July 25, 2003 FINALLY !!!! I FOUND THE FIX for the Warning and Fatal ERROR in the activation and configuration of the Worldpay Payment Module!! :D :D Posted: Sun Jul 13, 2003 7:07 pm Post subject: help please------------------------------------------------------------------------------- i am having to post this again as i am stuck please if anyone can help me with it i would be very greatful: hi i have been prompted to post this querie here. i have installed the worldpay module and thought it worked but recieved this message Warning: call_user_func(tep_get_order_status_name) [function.call-user-func]: First argument is expected to be a valid callback in /home/wa604sb/public_html/cart/admin/includes/functions/general.php on line 1232 [code] and if i try and edit i get this Fatal error: Call to undefined function: tep_cfg_pull_down_order_statuses() in /home/wa604sb/public_html/cart/admin/modules.php(204) : eval()'d code on line 1 steve thanks for reply i checked the forum but like you said the answer wasnt there.....i am unableto progress unless i sort it out their must be a quick fix ? can anyone advise why this is happening on cvs 2.2 thanks _________________ jk You can Add theses functions to the file admin/includes/functions/general.php it should fix the problem and let you use the worldpay module ... [code] //added by JSS from OSC_22_M1 general.php function tep_cfg_pull_down_order_statuses($order_status_id, $key = '') { global $languages_id; $name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value'); $statuses_array = array(array('id' => '0', 'text' => TEXT_DEFAULT)); $statuses_query = tep_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . $languages_id . "' order by orders_status_name"); while ($statuses = tep_db_fetch_array($statuses_query)) { $statuses_array[] = array('id' => $statuses['orders_status_id'], 'text' => $statuses['orders_status_name']); } return tep_draw_pull_down_menu($name, $statuses_array, $order_status_id); } //added by JSS from OSC_22_M1 general.php function tep_get_order_status_name($order_status_id, $language_id = '') { global $languages_id; if ($order_status_id < 1) return TEXT_DEFAULT; if (!is_numeric($language_id)) $language_id = $languages_id; $status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order_status_id . "' and language_id = '" . $language_id . "'"); $status = tep_db_fetch_array($status_query); return $status['orders_status_name']; } Quote ================= Fares. Contribution is the key! Link to comment Share on other sites More sharing options...
fawess Posted July 25, 2003 Share Posted July 25, 2003 If you get a Warning upon return to OSc with the Callback from Worldpay you need to do this : In this case, the MC_callback field had been assembled with the language parameter on the end, utilising a ? instead of a & Hence the illegal character - it looks OK at first glance, but try and emulate what the parser will do and BINGO :) That is only part of the problem. That part of the code as-is works OK if the user has cookies enabled. The problem comes when cookies are disabled and OSC is having to propagate osCsid. With cookies enabled the MC_callback value looks something like: value="www.example.com/catalog/wpcallback.php?language=en"> With cookies disabled it looks something like this: value="www.example.com/catalog/wpcallback.php?osCsid=10bfe8d3dfae5a892a8f827ea9f4f190?language=en"> The fix for it would be to check the callback link for the presence of osCsid and act accordingly. Here's the relevant patched section from my copy of /catalog/includes/modules/payment/worldpay.php: // Ian-san: Create callback and language links here 6/4/2003: $callback_url = tep_href_link(FILENAME_WPCALLBACK); $worldpay_callback = explode('http://', $callback_url); $language_code_raw = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id ='$languages_id'"); $language_code_array = tep_db_fetch_array($language_code_raw); $language_code = $language_code_array['code']; $address = htmlspecialchars($order->customer['street_address'] . "n" . $order->customer['suburb'] . "n" . $order->customer['city'] . "n" . $order->customer['state'], ENT_QUOTES); $process_button_string .= tep_draw_hidden_field('testMode', MODULE_PAYMENT_WORLDPAY_MODE) . tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('address', $address) . tep_draw_hidden_field('postcode', $order->customer['postcode']) . tep_draw_hidden_field('country', $order->customer['country']['iso_code_2']) . tep_draw_hidden_field('tel', $order->customer['telephone']) . tep_draw_hidden_field('myvar', 'Y') . tep_draw_hidden_field('fax', $order->customer['fax']) . tep_draw_hidden_field('email', $order->customer['email_address']); // Ian-san: Added dynamic callback and languages link here 6/4/2003: $process_button_string .= tep_draw_hidden_field('lang', $language_code); // the callback link is invalid when cookies are disabled and relying on trans_sid // so check whether sid is in the url and change link accordingly if (strstr($worldpay_callback[1], 'osCsid') !== false) { $process_button_string .= tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '&language=' . $language_code); } else { $process_button_string .= tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code); } $process_button_string .= tep_draw_hidden_field('MC_oscsid', $oscSid); hth Quote ================= Fares. Contribution is the key! Link to comment Share on other sites More sharing options...
alan_bab Posted July 26, 2003 Share Posted July 26, 2003 I downloaded version 1.4 of the worldpay payment module. It looks great but in the installation instructions it states that you need to modify the file catalog/includes/filename.php. Unfortunately that file does not exist. I am using the 2.2 snap shot and am running os commerce on windows Any suggestions? Thanks, Alan Quote Link to comment Share on other sites More sharing options...
Ian-San Posted July 26, 2003 Share Posted July 26, 2003 I downloaded version 1.4 of the worldpay payment module. It looks great but in the installation instructions it states that you need to modify the file catalog/includes/filename.php. Unfortunately that file does not exist. I am using the 2.2 snap shot and am running os commerce on windows Any suggestions? Thanks, Alan Modify catalog/includes/application_top.php instead - after a certain date, filename defines were moved to filenames.php. Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
alan_bab Posted July 26, 2003 Share Posted July 26, 2003 thanks Ian for your help, Alan B Quote Link to comment Share on other sites More sharing options...
Guest Posted July 28, 2003 Share Posted July 28, 2003 I need to re-iterate this.......... The first callback WILL work without errors, but the SID is LOST. The Second line has an INVALID SID - there are two question marks in it. Forget about whether cookies are enabled or not - WorldPay will not worry what is on the callback URL. If you look at the code you presented, it does not interrogate a dynamic URL, it is using references from within the setup parameters, so there never will be a SID present in it. Here again is the code that will always work, hang the language prameter on the end if you need it. Nobody responded to my question as to why it is needed. You dont need to include a hidden field with the SID in it as it is passed in the callback URL. I see that the address is still incorretly formatted too - I posted alternative code for that here. Why do people use the SID as the cart ID too ? $worldpay_callbackURL = ereg_replace("^(.{4,5}://)","",HTTP_SERVER); $worldpay_sid = tep_session_name() . '=' . tep_session_id() ; tep_draw_hidden_field('MC_callback', $worldpay_callbackURL.DIR_WS_CATALOG.'wpcallback.php?'.$worldpay_sid) . If you get a Warning upon return to OSc with the Callback from Worldpay you need to do this : In this case, the MC_callback field had been assembled with the language parameter on the end, utilising a ? instead of a & Hence the illegal character - it looks OK at first glance, but try and emulate what the parser will do and BINGO :) That is only part of the problem. That part of the code as-is works OK if the user has cookies enabled. The problem comes when cookies are disabled and OSC is having to propagate osCsid. With cookies enabled the MC_callback value looks something like: value="www.example.com/catalog/wpcallback.php?language=en"> With cookies disabled it looks something like this: value="www.example.com/catalog/wpcallback.php?osCsid=10bfe8d3dfae5a892a8f827ea9f4f190?language=en"> The fix for it would be to check the callback link for the presence of osCsid and act accordingly. Here's the relevant patched section from my copy of /catalog/includes/modules/payment/worldpay.php: // Ian-san: Create callback and language links here 6/4/2003: $callback_url = tep_href_link(FILENAME_WPCALLBACK); $worldpay_callback = explode('http://', $callback_url); $language_code_raw = tep_db_query("select code from " . TABLE_LANGUAGES . " where languages_id ='$languages_id'"); $language_code_array = tep_db_fetch_array($language_code_raw); $language_code = $language_code_array['code']; $address = htmlspecialchars($order->customer['street_address'] . "n" . $order->customer['suburb'] . "n" . $order->customer['city'] . "n" . $order->customer['state'], ENT_QUOTES); $process_button_string .= tep_draw_hidden_field('testMode', MODULE_PAYMENT_WORLDPAY_MODE) . tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('address', $address) . tep_draw_hidden_field('postcode', $order->customer['postcode']) . tep_draw_hidden_field('country', $order->customer['country']['iso_code_2']) . tep_draw_hidden_field('tel', $order->customer['telephone']) . tep_draw_hidden_field('myvar', 'Y') . tep_draw_hidden_field('fax', $order->customer['fax']) . tep_draw_hidden_field('email', $order->customer['email_address']); // Ian-san: Added dynamic callback and languages link here 6/4/2003: $process_button_string .= tep_draw_hidden_field('lang', $language_code); // the callback link is invalid when cookies are disabled and relying on trans_sid // so check whether sid is in the url and change link accordingly if (strstr($worldpay_callback[1], 'osCsid') !== false) { $process_button_string .= tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '&language=' . $language_code); } else { $process_button_string .= tep_draw_hidden_field('MC_callback', $worldpay_callback[1] . '?language=' . $language_code); } $process_button_string .= tep_draw_hidden_field('MC_oscsid', $oscSid); hth Quote Link to comment Share on other sites More sharing options...
Guest Posted July 29, 2003 Share Posted July 29, 2003 whooaaa this thread is long!! It was started because the old thread got out of hand! Trying to find answers in here is a nightmare of searching through, and its only going to get worse as (i hope) a version for MS2 will be released soon! I have a bit of space on my server, does anyone want to help me set up a quick FAQ type page for the Worldpay mod? Is this a good idea? Let me know if so, i suppose we can then spread it to other areas to if it is successfull! A sort of contrib FAQ per contrib :) Quote Link to comment Share on other sites More sharing options...
Ian-San Posted July 29, 2003 Share Posted July 29, 2003 The Second line has an INVALID SID - there are two question marks in it. This code snippet is fundamentally flawed as it will always select the option to put the ? in as it will never find the osCsid in the string. Not that this will concern most users as nearly everyone seems to be working with cookies enabled. A better test would be to check if cookies are on or off. Forget about whether cookies are enabled or not - WorldPay will not worry what is on the callback URL. True but OSC does care and the idea developed in an earlier thread was to pass the CID back through the callback. Again, most people do not care as most are using cookies. Whether it is STILL necessary to pass the CID back in this was is a mute point. If you look at the code you presented, it does not interrogate a dynamic URL, it is using references from within the setup parameters, so there never will be a SID present in it. Not sure about this, example 2 above with the 2 ? shows that there is. Or have I misunderstood? Here again is the code that will always work, hang the language prameter on the end if you need it. On return to the store, only default parameters are used (as you are really running a copy of the store within the WP window) so it will display the default language. By passing the language parameter back like this you can force the language of choice for the user. I see that the address is still incorretly formatted too - I posted alternative code for that here.It seems okay to me?? Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
Guest Posted July 30, 2003 Share Posted July 30, 2003 Does this work with MS2 or is there a planned update to make it compatible with MS2? I have a friend who had there site upgraded to MS2 as soon as it was realised now he wants all the old contribs back :roll: So any progress updates would be good :) Quote Link to comment Share on other sites More sharing options...
macdougall6 Posted July 31, 2003 Share Posted July 31, 2003 Does anyone know if the worldpay module will/can allow two separate worldpay account numbers to be stored or used by OSCommerce? I have two distinct organizations each with their own Worldpay account using the same OSCommerce cart. I would like to send the payment transaction to one of the worldpay accounts based on the contents of the purchase. Any thoughts? Quote Link to comment Share on other sites More sharing options...
Ian-San Posted July 31, 2003 Share Posted July 31, 2003 Does anyone know if the worldpay module will/can allow two separate worldpay account numbers to be stored or used by OSCommerce? I have two distinct organizations each with their own Worldpay account using the same OSCommerce cart. I would like to send the payment transaction to one of the worldpay accounts based on the contents of the purchase. Any thoughts? In a word no. Not sure how you would be able to tell which site was calling the WP module so as to associate the right account number anyway? Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
pilot1 Posted July 31, 2003 Share Posted July 31, 2003 Ian, Sorry a bit off topic, well.... to put on topic thanks for this contribution, it has worked a treat and will be going live in a few days. What I was going to say was that I thought your shadows on the info boxes neat on your site. really effective. Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
Ian-San Posted July 31, 2003 Share Posted July 31, 2003 Ian, Sorry a bit off topic, well.... to put on topic thanks for this contribution, it has worked a treat and will be going live in a few days. What I was going to say was that I thought your shadows on the info boxes neat on your site. really effective. Yep - defintely off topic! No doubt someone is now going to ask how its done - so to avoid cluttering up this thread anymore with this subject, here is the answer: Copy the shadow images under the boxes from my site - left and right. Add to the each info box like this (noting left and right images): new infoBox($info_box_contents); echo tep_image(DIR_WS_IMAGES . 'shadow_l.gif'); // shadow_r.gif for right side. ?> </td> </tr> <!-- information_eof //--> Quote Ian-san Flawlessnet Link to comment Share on other sites More sharing options...
pilot1 Posted July 31, 2003 Share Posted July 31, 2003 Thanks for yet another contribution :wink: Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
pilot1 Posted August 5, 2003 Share Posted August 5, 2003 Back on topic. I have the Worldpay mod working nicely. The email from WorldPay is return Ok but I need some more info in it, like The shopper name and address and the order Number from the shopping cart. These additions Worldpay tell me must be in the variables sent to world pay in the call back script with the prefix MC_ Any help where I would insert these variables would be appreciated, as I think this must of been done a few times before. Thanks in advance Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
radders Posted August 5, 2003 Share Posted August 5, 2003 Yes that's a good point. It can be hard to tie up the email from Worldpay with the appropriate order from your shop (especially if the currency is different). Quote Link to comment Share on other sites More sharing options...
pilot1 Posted August 5, 2003 Share Posted August 5, 2003 Would I get the desired result if I change Modules/worldpay.php to tep_draw_hidden_field('MC_name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('MC_address', $address) . from tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('address', $address) . Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
pilot1 Posted August 5, 2003 Share Posted August 5, 2003 Hmmm Just tried that and the prefilled lines dissapear in the worldpay server. I wonder if you are allowed to have them twice ? once as tep_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('address', $address) . and then again as a callback tep_draw_hidden_field('MC_name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) . tep_draw_hidden_field('MC_address', $address) . Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
pilot1 Posted August 5, 2003 Share Posted August 5, 2003 To do this you go to the worldpay admin and do this * Download the default template file: Go to https://select.worldpay.com/global/email/de...chantDesc.templ and save the file. If you see the file displayed in your web browser please use the "File -> Save As..." option and select the File Type "Text File (*.txt)" from the new "Save Web Page" window before saving the file. Note that the file will probably be saved with the name "merchantDesc_templ.txt" (although depending on your configuration of Windows it may only be visible as "merchantDesc_templ"). * Edit the template file: Double-click on the file you have just saved in the step above to load it into your default text editor, e.g. Notepad. Copy and paste the lines underneath the rest of the displayed text Name: <WPDISPLAY ITEM=name> Address: <WPDISPLAY ITEM=address> Postcode: <WPDISPLAY ITEM=postcode> Country: <WPDISPLAY ITEM=countryString> Email: <WPDISPLAY ITEM=email> Tel: <WPDISPLAY ITEM=tel> Fax: <WPDISPLAY ITEM=fax> ...and save the file. * Use the modified template: Log in to the Customer Management System (CMS) via http://www.worldpay.com/admin using your Company ID username and password. In the new window that opens after successfully logging in, click on the "File Management button" to the right of the installation ID you're using. Click on the button labelled "Browse" and, using the new "Choose File" window, select your modified copy of "merchantDesc_templ.txt" before clicking on "Open". In the box to the right of "Name of file at WorldPay:" enter the name merchantDesc.templ Click on "UPLOAD". Once this process is complete you should see the text "File uploaded successfully: merchantDesc.templ" displayed near the top of the web page, and "merchantDesc.templ" displayed as one of the uploaded files for the installation ID. * Finally: It is possible that it may take up to two hours before the new payment confirmation email will be used. Transactions coming through WorldPay before this time has passed may generate payment confirmation emails which do not use the new custom layout you have specified. If the emails coming through after this time do not take advantage of the new custom layout please check that you have uploaded the file with the name "merchantDesc.templ" (minus the " characters). Filenames are case-sensitive so for example, merchantdesc.templ would be ignored. Please note that certain variables are not stored by WorldPay and therefore cannot be retrieved should the confirmation receipts go missing en route. Currently this includes any M_, MC_ and CM_ variables in addition to delvName, delvAddress, delvPostcode and delvCountry. If any M_, MC_ or CM_ variables contain a "-" character in their names they must be changed in the code on your website so they can be used in the customised email template. You may also need to check your callback script, if you are using one. Due to their nature, emails are not a guaranteed delivery format. It is recommended that you test this facility before implementing it on a live system. ---------------------------------------------- Last update: June 2003 So you do'nt alter the scripts with this mod Quote What goes up MUST come down Link to comment Share on other sites More sharing options...
pilot1 Posted August 5, 2003 Share Posted August 5, 2003 I have applied the above changes and waited the specified time to let the changes resolve and it works OK, so I get the shoppers address, name and telephone no etc in the receipt email from WorldPay. Quote What goes up MUST come down 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.