VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: Angel Julian Mena on April 04, 2013, 08:57:46 AM

Title: cart variation price in original currency
Post by: Angel Julian Mena on April 04, 2013, 08:57:46 AM
Hi,

The problem I have is that I have set euro as default currency, my supplier is british so I put the base price of the product in british pounds so I don´t have to modify the price each time there is an important price difference in the product. The problem is that if I add custom fields to modify the product price, the introduced price is not in the currency that I introduced but in euros.

What can I do to keep the custom fields currency in pounds once I'e entered the base price of a product in pounds, I don´t want it in the default currency (euro).

Many thanks
Angel
Title: Re: cart variation price in original currency
Post by: Milbo on April 10, 2013, 17:36:17 PM
ohh, hmm intersting.

This is just a missing feature (or bug), the prices of the customfields are at the moment always the shop currency. You are right, when you buy in pounds, then you want to set the variants also in pounds. Please try this, if it works we can add it to the next version.

/administrator/components/com_virtuemart/helpers/calculationh.php around line 1300, search for the function calculateCustomPriceWithTax


function calculateCustomPriceWithTax($price, $override_id=0) {

$price = $this->roundInternal($this->_currencyDisplay->convertCurrencyTo((int) $this->productCurrency, $price,true));

if(VmConfig::get('cVarswT',1)){
...
..
.
Title: Re: cart variation price in original currency
Post by: Angel Julian Mena on April 10, 2013, 20:22:35 PM
Hi,

Thanks so much for your prompt response.

I have tried what you suggested but it did not work :(

Do you think you can give me further help?

Thanks!
Title: Re: cart variation price in original currency
Post by: Milbo on April 10, 2013, 20:58:20 PM
try false instead true
$price = $this->roundInternal($this->_currencyDisplay->convertCurrencyTo((int) $this->productCurrency, $price,false));
Title: Re: cart variation price in original currency
Post by: Angel Julian Mena on April 10, 2013, 21:50:10 PM
Sorry to tell you that this did not work either...

Any ideas  :-[
Title: Re: cart variation price in original currency
Post by: tez on April 15, 2013, 08:38:23 AM
I have the same problem.
calculateCustomPriceWithTax() is not being used.
Title: Re: cart variation price in original currency
Post by: Angel Julian Mena on June 06, 2013, 21:29:06 PM
I don' t know if someone can give me some help. After doing some research I think the solution is that when the custom fields values are taken for show the price, it is necessary to figure out the currency used for the price cost and once we know that,  the second step is to convert the price in that currency into the currency of the current shop.

This seems to be easy but I have no idea how to do it, I suppose it is about modifying something from the model/customfields.php and/or helper/currencydisplay.php

Thanks so much for you help in advance
Title: Re: cart variation price in original currency
Post by: AH on June 07, 2013, 09:25:21 AM
http://forum.virtuemart.net/index.php?topic=97602.0
Title: Re: cart variation price in original currency
Post by: Angel Julian Mena on June 07, 2013, 12:27:49 PM
The virtuemart version is 2.0.20b

Hi Milbo,

I've tried the following

$currency="USD";
$price = $this->roundInternal($this->_currencyDisplay->convertCurrencyTo($currency, $price,true));

and it worked properly.

What is not the currency is how to take the product.

$this->productCurrency

Apparently this does not work.

Can you help please?

Thanks
Title: Re: cart variation price in original currency
Post by: Milbo on June 07, 2013, 15:08:38 PM
Thx Hutson,

but in this case it was okey, I knew which version. Thanks. I almost overlooked this. 3 lines and it works now :-)
Check for vm2.0.21D then.
Title: Re: cart variation price in original currency
Post by: Angel Julian Mena on June 10, 2013, 08:22:51 AM
Thanks for your help.

One last thing, to run the line of code that you told me, you have to work with in the currency_code_3 currency_id not. This I can solucironar, the problem is that $ this-> productCurrency not return a value, as I can fix this?

Title: Re: cart variation price in original currency
Post by: Angel Julian Mena on June 10, 2013, 22:27:14 PM
hi Milbo,

I have seen the version that is in the svn (2.0.21.d). I think I got it right.
The line of code does not work because $ this-> productCurrency not have any value, in addition to work the value should be the currency_code_3. Can you help with this?