Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24
  1. #21
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,474
    Plugin Contributions
    88

    Default Re: Forcing default currency at checkout

    Aha! The issue is that the currencies' initialization doesn't take the setting "Switch To Default Language Currency?" into account on the very first access.

    Try changing your store's /includes/init_includes/init_currencies.php, adding the highlighted fragment:
    Code:
    <?php
    /**
     * initialise currencies
     * see {@link  http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
     *
     * @package initSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: init_currencies.php 6300 2007-05-11 15:49:41Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    
    // If no currency is set, use appropriate default
    if (!isset($_SESSION['currency']) && !isset($_GET['currency']) ) $_SESSION['currency'] = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;  //-20160404-lat9-Force language currency
    
    // Validate selected new currency, if any. Is false if valid not found.
    $new_currency = (isset($_GET['currency'])) ? zen_currency_exists($_GET['currency']) : zen_currency_exists($_SESSION['currency']);
    
    // Validate language-currency and default-currency if relevant. Is false if valid not found.
    if ($new_currency == false || isset($_GET['language'])) $new_currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? zen_currency_exists(LANGUAGE_CURRENCY) : $new_currency;
    
    // Final check -- if selected currency is bad and the "default" is bad, default to the first-found currency in order of exch rate.
    if ($new_currency == false) $new_currency = zen_currency_exists(DEFAULT_CURRENCY, true);
    //echo '<br />NEW = ' . $new_currency . '<br />';
    
    // Now apply currency update
    if (
       // Has new currency been selected?
      (isset($_GET['currency'])) || 
    
      // Does language change require currency update?
      (isset($_GET['language']) && USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']  )
    
    ) {
      $_SESSION['currency'] = $new_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_base, zen_get_all_get_params(array('currency','language'))));
    }
    ?>

  2. #22
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Forcing default currency at checkout

    Thanks lat9 ... I must need more coffee today ... I stared at that line multiple times and missed that, because the next few lines take the language into account. (But they only trigger if the language is being changed.) Good catch.

    hairydog, does the suggestion from lat9 fix your situation?
    .

    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.

  3. #23
    Join Date
    Sep 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Forcing default currency at checkout

    Quote Originally Posted by DrByte View Post
    hairydog, does the suggestion from lat9 fix your situation?
    I hope so. I've put that bit of code in, but haven't had time to remove the workaround to see if the problem is still gone. It certainly looks like the sort of thing the symptoms pointed to.

    Thanks to you and lat9

  4. #24
    Join Date
    Sep 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Forcing default currency at checkout

    On reflection, it would be really nice to strip out all the language code entirely, so that there are no language lookups and it uses the default language regardless of sessions, settings or anything. In insular little England, I have never been asked to set up any multi-language sites.

    But there again, there are lots of other bells and whistles in ZC I'd like to get rid of!

 

 
Page 3 of 3 FirstFirst 123

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