News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

cart variation price in original currency

Started by Angel Julian Mena, April 04, 2013, 08:57:46 AM

Previous topic - Next topic

Angel Julian Mena

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

Milbo

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)){
...
..
.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Angel Julian Mena

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!

Milbo

try false instead true
$price = $this->roundInternal($this->_currencyDisplay->convertCurrencyTo((int) $this->productCurrency, $price,false));
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Angel Julian Mena

Sorry to tell you that this did not work either...

Any ideas  :-[

tez

I have the same problem.
calculateCustomPriceWithTax() is not being used.

Angel Julian Mena

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

AH

Regards
A

Joomla 4.4.5
php 8.1

Angel Julian Mena

#8
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

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Angel Julian Mena

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?


Angel Julian Mena

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?