Page 1 of 3 123 LastLast
Results 1 to 10 of 24
  1. #1
    Join Date
    Nov 2011
    Location
    Brisbane, Australia
    Posts
    10
    Plugin Contributions
    0

    Default Forcing default currency at checkout

    I recently upgraded to 1.5.4. Wanting to offer customers the opportunity to see prices in their own currency, I installed the currencies sidebox. However, I need to process transactions in AUD only.

    Some customers would select a currency but that selection remained throughout the checkout process and only the invoice total was shown in AUD. This also caused problems with PayPal registering as a currency conflict.

    I searched for information on how to force the default currency at checkout and found that people had asked, but never seem to have received a solution. I know that you can stop the currencies sidebox from displaying during checkout, but that doesn't help if the wrong currency is active.

    My solution was to modify one file: cart/includes/init_includes/init_currencies.php

    I made two insertions. First insertion near the top of the code:

    PHP Code:
    if (!defined('IS_ADMIN_FLAG'))
    {
      die(
    'Illegal Access');
    }

    // begin insertion 1 of 2

    $force_default_currency false;
    $requested_page $_SERVER['REQUEST_URI'];
    // Does requested page contain the string 'checkout'?
    // If so, then force currency to default
    if (strpos($requested_page'checkout') !== false)
    {
        
    $force_default_currency true;
    }

    // end insertion 1 
    The second insertion is just before the end of the code:

    PHP Code:

    // begin insertion 2 of 2

    elseif ($force_default_currency)
    {
        
    $_SESSION['currency'] = DEFAULT_CURRENCY;
      
    // redraw the page without the currency/language info in the URL
      
    if (isset($_GET['currency']) || isset($_GET['language'])) zen_redirect(zen_href_link($current_page_basezen_get_all_get_params(array('currency','language'))));

    // end insertion 2
    }

    ?> 
    This has solved my issue completely and my method may be helpful to others.

  2. #2
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Forcing default currency at checkout

    Same can be achieved without a hack.

    No matter how many currencies are visible/selectable on the front end, all you need to do in Admin > Modules > Payment > PayPal Express is to set

    Transaction Currency
    Only AUD

    That's it, has worked for me since 2007

  3. #3
    Join Date
    Nov 2011
    Location
    Brisbane, Australia
    Posts
    10
    Plugin Contributions
    0

    Default Re: Forcing default currency at checkout

    That is how my payment module is set.

    As I said, it does put the final total in AUD but everything else in checkout is in the selected currency. Also, I cannot complete the transaction (I only authorise transactions at checkout) because PayPal senses a currency conflict. (I can, however, complete the transaction through my PayPal account rather than Zen's admin.)

    I didn't have this issue with 1.3.9. I am sure it behaves as you suggest. However, I am happy with my hack.

  4. #4
    Join Date
    Aug 2011
    Location
    Pacific NW
    Posts
    28
    Plugin Contributions
    0

    Default Re: Forcing default currency at checkout

    I am experiencing the same thing with a fresh install of 1.5.4. Is the hack the only way to fix this? 1.3.9 worked fine.

    This is my setup.

    PayPal Payments Pro (USA)
    Name:  01.jpg
Views: 332
Size:  9.2 KB

    PayPal Express Checkout via Payflow Pro
    Name:  02.jpg
Views: 329
Size:  8.7 KB

    Here is an order I received today
    Name:  03.jpg
Views: 341
Size:  3.7 KB

  5. #5
    Join Date
    Nov 2011
    Location
    Brisbane, Australia
    Posts
    10
    Plugin Contributions
    0

    Default Re: Forcing default currency at checkout

    Is the hack the only way to fix this? In the absence of any other suggestions, I am assuming so.

  6. #6
    Join Date
    Aug 2011
    Location
    Pacific NW
    Posts
    28
    Plugin Contributions
    0

    Default Re: Forcing default currency at checkout

    Right on. I'll give that a shot. Thanks!

  7. #7
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Forcing default currency at checkout

    Quote Originally Posted by haroldf View Post
    I recently upgraded to 1.5.4. Wanting to offer customers the opportunity to see prices in their own currency, I installed the currencies sidebox. However, I need to process transactions in AUD only.

    Some customers would select a currency but that selection remained throughout the checkout process and only the invoice total was shown in AUD. This also caused problems with PayPal registering as a currency conflict.

    I searched for information on how to force the default currency at checkout and found that people had asked, but never seem to have received a solution. I know that you can stop the currencies sidebox from displaying during checkout, but that doesn't help if the wrong currency is active.

    My solution was to modify one file: cart/includes/init_includes/init_currencies.php

    I made two insertions. First insertion near the top of the code:

    PHP Code:
    if (!defined('IS_ADMIN_FLAG'))
    {
      die(
    'Illegal Access');
    }

    // begin insertion 1 of 2

    $force_default_currency false;
    $requested_page $_SERVER['REQUEST_URI'];
    // Does requested page contain the string 'checkout'?
    // If so, then force currency to default
    if (strpos($requested_page'checkout') !== false)
    {
        
    $force_default_currency true;
    }

    // end insertion 1 
    The second insertion is just before the end of the code:

    PHP Code:

    // begin insertion 2 of 2

    elseif ($force_default_currency)
    {
        
    $_SESSION['currency'] = DEFAULT_CURRENCY;
      
    // redraw the page without the currency/language info in the URL
      
    if (isset($_GET['currency']) || isset($_GET['language'])) zen_redirect(zen_href_link($current_page_basezen_get_all_get_params(array('currency','language'))));

    // end insertion 2
    }

    ?> 
    This has solved my issue completely and my method may be helpful to others.
    Ended up in need of your hack after installing the eWay payment module as my merchant facility only accepts order currency AUD.

    Had no further issues after implementation of your code - thanks!

    Frank

  8. #8
    Join Date
    Nov 2011
    Location
    Brisbane, Australia
    Posts
    10
    Plugin Contributions
    0

    Default Re: Forcing default currency at checkout

    Hello Frank. Glad that it is helpful.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Forcing default currency at checkout

    Since the currency-conversion requirement is something enforced/required by your specific payment module/gateway, I recommend putting code into the payment module itself to handle the conversion during submission. That way the customer still sees the checkout in their own currency and you don't need to interfere with normal currency handling otherwise.

    Here's how it's done in the Authorize.net AIM module: https://github.com/zencart/zencart/b....php#L396-L403
    Obviously you'll need to adjust the specifics for however your gateway prepares its fields for transmission, but this shows you the basics of the calculation logic.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,379
    Plugin Contributions
    9

    Default Re: Forcing default currency at checkout

    Quote Originally Posted by DrByte View Post
    Since the currency-conversion requirement is something enforced/required by your specific payment module/gateway, I recommend putting code into the payment module itself to handle the conversion during submission. That way the customer still sees the checkout in their own currency and you don't need to interfere with normal currency handling otherwise.

    Here's how it's done in the Authorize.net AIM module: https://github.com/zencart/zencart/b....php#L396-L403
    Obviously you'll need to adjust the specifics for however your gateway prepares its fields for transmission, but this shows you the basics of the calculation logic.
    Excellent - thanks Doc!

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. PayPal Checkout in default currency
    By giftmeister in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 15 May 2011, 05:16 AM
  2. Forcing currency on checkout
    By mjpwall in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 20 Dec 2010, 05:06 PM
  3. Currency converting back to default in checkout
    By eurojen in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 0
    Last Post: 26 Nov 2008, 12:13 AM
  4. How to force checkout in default currency?
    By tj1 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 13 Oct 2008, 03:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR