David Y.F. Posted November 10, 2013 Share Posted November 10, 2013 Versions: 1.5.4, maybe 1.5.5, 1.5.6 This is not the tipical problem in which Prestashop doesn't show states/provinces. This FIX when you are filling the "order process checkout" in one step (opc), save your data, with state or province filled, and continue shopping. Then when you return, the state / province had gone. 1. Override OrderOpcController.php ---------------------------------------- 1.1 Copy your /controller/front/OrderOpcController.php to /override/front/controller.php 1.2 Change the main class to class OrderOpcController extends OrderOpcControllerCore (the original one was OrderOpcControllerCore extending his parent). In the override file, under this... if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); else $countries = Country::getCountries($this->context->language->id, true); Put this! /** * BUG FIXED. Didn't preserve state/province. * 10 Nov 2013 * See <yourtheme>/order-opc-new-accout.tpl */ $customer = $this->context->customer; $address_delivery = new Address($this->context->cart->id_address_delivery); $id_state = (int)($address_delivery->id_state); if (isset($address_delivery->id_country) ){ $this->context->smarty->assign('id_state', $id_state); } /* END FIX */ in your theme, in the <script tag, at the begining, under... $(document).ready(function() { $('#company').on('input',function(){ vat_number(); }); $('#company_invoice').on('input',function(){ vat_number_invoice(); }); vat_number(); vat_number_invoice(); }); {/literal} put this <!-- BUG FIXED. Didn't preserve state/province. --> <!-- 10 Nov 2013 --> <!-- See <yourtheme>/order-opc-new-accout.tpl --> $(function(){ldelim} $('.id_state option[value={$id_state}]').attr('selected', true); {rdelim}); ¡Check to put under the {literal} string. If you put over it, the BUG won't be fixed. Hope this help! I have spending a lot of time checking this, and asking me why in the opc states/provinces weren't preserved. Link to comment Share on other sites More sharing options...
Recommended Posts