News:

Support the VirtueMart project and become a member

Main Menu

Cart variant cost not coverted when change currency

Started by shutterlize, March 24, 2013, 04:49:23 AM

Previous topic - Next topic

shutterlize

I just upgraded VM2 to the latest version and I have changed my default currency to Malaysian Ringgit. Previously it was USD. I have hundreds of products where each product has it own cost of cart variances. The problem now is that the currency for cart variant is not converted to Malaysian Ringgit where 3USD should be somewhere around 9.6MYR not 3MYR. It's not converted.

Do I need to convert them manually one-by-one or there is an option to do so? If need to convert one by one than VM2 will make my life miserable, there are hundreds of product to convert manually

Frustrated.

Nevermind the awkward!

Milbo

you have a product currency, a shop currency a rule currency and a customer currency.

so what do you have now?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

shutterlize

Maybe I don't understand ur question,

I added custom field for cart variant that will add cost to specific products. Previously, the shop currency is in USD and same goes to the cart variant that I've added. at the front-end, if I change the default currency to other currency,the cart variant cost is not converted. Is there any options that I might be overlooked to make the custom field value converted if the default currency is change to other currency?
Nevermind the awkward!

Angel Julian Mena


tez

Quote from: Milbo on March 24, 2013, 12:19:00 PM
you have a product currency, a shop currency a rule currency and a customer currency.

so what do you have now?
Does that mean I can only display one currency on the front end when a customer is not logged in?

I have vendor currency as AUD
USD, JAP, AUD currency on my product variant.
My currencies are enabled and set to exhange rate 1 - I do not want remote loaded rates.

My shop only every shows AUD price, I have tried a lot of combinations on my test server and nothing seems to work.

The symbol does change, but the price is locked on the AUD price of the parent product. The parent product has USD price as well, so that should work but it doesn't.
If I remove prices from the parent product it deletes the variant prices. (irrelevant, but it is a bug).
When the parent product has no prices, the variant subproduct multiple prices still does not work.

tez

I also tried it in a default install and it wont work there either - using exhange rate 1.0 for AUD and USD.
Price always shows the shop currency price, or if there is only one price it shows that.

But currency can't be changed by shopper.

tez

I've also tested in default Joomla 2.5.6 with Virtuemart 2.0.20b
Currency symbol changes but price does not change.
Not using live exhange prices, no cURL installed.

The only part that works in the exhange rate modifying the prices. I do not want that, I want to use the Product Pricing for specific prices per product per country.
This part is what I mean - http://prntscr.com/10i11q
This should show price $99 for USD - http://prntscr.com/10i15y
This is my config for currencies - http://prntscr.com/10i19r

tez

This is hard to fix because all the price functions do not have access to the product ID. So there isn't an easy way to look up the correct price from inside the currency conversion code.
Why are the extra prices even in the admin GUI if there is no way to use them?

tez

Progress. I have made changes so that this works, but it will be incompatible with Exchange rates.
Your currencies need exchange rate 1.0 so they do not get modified.
In administrator/components/com_virtuemart/helpers/calculationh.php
Add this code around line 330, just before $this->productPrices['taxAmount'] = $this->roundInternal($salesPrice - $priceBeforeTax);
$this->_db->setQuery('SELECT `product_price` FROM #__virtuemart_product_prices WHERE `virtuemart_product_id`="' . $product->virtuemart_product_id . '" AND `product_currency`="'.$this->_currencyDisplay->getId().'" ');
$newprice = $this->_db->loadResult();
if($newprice>0)$salesPrice = $newprice;


Your prices should be working now, but your templates might need to change if they are old. Use $this->currency->priceDisplay ($this->product->prices[salesPrice])

Obviously you need to add new prices to your product, do that and press Apply, THEN select a country because the country selector is stuck until you press apply. Most expensive is sorted to the top, so be careful that you assign the country to the right price.

You might want to edit the currency symbols, for example I had to use...
United States dollars to USD$
and Australian dollars to to AUD$