News:

Support the VirtueMart project and become a member

Main Menu

Assign default currency by page ID

Started by BKintera, November 07, 2016, 20:42:18 PM

Previous topic - Next topic

BKintera

Hi,

Since I ddin't find solution for my prevous topic: https://forum.virtuemart.net/index.php?topic=135770.0

I came up with another idea for the same problem.

When user enter the website, he/she need to select country (currency) EU of CHF, when user select the country(currency), than link looks like this:

https://website.com/en/eu
or
https://website.com/en/chf


I made two products categories (Category EU and Category CHF), and assigned them "diffrent" products. It's the same products, only prices are diffrent.
So, if user select EU, link to the product would be:

https://website.com/en/eu/products-eu/product1-eu with price for example of 100 EUR

If user select  CHF, link to the product would be:
https://website.com/en/chf/products-chf/product1-chf with price for example of 200 CHF


Now, the problem is that EUR is default currency, and even when user choose Switzerland at the begaining, he/she will see prices in Euro, and that is unacceptable.

Can I assign default currency by page ID or something like that?

Please somebody help me on this, my prevous post didn't get any response.

If I didn't explain my problem very well I will be more detailed, but please give me some hint.


Best regards,
Milan

Virtuemart 3.0.16
Joomla 3.6.0
   

Milbo

I wonder if you know that any product can have more than one price, and that would be the way to go. the last problem is to change the currency, which is just the "virtuemart_currency_id=xyz" in the link. I wrote a small plugin for a similar problem. The vmlocalizer puts your shoppers into the right country. I extended this also for a customer so that it works also with currencies. But I did not write any config option for this yet. I think you should buy this plugin http://extensions.virtuemart.net/shopper-order/vm-localise-detail

The plugin has 3 outcommented lines, you just need to enable them and adjust the country codes. It already has the european countries, so setting euro is almost done.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

BKintera

#2
Hi Milbo,


Thank you for your reply.

I know that any product can have more than one price.

I will explain what I did till now and at the end of the post I will ask you one question about your extension.

I did the following:

- Create 2 shopper groups: Swiss shoppers, Non-Swiss shoppers
- Add product with 2 prices: Swiss Shoppers 219 CHF, Non-Swiss shoppers 179 EUR
- Installed 3rd party plugin which automaticlly assign user to shopper group based on selection of one shopper field
- Added shopper field called "Country" and in 3rd party plugin made rule:
If in shopper field called "Counrty" value "Switzerland" is selected asign shopper to "Swiss shopper" group.
(3rd party plugin cannot work with default Virtuemart county shopper field, so it's a must to create custom shopper field and disable Virtuemart default contry filed)

And now, when user go to "Add/Edit billing address information" and select "Switzerland" as his country after clicking "Save" he is going back to cart and than see prices for Swiss Shoppers group, but instead of 219 CHF, user will see 202,98 € (which is price for Swiss shoppers group converted in €) because € is default currency.

User have posibility to change currency from € to CHF, but if thay don't do that, invoce will be in € and that is unacceptable, because it's against the law.

So, can I automatically asign CHF when shopper group is set to Swiss Shopper?

If yes, than there is no need to show Virtuemart currency module on frontend. Prices would be shown in CHF if shopper group is Swiss Shoppers and if is other shopper group selected prices would be in €.

Edit:

Basicly I need code which look something like this:

if ($virtuemart_shoppergroup_id == 3)
{$virtuemart_currency_id = 27}
else {$virtuemart_currency_id = 47}


where Swiss Shoppers id is 3, CHF id is 27, and Euro id is 47.
But I don't now where to put this code or what is missing.

Thanks in advance.

Best regards,
Milan