VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: autodafe on September 12, 2016, 16:57:05 PM

Title: State 2-letter code instead if full name
Post by: autodafe on September 12, 2016, 16:57:05 PM
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 ???
Title: Re: State 2-letter code instead if full name
Post by: jenkinhill on September 12, 2016, 17:22:41 PM
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.
Title: Re: State 2-letter code instead if full name
Post by: autodafe on September 12, 2016, 17:29:20 PM
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:
Title: Re: State 2-letter code instead if full name
Post by: Milbo on September 12, 2016, 19:28:51 PM
There is a function to get the state 2 code. Somewhere in shopfunctions