Jump to content

How to make delivery addresses all CAPS

Recommended Posts

Is there any way I can get the full delivery addresses to be in CAPITALS, that is: name, surname, address line 1, line 2, town, county/state not bothered about billing address but when I come to export for the shipping some customers use all lower case, some all caps and some a mix. Would help too for my international shipments as the printed address on the labels (set size by Royal Mail) isn't that big.

I know I can amend the counties and zones in dashboard but going to take me forever.

Thanks in advance

Link to comment
Share on other sites

we copy it from the delivery address that is shown on the order summary page, at the moment it shows as below, but we then spend ages correcting it all, got 80 international orders to do tonight and just so not looking forward to editing all the names and addresses

As an example:

Billng Address                                                   Delivery Address

jackie brown                                                      jackie brown
1a the Avenue                                                   1a the Avenue
MYCITY                                                             MYCITY
YORKSHIRE, XX20 2KK                                    YORKSHIRE, XX20 2KK
UNITED KINGDOM                                            UNITED KINGDOM




Link to comment
Share on other sites

A quick edit to this admin skin template file should work -- until CubeCart gets updated.

In the admin skin template file orders.index.php, find:

               {if !empty($OVERVIEW_SUMMARY.company_name_d)}{$OVERVIEW_SUMMARY.company_name_d}<br>{/if}
               <span class="capitalize">{$OVERVIEW_SUMMARY.line1_d}<br>
               {if !empty($OVERVIEW_SUMMARY.line2_d)}{$OVERVIEW_SUMMARY.line2_d}<br>{/if}</span>

Change to:

               <span class="uppercase">{$OVERVIEW_SUMMARY.name_d}</span><br>
               {if !empty($OVERVIEW_SUMMARY.company_name_d)}<span class="uppercase">{$OVERVIEW_SUMMARY.company_name_d}</span><br>{/if}
               <span class="uppercase">{$OVERVIEW_SUMMARY.line1_d}<br>
               {if !empty($OVERVIEW_SUMMARY.line2_d)}{$OVERVIEW_SUMMARY.line2_d}<br>{/if}</span>

Soon, I will write a code snippet that will do this in a manner that will survive an upgrade.

Link to comment
Share on other sites

Here is the code snippet:

In admin, Manage Hooks, Code Snippets tab, click the Add Snippet link. A form will appear at the bottom of the list of snippets. Fill it out as follows:

Enabled: checked
Unique ID: upperdeladdr@cc640+
Execution Order: 99
Description: Uppercases the Delivery Address sent to Smarty
Trigger: admin.order.index.display
Version: 1.0
Author:  forums.cubecart.com/topic/59118-how-to-make-delivery-addresses-all-caps/

Note that at the first line in the PHP Code, I use the names of the first two characters to type. Type the actual characters, no spaces, for that line. (These forums have a security feature that often blocks submissions that look like executable code.)

less-than question-mark php
$uda_array = array('title_d','name_d','first_name_d','last_name_d','company_name_d','line1_d','line2_d','town_d','state_d','country_d');
$uda_overview_summary = $GLOBALS['smarty']->getTemplateVars('OVERVIEW_SUMMARY');
foreach($uda_array as $uda_field) $uda_overview_summary[$uda_field] = strtoupper($uda_overview_summary[$uda_field]);
$GLOBALS['smarty']->assign('OVERVIEW_SUMMARY', $uda_overview_summary);


Link to comment
Share on other sites

Thanks Brian, it didn't quite work on mine, got some in caps and bold but so glad you showed me where to look to change it, I'd have been looking through my standard skin templates not the admin one.

I found some of the existing lines of code already had this  |upper  which already made some of the address uppercase, so I've just copied that onto the parts that weren't, now all are upper.

{$OVERVIEW_SUMMARY.name_d} changed to {$OVERVIEW_SUMMARY.name_d|upper}, same for  {$OVERVIEW_SUMMARY.line1_d }  changed to  {$OVERVIEW_SUMMARY.line1_d|upper}


This is going to save me soooooooooo much time

thank you

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...