Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default [Done v1.3.8] bug in use_default_language_currency switch

    I am selling exclusively to other countries. It would be nice if I could price my products in my local currency (Taiwan dollars) and allow my customers to select their own currency.

    Problem #1: I don't want TWD to show up as the default currency. USD would be OK, and I can do this by setting 'Switch to Default Language Currency' to TRUE and then set USD as the language currency in the english.php file. Great! But there is a lingering problem:

    Problem #2: If the customer changes the currency to (say) UK pounds, the currency keeps on switching back to US dollars with each new page view.

    So my question:

    Is there any way to use US dollars as the default display currency that shows when first arriving at the site, use TWD as the default pricing currency, and allow customer to switch to their preferred currency and maintain that switch for the duration of their session?

  2. #2
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: For-Export-only Zen Cart currency display

    I don't mind talking to myself because it helps to clarify the problems when I write them out.

    I can't use 'Switch to Default Language Currency' - so that has to be set to off...

    Now I just need a way to insert a SELECTED tag in the currency drop-down box.

    The tpl_currencies.php file holds the drop-down box, so I'm thinking I need to have an extra row in the database for the SELECTED tag, or simply hard-code the tpl_currencies.php file for my selected currencies.

    Maybe that's the easiest way...

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: For-Export-only Zen Cart currency display

    Quote Originally Posted by paul3648 View Post
    Problem #2: If the customer changes the currency to (say) UK pounds, the currency keeps on switching back to US dollars with each new page view.
    This is not normal behaviour, and fixing this problem should be the solution for your needs.

    What version of Zen Cart are you using?
    What addons/mods have you installed?
    What version of PHP and MySQL are you using?
    .

    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.

  4. #4
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: For-Export-only Zen Cart currency display

    Quote Originally Posted by DrByte View Post
    This is not normal behaviour, and fixing this problem should be the solution for your needs.

    What version of Zen Cart are you using?
    What addons/mods have you installed?
    What version of PHP and MySQL are you using?
    My test site has:

    ZC 1.37
    PHP 5.2.0
    MySQL 4.1.21-standard

    Addons include Testimonials, Google Froogle, Japanese Language (just the front end), css horizontal menu, css flyout categories, internet explorer stylesheet overrides, and PPEC-137-patches-March21-2007.

    Since it's a test site I can fool around with the various files.

    Thanks for this clue. I'll report back anything I find...

  5. #5
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: For-Export-only Zen Cart currency display

    Quote Originally Posted by DrByte View Post
    This is not normal behaviour, and fixing this problem should be the solution for your needs.
    So you are saying that any changes to the currency should stick for the duration of the session?

    Where is that info stored?

    I've tried changing the various settings under 'configuration/sessions' with no luck.

  6. #6
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: For-Export-only Zen Cart currency display

    I've just tested this on another installation and get the same behaviour:

    When 'Switch to Default Language Currency' is set to true, each new page refresh bring back the default currency for that language.

    So if English is set to USD, the customer switches to British pounds, the next page the currency is back to USD.

    That makes this setting ('Switch to Default Language Currency') almost useless, considering the large number of countries that use English but don't use the USD, or an English-speaking person living in a country which uses another currency than USD.

  7. #7
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: For-Export-only Zen Cart currency display

    I've also tested this on a new installation with both php 5 and php 4, so I understand this, venerable zen masters, as a test of my worthiness

    init_currencies.php is the key - right? It seems to me there should be a flag that is set when changing currencies during a session, so the code would be something like:

    if flag == true
    don't do anything
    else
    init_currencies.php stuff

    Just wish I had the programming skills to make it a reality

  8. #8
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: For-Export-only Zen Cart currency display

    Does this help?

    Try replacing your /includes/init_includes/init-currencies.php file contents with this:
    Code:
    <?php
    /**
     * initialise currencies
     *
     * @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 6244 2007-04-21 07:53:26Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die('Illegal Access');
    }
    
    $new_currency = (isset($_GET['currency'])) ? zen_currency_exists($_GET['currency']) : zen_currency_exists($_SESSION['currency']);
    if ($new_currency == false || isset($_GET['language'])) $new_currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? zen_currency_exists(LANGUAGE_CURRENCY) : $new_currency;
    if ($new_currency == false) $new_currency = zen_currency_exists(DEFAULT_CURRENCY, true);
    
    if ((!isset($_SESSION['currency']) && !isset($_GET['currency']) ) || (isset($_GET['currency'])) || (isset($_GET['language']) && USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']  )) {
      $_SESSION['currency'] = $new_currency;
    }
    ?>
    .

    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.

  9. #9
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: bug in use_default_language_currency switch

    Thank you VERY MUCH!!

    That seems to work GREAT!


  10. #10
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    241
    Plugin Contributions
    0

    Default Re: [Done v1.3.8] bug in use_default_language_currency switch

    Sorry...I don't know why it seemed to work the first time but I'm still having problems.

    This line of code:

    Code:
    if ($new_currency == false || isset($_GET['language'])) $new_currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? zen_currency_exists(LANGUAGE_CURRENCY) : $new_currency;
    ...causes the currency to immediately revert to the default language currency if a currency change is attempted.

    If I comment out this line, the currency changes will stick throughout the session, which is OK, but ideally I would like the language currency to be chosen when first selecting a new language, and then allowing the currency to be changed from the default.

    It seems to be that this can be done with an else statement. I've played around with it a bit but haven't found the solution yet.

    All of this is with Switch To Default Language Currency set to true.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 19 Aug 2009, 07:16 PM
  2. [Done 2.0.0] bug after trying to switch language
    By remulus in forum Bug Reports
    Replies: 4
    Last Post: 3 Aug 2008, 02:12 AM
  3. [Done v1.3.9] Linkpoint bug?
    By yellow1912 in forum Bug Reports
    Replies: 3
    Last Post: 19 Jan 2008, 07:42 PM
  4. [DONE] My Account bug
    By kuroi in forum Bug Reports
    Replies: 3
    Last Post: 8 Jul 2006, 09:55 PM

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