Page 1 of 1

Dont pad GTIN numbers help

Posted: Sat Jun 19, 2021 9:02 pm
by lambro28
Hi @ecartz
You helped me before to stop padding the GTIN numbers, but with an update to V1.08.0 this has changed.
Could you possibly tell me how to stop the padding again please.?

'products_gtin' => (Text::is_empty($_POST['products_gtin'])) ? 'NULL' : str_pad(Text::prepare($_POST['products_gtin']), 14, '0', STR_PAD_LEFT),

Re: Dont pad GTIN numbers help

Posted: Sun Jun 20, 2021 12:06 am
by ecartz
It should be essentially the same change. Perhaps

Code: Select all

'products_gtin' => (Text::is_empty($_POST['products_gtin'])) ? 'NULL' : Text::input($_POST['products_gtin']),
Or delete that line entirely and add a new section that says

Code: Select all

if (!Text::is_empty($_POST['products_gtin'])) {
  $sql_data['products_gtin'] = Text::input($_POST['products_gtin']);
}

Re: Dont pad GTIN numbers help

Posted: Mon Jun 28, 2021 9:44 am
by burt
GTIN numbers *must* be stored padded to 14 characters.

In the old Phoenix forum (at the oscommerce site) there was a long thread about this. I don't want to log in there to link to it (and it might not even exist now)...have a search ? From memory the user "whitehat" wanted to store them not padded, and I advised (with links etc) the rules state they must be stored padded etc.

If you want to change the code to have them stored as exactly whatever you put in the field..that's fine to do, but then that's on you and not on the core code (if that makes sense).