Jump to content


  • Content count

  • Joined

  • Last visited

Posts posted by Ian-San

  1. I got this to work with only minor modification.


    1) WP only update currencies once a day at midnight so no real need for an auto update. So it can be easily added to the normal currency update in Admin.


    2) You need to set a password for the info server in WP Admin.


    3) You need to add this to admin/application_top.php


    // WP Currency Update

    require(DIR_WS_CLASSES . 'currency_update.php');


    4) You need to add this to admin/currencies.php:


    $baseCurrency = 'GBP'; // requested by you when worldpay was setup. this is the ISO country code of your trading currency

    $instId = MODULE_PAYMENT_WORLDPAY_ID; // issued by worldpay

    $infoPW = 'xxxxx'; // set by you in the worldpay admin area

    $worldpayUrl = 'select.worldpay.com/wcc/info?op=rates&instId=' . $instId . '&infoPW=' . $infoPW;


    $cu = new CurrencyUpdate( $worldpayUrl, $baseCurrency );




    between the last bracket of case 'update': and tep_redirect(tep_href_link(FILENAME_CURRENCIES, 'page=' . $HTTP_GET_VARS['page'] . '&cID=' . $HTTP_GET_VARS['cID']));


    Replace the xxxxx with your info server password.


    5) Modify function UpdateDB in class currency_update.php to:


    function UpdateDB(){

    for( $i=0; $i<count( $this->exchangeRates ); $i++ ){

    $sql = 'UPDATE currencies SET value = '' . $this->exchangeRates[$i]['rate'] . '',

    last_updated = '' . $this->date . ' ' . date("H:i:s") . ''

    WHERE code = '' . $this->exchangeRates[$i]['destinationISOCode'] . ''';

    tep_db_query( $sql );




    and add this file to admin/includes/classes



    So how does it work?


    Firstly, it updates currencies according to the normal OS method. Then it replaces the exchange rates for the installed WP currencies with WP exchange rates. This allows you to display more currencies in OS than you have installed in WP (you cannot get exchange rates from WP for non-installed curencies so this is a bit of a comprimise).


    At the moment, it is not general enough nor linked to the WP Admin part but this are very simple issues. Also, I would prefer that it didnt replace the GBP currency again with an exchange rate of 1 - pointless waste of resource.


    When I have time, I will make it into a contribution. If any brave souls want to test it and feedback ....

  2. I got stuck here on the installation instructions:
    2. Add: define('FILENAME_WPCALLBACK', 'wpcallback.php');

      To catalog/includes/filenames.php

    I don't seem to have that file (using Loaded 5). Is this part of MS1 or a later release? Is there an alternative way of doing this?


    put it in catalog/includes/application_top.php if yoy are not using the latest snapshot.

  3. I believe I read somewhere that WP only update their exchange rates once per day - but not sure on that now.


    Live, ongoing, updates would seem to be an unnecessary overhead. Also, bear in mind that many sites do not have access to cron.


    I guess the compromise would be to run the update each time that admin is loaded?


    Secondly, you can force the correct payment if you do not allow alternative currencies in WP. In this case, all orders would be passed to WP in GBP and have to be paid in GBP.


    Thirdly, a problem I had with this module is that it only allows the update of the currencies that you have registered (and paid extra for) with WP. ie. I display Yen, GBP, Dollar and Euro but can only accept payment in GBP and Yen. So Dollar and Euro probably do not get updated (actually, not sure about these - they may be allowed by default in WP - but assume it was Switzerland Francs for example)

  4. The problem with integrating the currency update is that it is not actually an addition to the wp module but instead it is part of admin. Still it is an interesting idea.


    WP always allowed you to link to their credit card images, just not download and store them. There is no real issue either way but if you do link (rather than store on your site) you may get performance issues and if you download, you have to keep them updated!


    Dont put the images in MODULE_PAYMENT_WORLDPAY_TEXT_TITLE as this appears in various places in the store / admin and will definitely screw things up!


    Instead, you could add a 'more info' link to this title to say the payment info page.

  5. It kinda works. The country is displayed fine. However, it's the hidden "country" field that isn't working properly.  At present, it's only showing the first letter of the ISO code (ie F for France, instead of FR).  Not too sure why though....


    Its difficult to say but I suspect that you are not seeing the first letter of the ISO code but the first letter of The Country name because there is a problem with the customer array in catalog/includes/classes/order.php.


    The problem is likely to be in the order.php class customer_address_query somewhere. Some things to look for are:


    - Try temporarily changing the 2 letter ISO code in table countries to something wierd to confirm that you are seeing the first letter of the ISO code and not the first letter of the Country Name.


    - is the customers Country Name exactly the same as that stored in the countries table and is the associated id number the same as that stored for the customer in the adress_book table under entry_country_id?


    - are you using a recent version of the order class?


    - is the hidden field in worldpay enetered EXACTLY as:


    tep_draw_hidden_field('country', $order->customer['country']['iso_code_2'])


    - you could try replacing this field with:


    tep_draw_hidden_field('country', $order->$order->$customer_address['countries_iso_code_2'])


    not sure if this will work though!

  6. Can you guys who say everything is working fine with no problems confirm for me that you can go into your store on the index (default) page from a clean browser, immediately go to login with nothing in the shopping cart and successfully login rather than being sent back to the index page, still not logged in.


    Thanks :)


    Yes - it works for me. I am using SEFU plus storing sesions in MySQL.

  7. However, I have discovered a problem with this code in html_output.php:


    if ($HTTP_GET_VARS['language'] && $kill_sid) {

    if (tep_not_null($parameters)) {

    $parameters = ereg_replace("[&]language=[a-z][a-z]", "", $parameters);


    if (tep_not_null($parameters)) {

    $parameters .= "&language=" . $HTTP_GET_VARS['language'];

    } else {

    $parameters = "language=" . $HTTP_GET_VARS['language'];




    Rather than just replacing the language/en it is adding the new language string e.g. it becomes: language/ja/language/en in the second if.


    I think the second if should test for $HTTP_GET_VARS['language'] not $parameters??

  8. I dont think you can cover every possibility, I have been playing with this idea:


    Create a pop-up window to say 'thank you for your payment, please close this window to complete your order.'


    Initially, this will be behind the security alert if there is one.


    Then when the user closes this window, invoke the redirect to checkout_process.


    Could use something like:




    if (win1.closed) function1() else function2()




    if (window.opener.closed) function1() else function2()


    invoked using an onload in body.


    Problem is not sure if it will run when the security alert is manually closed as technically, the user does not actually enter the insecure site - the url remains as worldpay.

  9. Graeme


    Much better! Now if I cancel the pop-up security warning (which is due to my high security setting on my PC) I still get left with the thank you window as before.


    However, now I would normally try to close it using the button. Even though I get the security warning again, I now know that I have to click 'yes' to close the window and I return to the store with no problem.


    I would also add cc 's suggestion plus maybe reduce the time out a bit on the redirect to the minimum allowed.

  10. Graeme


    I would recommend adding a big 'Close this window' button to the 'Your payment was successfully received - Thank you! ' window.


    When you get this window, you then get the standard pop-up 'your are about to leave a secure internet connection..' box. If the customer says 'no' to this, and then closes down the window using the X in the corner, you do not get the confirmation of the order. If you add a big button, there is a 99% change that they will use it to close the window and so reduce this risk.