News:

Support the VirtueMart project and become a member

Main Menu

State 2-letter code instead if full name

Started by autodafe, September 12, 2016, 16:57:05 PM

Previous topic - Next topic

autodafe

VM 3.0.14
Joomla 2.5
PHP 5.4

In my shopping cart I would like to have the "state" field displayed only as a 2-letter instead of the full name

I have tried inserting a new userfield named state_2_code (which sould be the name of the field) but no luck ...
is there some simple config to show 2 letter state ???

jenkinhill

You could edit the State Names to just the 2 letters if you wish. But I suspect it would need redoing after each VM update.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

autodafe

#2
well, i was hoping for a simpler option...


so far I managed thru code, I had to hack a little the "default_address.php" file under the cart view:

       <?php if ($item['name'] == 'virtuemart_state_id') {?>
<span class="values<?php echo '-' $item['name'?>"><?php echo "(".$item['state_2_code'].")";?></span>
<?php 
}
 else 

?>


<span class="values<?php echo '-' $item['name'?>"><?php echo $item['value'];?></span>
<?php
}
?>


                                                         

see pic:

Milbo

There is a function to get the state 2 code. Somewhere in shopfunctions
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/