• Hi,

    I am using Currency “wp-e-commerce-multi-currency-magic(version 0.1)” with “WP e-Commerce(version 3.7.6.9)” on WordPress 3.0.1

    I found that when I convert the currency, the price of the product is changed correctly but the currency sign is not changed.

    Another thing is in the cart, the currency sign is double (default sign and the one converted).

    Would be grateful if guys can help me out with this.

    Cheers,
    syzen

    http://wordpress.org/extend/plugins/wp-e-commerce-multi-currency-magic/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Encountered the same problem myself.
    I will probably have to fork into the plug-ins code to get this going. Cross your fingers for the changes to not be very complex πŸ™‚

    I couldn’t detect properly the ‘primary’ currency symbol, so my fix will probably tackle the “$” problem only.
    Not an expert here, so suggestions are welcomed.

    Posted the entire updated wpsc-currency-changer.php (version 0.1) file here:
    http://multi-currency-magic.pastebin.com/MktKvAcN

    In case the plug-in gets updated, I pasted below the changes I made to the file:

    The important lines follow:
    Updated this function:

    function wpsc_add_currency_code($total){
    	global $wpsc_cart;
    //	exit($wpsc_cart->selected_currency_code);
    	if ($wpsc_cart->selected_currency_code != 'USD') {
    		$total = str_replace('$','',$total);
    		$total = $wpsc_cart->selected_currency_code.' '.$total;
    	}
    //	exit($total);
    	return $total;
    }
    
    function wpsc_add_currency_code_to_price($productprice){
    	global $wpsc_cart;
    	if ($wpsc_cart->selected_currency_code != 'USD') {
    		$productprice = str_replace('$','',$productprice);
    		$productprice = $wpsc_cart->selected_currency_code.' '.$productprice;
    	}
    	return $productprice;
    }

    And at the end of the file (before ?>) the following line is added:
    add_filter('wpsc_price_display_changer_to_price', 'wpsc_add_currency_code_to_price');

    The wpsc_add_currency_code function updates the cart area (removes the $ sign, and appends the new currency symbol before the price if the currently chosen option is not USA).

    The wpsc_add_currency_code_to_price function updates the prices in-page (just like on the cart). Unfortunately there isn’t a way to update the product price symbol (since there’s no filter available).. so a change to the wp-ecommerce files need to be made.

    The following file needs to be changed:
    /wp-e-commerce/wpsc-includes/wpsc_query.php

    Inside the wpsc_the_product_price function I added the $output = apply_filters(‘wpsc_price_display_changer_to_price’, $output); line near the end:

    function wpsc_the_product_price($no_decimals = false) {
    	global $wpsc_query;
    	$price = calculate_product_price($wpsc_query->product['id'], $wpsc_query->first_variations);
    	if(($wpsc_query->product['special_price'] > 0) && (($wpsc_query->product['price'] - $wpsc_query->product['special_price'] ) >= 0) && ($variations_output[1] === null)) {
    		$output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'],true, $wpsc_query->product['id']);
    	} else {
    		$output = nzshpcrt_currency_display($price, $wpsc_query->product['notax'], true);
    	}
    	if($no_decimals == true) {
    		$output = array_shift(explode(".", $output));
    	}
    //	echo 'NO DECIMALS VALUE:'.$no_decimals;
    	//echo "<pre>".print_r($wpsc_query->product,true)."</pre>";
    	$output = apply_filters('wpsc_price_display_changer_to_price', $output);
    	return $output;
    }

    Thanks a ton bro,
    I have adopted your changes.
    But then the currency and amount for the shipping doesnt change πŸ™
    any help/clue about that?

    Hi mcnick,

    Not sure why the shipping currency and amount don’t change on your side.

    From what I notice both the total shipping and product price get the same convert_price function as a filter.
    add_filter(‘wpsc_convert_total_shipping’,’wpsc_convert_price’);
    add_filter(‘wpsc_do_convert_price’,’wpsc_convert_price’);

    So, basically if it works in one place (product prices), I don’t find a reason why it shouldn’t work on the shipping as well.

    Do post here if you get to debug this.

    slinkyap

    (@slinkyap)

    Hi Crantea,

    Thank you so much for your input on this issue. I have done just as been told and appears that the currency changes perfectly fine. Unfortunately, my problem doesn’t end just there as my every first product of each category shows that the currency unchanged whereas the rest did.

    I am currently using WordPress 3.1.1 with WP E-Commerce 3.7.8. It would be very much appreciated if you could take a look at the problem first hand and enlighten me on this.

    http://www.mi-lk.com/shop

    Thanks.

    Crantea

    (@crantea)

    Hi slinkyap,

    As far as I can tell, there’s nothing wrong with the multi-currency plug-in, but instead with some of the javascript you use on your website.

    With javascript disabled, the page loads just fine with the proper currency:
    http://cl.ly/5nBi

    When enabling javascript, a few seconds after the page loads the currency switches for no apparent reason back to Aud.

    Good luck with debugging it, at least you know now where to look πŸ˜‰

    slinkyap

    (@slinkyap)

    Thanks for pointing that out, Crantea.

    I’ve been looking into every possible template but can’t seem to point out any major points. Tried disabling plugins to see if there are any conflicting ones but to no avail.

    By any chance, do you think it could be caused by a different version of WP E-Commerce that I’m using as compared to yours?

    Crantea

    (@crantea)

    @slinkyap,

    Different versions of wp-ecommerce can have different javascript files, so it is possible that the wp-ecommerce version to have a cause in this.
    Try upgrading to the latest version.

    I currently have Version 3.7.8 installed, and the magic multi-currency still work.

    You can try one last trick -> try to activate the default theme (twentyten) and see if the first price still changes after page load.
    Maybe there’s a JS in the theme that’s causing this.

    slinkyap

    (@slinkyap)

    Thanks for the swift reply, Crantea.

    I tried the default theme but the problem persists. It’s just real puzzling especially since I’m using the same E-Commerce version, and also the fact that the currency changer works fine for my shopping cart but not every other product page. Frustrating, it is!

    Unfortunately, I ventured over to the Getshopped Forum and that was equally disastrous with no solution found.

    Thank you once again for all the help, and would very much appreciate it should you be able to find something possible.

    Cheers!

    slinkyap

    (@slinkyap)

    Hey Crantea,

    I FIXED IT! I’m not sure what is possibly causing the weird problem, but all I did was identifying the possible script that was causing me sleepless nights by omitting them from the WP E-Commerce/JS folder.

    The culprit happens to be the wp-e-commerce.js file itself. All I did is putting that file into a separate folder and everything seems to be working perfectly fine, still.

    Just thought of pointing it out so perhaps, someone could actually do something about it in the coming future. Funny how I’m the only one experiencing it though.

    Cheers to all!

    Crantea

    (@crantea)

    Congratulations slinkyap πŸ˜‰
    I had some problems with the wp-e-commerce.js file as well, but they were caused by me wanting to use the latest jquery version in the theme. I had to rely on using 1.4 for it to remain functional.

    slinkyap

    (@slinkyap)

    I believe that could be the main problem, as I looked through the file itself and seeming how I’ve another couple of plugins that utilize jQuery 1.5.1. Possibly some form of conflict, I don’t know?

    Phew. Thanks again for your input anyway, Crantea.

    Have a good one!

    Crantea

    (@crantea)

    Having two jquery versions on the same page is not a good thing, as random conflicts can occur (mix’n’match various jquery versions and you’ll get random new bugs), been there, done that.

    Hai Slinkyap,

    First of all, compliments for your webshop. Looks great.
    And second, can you please help me out? I’m trying to have the same currency functionality like yours.

    My problems:
    – It only shows the euro symbol, even when I added dollars or pounds.
    – I don’t want to show all the currencies, just the currencie the user have selected.

    Really appreciated.

    Thanks in advance.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: wp-e-commerce-multi-currency-magic] Currency Sign bug’ is closed to new replies.