#2109 new
Ben Andersen

Currency not displayed correctly in variants selector

Reported by Ben Andersen | December 29th, 2012 @ 06:31 AM

I wanted to drop the decimals in prices so I tried changing how the currency is displayed. It's working but not in the variants selector.

Steps to Repeat
  1. Add the code below to functions.php
  2. Save the base operations
    See how the prices in the variants selector is not displaying as other prices! It uses dollar sign and not the specified format.
add_filter('shopp_countries','shopp_currency_change');
function shopp_currency_change ($data) {

    // Set the country from the country code in shopp/core/model/Lookup.php countries - line 70
    $country = 'SE';

    // Get current currency code
    $code = $data[$country]['currency']['code'];

    // Manipulate currency format - reference current format in Lookup.php - line 70
//    $newFormat = '# ###,## SEK';
    $newFormat = '# SEK';

    // Post changed currency format
    $data[$country]['currency']['format'] = $newFormat;

    // Return the manipulated data to be used with Shopp
    return $data;
}

See screenshot of the wrong behavior here: http://troll.ws/image/e0ae05c5
See screenshot of correct behavior when using the commented out line above, but the idea was to drop the decimals: http://troll.ws/image/cbb950f3

Environment

Shopp Version: 1.2.5

Comments and changes to this ticket

  • Ben Andersen

    Ben Andersen April 11th, 2013 @ 04:48 PM

    I also tried:
    $newFormat = '# ### ### SEK'; like you suggested jond, but I got the same result with the variants.

    I did re-save base of operations. The price display looked the same which is ok.

  • Ben Andersen

    Ben Andersen April 12th, 2013 @ 05:17 PM

    In Sweden we don't have anything less than 1 SEK now. So the formatting as default would be better without decimals like the Japanese Yen.

  • Ben Andersen

    Ben Andersen April 12th, 2013 @ 05:26 PM

    Also, kr should be replaced by SEK in the currency formatting.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Plugin e-commerce for WordPress

Shared Ticket Bins

People watching this ticket