X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   trying to fix the address layout on the gmap.tpl file (https://forum.x-cart.com/showthread.php?t=72316)

keystone 06-18-2015 11:26 AM

trying to fix the address layout on the gmap.tpl file
 
When I click on a customers location in the admin/orders/ it opens up a map with the customer name and address in the top left corner. I would like to fix the way the address is laid out. The template that lays out the address is /common_files/gmap.tpl

Code:

{capture name="gmap"}
<strong>{$description.name}</strong><br />
({if $description.type eq "shipping"}
{$lng.lbl_shipping_address}
{else}
{$lng.lbl_billing_address}
{/if})<br />
{$description.address}<br />
{$lng.lbl_phone}: {$description.phone}
{/capture}
<a href="javascript:void(0);" onclick="javascript:GMap.showModal('{$address|escape:htmlcompat|escape:javascript}','{$smarty.capture.gmap|escape:htmlcompat|escape:javascript}');" class="gmarker{if $show_on_map eq "1"} gmarker-show-on{/if}">{if $show_on_map eq "1"}{$lng.lbl_gmap_show}{/if}</a>


the line in question is the
Code:

{$description.address}

How do I adjust the way that variable is laid out? Meaning I want to have
Street
City, State, Zip

instead of
Street
Zip
City
State

Any help would be appreciated. Thanks.

cflsystems 06-18-2015 11:44 AM

Re: trying to fix the address layout on the gmap.tpl file
 
You will have to go to the php or js file that writes "address" to $description array and correct it there. Another way would be to use smarty modifier to modify {$description.address} and re-write it any way you want

keystone 06-18-2015 11:57 AM

Re: trying to fix the address layout on the gmap.tpl file
 
I've google smarty modifier and kind of understand but could you give an example of some code that would move parts of the variable around? I'm not asking for the full answer cause I'd like to learn. How do I "see" the different parts of the variable?

cflsystems 06-18-2015 03:40 PM

Re: trying to fix the address layout on the gmap.tpl file
 
$description is an array. you can list its key/value pairs with var_dump or print_r php functions.

If you are sure "address" holds the value you want to modify and it is like you said most likely there is "<br/>" for each new line in it. You can also use smarty replace on the variable to replace the new line with comma.

Coding modifier you can use "explode" to split the $description['address'] and then joing them together in new variable(s) as you need

keystone 06-19-2015 09:43 AM

Re: trying to fix the address layout on the gmap.tpl file
 
thanks for the tips Steve.


All times are GMT -8. The time now is 04:10 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.