Invoice Displays Incorrect State Abbreviation

By | January 22, 2013

As stated in the bug report, state abbreviation displays the first two letters of the State and not the abbreviation assigned within the customer acknowledgment email. For example, Texas is listed as TE and not TX.  The first to letters are used, instead..

To fix this bug, locate the PDF.php file located here: classes/PDF.php

Line 436: add a blank line after {

Line 461: remove the following code:

$state = &$addressType[$type][‘addressFormatedValues’][$pattern];
$state = strtoupper(substr($state, 0, 2));

.. and replace with the following code:

$state_name = &$addressType[$type][‘addressFormatedValues’][$pattern];
$state = new State((int)State::getIdByName($state_name));
if (Validate::isLoadedObject($state))
$state_name = $state->iso_code;
else
$state_name = strtoupper(substr($state_name, 0, 2));

You can view the Bug Fix Here on the SCM.PrestaShop.com


Resources

Bug Tracker, US states abbreviations on invoices are incorrect: http://forge.prestashop.com/browse/PSCFI-317 -US7
PDF Bug Fixed: #PSCFI-3254 – US States Abbreviations are incorrect: http://scm.prestashop.com/changelog/PrestaShop_v.1.4?cs=80d707722a8603aa42068a433d9eeffa0d2a5f45