Neděle, 13 Listopad 2016 00:00
Aktualizováno Pátek, 02 Prosinec 2016 12:14
Napsal uživatel Admin22
Umožní nepovinné pole ICO (DNI) prestashop 1.5 a 1.6
- na stránce adresy, v bloku fakturační adresa (na stránce adresy, zadávání adresy)
- pokud se zadá tiskne se ICO na faktuře
Nastavení
- v administrace>Lokalizace>Země:Cecha republic>Je vyžadováno IČO ? - Ano
Úpravy v php
měněné soubory, soubory:
- /controllers/front/AddressController.php
// //commented by tcl source <a href="https://www.prestashop.com/forums/topic/115794-how-to-disable-dni-validation/?p=2225329">https://www.prestashop.com/forums/topic/115794-how-to-disable-dni-validation/?p=2225329</a>
// // Check country DNI
// if ($country->isNeedDni() && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
// $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
// else if (!$country->isNeedDni())
// $address->dni = null;
- /controllers/front/AuthController.php
// //commented by tcl source <a href="https://www.prestashop.com/forums/topic/115794-how-to-disable-dni-validation/?p=2225329">https://www.prestashop.com/forums/topic/115794-how-to-disable-dni-validation/?p=2225329</a>
// if ($country->need_identification_number && (!Tools::getValue('dni') || !Validate::isDniLite(Tools::getValue('dni'))))
// $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.');
// elseif (!$country->need_identification_number)
// $$addresses_type->dni = null;
- /themes/default-bootstrap/address.tpl
odstraneni hvezdicky, odstranit <sup>*</sup> z tohoto
{if !$dniExist}
<div class="required dni form-group unvisible">
<label for="dni">{l s='Identification number'} <sup>*</sup></label>
<input class="is_required form-control" data-validate="{$address_validation.dni.validate}" type="text" name="dni" id="dni" value="{if isset($smarty.post.dni)}{$smarty.post.dni}{else}{if isset($address->dni)}{$address->dni|escape:'html':'UTF-8'}{/if}{/if}" />
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
</div>
{/if}
poznámka:
(řešení z http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/
/classes/Country.php
/classes/Adress.php
/classes/Validate.php,
které upravovalo komentování
// // /classes/Country.php
//tcl <a href="http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/">http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/</a>
public $need_identification_number;
// // /classes/Validate.php
//tcl <a href="http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/">http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/</a>
// 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16),
// // /classes/Validate.php
//tcl <a href="http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/">http://www.prestashop-profi.eu/nepovinne-pole-ico-v-registraci-a-objednavce-prestashop-1-5-6-x/</a>
// public static function isDniLite($dni)
// {
// return empty($dni) || (bool)preg_match('/^[0-9A-Za-z-.]{1,16}$/U', $dni);
// }
soubory fungovalo jen chvíli - nechápu proč, možná nějaká souvislost se smarty, cache)