:::: MENU ::::
Posts tagged with: prestashop 1.7

PrestaShop change SIRET Length

Today we talk about PrestaShop change SIRET length. There is not only one way to change the SIRET length from PHP file you have to change the length. You need to modify the default PrestaShop table ps_customer.

First, you have to change the length in PHP file. The class path is following. and Search for function isSiret.

classes/Validate.php

public static function isSiret($siret)
{
 

if (Tools::strlen($siret) != 16)
return false;
$sum = 0;
for ($i = 0; $i != 16; $i++)
{
$tmp = ((($i + 1) % 2) + 1) * intval($siret[$i]);
if ($tmp >= 10)
$tmp -= 9;
$sum += $tmp;
}
return ($sum % 10 === 0);

}

Run following SQL query and change the length accordingly. I am setting the length to 16.

        ALTER TABLE  `ps_customer` CHANGE  `siret`  `siret` VARCHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL

That’s it from this article. I strongly believe there is always room for improvement. So I am open to any suggestion and feedback. Please feel free to leave what you are thinking in the comments section below. Cheers.

Author: Qaisar Satti
Category: Prestashop
Last Modified: September 27, 2019