VirtueMart Forum

VirtueMart 2 + 3 => Administration & Configuration => Topic started by: orbeyiosx on September 12, 2018, 17:02:14 pm

Title: How To Set Different Currency Per Product Groups
Post by: orbeyiosx on September 12, 2018, 17:02:14 pm
Hi,

What i want to achieve is, i want to use a different currency for a product group.
I tried to create multivendor but i cannot managed to change default Currency of new vendor.

We created store as one vendor with one currency (TRY)
But some products needs to displayed as USD

So in order to do that i tried to convert store to multi vendor,
I have managed to set second vendor but whenever i change the main vendor (Store Owner) currency other vendor default currencies changes.

Would you please tell me how can i achieve this.
Here is the details of my installation;
VirtueMart 3.2.12
PHP Version   7.2.9
Web Server   Apache
WebServer to PHP Interface   fpm-fcgi
Joomla! Version   Joomla! 3.8.12 Stable [ Amani ] 28-August-2018 14:00 GMT
Title: Re: How To Set Different Currency Per Product Groups
Post by: orbeyiosx on September 13, 2018, 08:35:21 am
Basically my question; Is it possible to use two different currencies on a website?
Title: Re: How To Set Different Currency Per Product Groups
Post by: GJC Web Design on September 13, 2018, 09:51:08 am
There is a hidden setting  - price per currency

https://docs.virtuemart.net/manual/general-concepts/206-hidden-configurations.html

pricesbyCurrency

this then allows u to set a price in different currencies per product

you then need to figure out some way to only display the one you want
Title: Re: How To Set Different Currency Per Product Groups
Post by: orbeyiosx on September 13, 2018, 17:00:30 pm
Hi Dear GJC Web Design,

You have shared a perfect piece of information, thanks a lot for that.

I have just edited config file. I uncommented pricesbyCurrency and saved configuration and changed the price currency to euro for a product.
But when i go to check the product product it still displays as TL

I reverted back to single vendor option again. But nothing changed. Am i doing something missing?



There is a hidden setting  - price per currency

https://docs.virtuemart.net/manual/general-concepts/206-hidden-configurations.html

pricesbyCurrency

this then allows u to set a price in different currencies per product

you then need to figure out some way to only display the one you want
Title: Re: How To Set Different Currency Per Product Groups
Post by: GJC Web Design on September 13, 2018, 17:29:32 pm
It only displays in € if the selected currency is € ( e.g. if u had the VM currency selector published and u chose €)

As I said -- u will need to figure out HOW to display the products with e.g. ONLY a € price in euros

from memory it is only a url param .. I think &virtuemart_currency_id=[currency_id]

so u need prob. to append that to the cat and product urls that need to display in € or at least play with the UserStates maybe

e.g.

$app->setUserState('virtuemart_currency_id', $c_int);
      $app->setUserState('com_virtuemart.virtuemart_currency_id', $c_int);

There could of course be a simpler way...  maybe somebody knows
Title: Re: How To Set Different Currency Per Product Groups
Post by: orbeyiosx on September 15, 2018, 01:26:42 am


e.g.

$app->setUserState('virtuemart_currency_id', $c_int);
      $app->setUserState('com_virtuemart.virtuemart_currency_id', $c_int);

There could of course be a simpler way...  maybe somebody knows

It makes sense i will try but the which file i should edit?

Title: Re: How To Set Different Currency Per Product Groups
Post by: GJC Web Design on September 15, 2018, 11:23:20 am
You have to suck and see.. this is raw dev...  probably enough in the template files but personally I would dev a system plugin

if vmcatid  in_array(xx,xxx,xxx) then change currency to y

What your wanting to do is not simple

u need ( prob) to change the UserState, the request var and maybe a JS var
publish the vm currency module to get an idea of how it works