Does anyone know how to set by chosen language the default/preselected country in the cart?
For example
en-GB = United Kingdom
en-US = United States etc
(A Jenks copy/paste)
Did you miss the vital security release?
https://www.joomla.org/announcements/release-news/5693-joomla-3-6-5-released.html
http://forum.virtuemart.net/index.php?topic=118683.0
you have a language choice for USA and GB?
Hello GJC Web Design,
No, I hadn't updated my profile on the forum since the last time I posted. So sorry about that (I find it incredible that he finds that incredible).
Yes.
Am currently using this : http://extensions.virtuemart.net/vm-orders/vm-localise-detail which does a pretty good job but would rather have the selected site language or currency determine the default/preselected country in my case (If it's not too much of a drama).
Anyways, that's for taking the time to respond... You're about the only one who ever does :)
M
why this is not included in virtuemart core? :(
MKI
I see another of your recent posts also mentions things being in the core.
Not everything is, or will be included, in the core. That is why third party plugins exist.
When someone mentions a third party plugin then assume that your problem might be solveable, and you might have to assign some funds to your project to get things to work exactly how you want them.
i am trying to do it on my own but country dropdown is not simple <select>
any idea how to code ?
I have found that it uses chosen jquery plugin so solution is:
<?php
$lang = JFactory::getLanguage();
$langTag = $lang->getTag();
?>
<script>
jQuery(document).ready(function(){
<?php if ($langTag == "sk-SK") { ?>
jQuery('#virtuemart_country_id_field').val(189);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } elseif($langTag == "en-GB") { ?>
jQuery('#virtuemart_country_id_field').val(222);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } elseif($langTag == "hu-HU") { ?>
jQuery('#virtuemart_country_id_field').val(97);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } elseif($langTag == "de-DE") { ?>
jQuery('#virtuemart_country_id_field').val(81);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } elseif($langTag == "de-AT") { ?>
jQuery('#virtuemart_country_id_field').val(14);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } elseif($langTag == "ro-RO") { ?>
jQuery('#virtuemart_country_id_field').val(175);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } elseif($langTag == "pl-PL") { ?>
jQuery('#virtuemart_country_id_field').val(170);
jQuery('#virtuemart_country_id_field').trigger("chosen:updated");
<?php } ?>
});
</script>
our code is not fine.
You should check if jQuery('#virtuemart_country_id_field').val() is empty or only call it if address (or check with js a required field) is empty on load.
And to simply your code or add other countries.
<?php
$lang = JFactory::getLanguage();
$langTag = $lang->getTag();
$langId = null;
if ($langTag == "sk-SK") $langId = 189;
elseif($langTag == "en-GB") $langId = 222;
elseif($langTag == "hu-HU") $langId = 97;
// add all $langTag ...
if($langId !==null) { ?>
<script>
jQuery(document).ready(function(){
jQuery('#virtuemart_country_id_field').val(<?php echo $langId ?>).trigger("chosen:updated");
});
</script>
<?php