Support » Plugin: WooCommerce Currency Switcher by PluginUs.NET. Woo Multi Currency and Woo Multi Pay » customising for Payment Express gateway not working

  • Resolved Polinet

    (@polinet)


    Hi,

    I am trying to customise this to work with Payment Express gateway woo plugin http://www.woothemes.com/products/payment-express/

    I have tried using the codes you have supplied for other gateways on your plugin site (thank you!) but since each one of your codes starts with

    if(class_exists(‘WOOCS’)) {

    When I add this to the payment express gateway plugin code (where it sets currency and amount) it skips that section! I tested it by removing the check
    if(class_exists(‘WOOCS’)) { and it seems to produce errors (sets NZD as currency even though it is not even in my list of currencies at all, does not transfer the amount)

    So I am guessing this WOOCS class needs to be somehow initialised inside the payment express plugin code? How do I go about it? Or if its not initialised by default I need to rely on session variables?

    I have set multiple allowed as yes and it works perfectly fine with PayPal and Cash on Delivery (thanks again!) but I need to get it working with Payment Express also.

    My full code if needed is as follows:

    if (class_exists(‘WOOCS’))
    {
    global $WOOCS;
    $currencies = $WOOCS->get_currencies();
    $currency = $WOOCS->current_currency;
    //+++
    $amount = $order->order_total;
    $amount = $amount * $currencies[$WOOCS->current_currency][‘rate’];
    }
    else
    {
    $amount = $order->order_total;
    $currency = get_option(‘woocommerce_currency’);
    }

    https://wordpress.org/plugins/woocommerce-currency-switcher/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have managed to resolve this issue using session variables instead. Feel free to include it in your compatibilities listings. Below is the resulting fully functional code, starting with the first couple of lines from the original code so you know where to place this.

    //Generate a unique identifier for the transaction

    $TxnId = uniqid(“ID”);

    if (class_exists(‘WOOCS’))
    {
    global $WOOCS;
    $currencies = $WOOCS->get_currencies();
    $currency = $_SESSION[‘woocs_current_currency’];
    $amount = $order->order_total;
    $amount = $amount * $currencies[$_SESSION[‘woocs_current_currency’]][‘rate’];
    }
    else{
    $currency = get_option(‘woocommerce_currency’);
    $amount = $order->order_total;
    }

    Plugin Author RealMag777

    (@realmag777)

    Hello Poli
    Thank you!! By the way I am preparing new version of the plugin, update, for codecanyon and for wordpress.org which will be working nearly for all payment gateways without any customization, I hope next week it will be released ….

    Plugin Author RealMag777

    (@realmag777)

    Hello Poli
    Try please 1.0.9

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘customising for Payment Express gateway not working’ is closed to new replies.