Dont pad GTIN numbers help

Open to all! Ask other shopowners for help.
Post Reply
lambro28
Member
Posts: 62
Joined: Sun Jan 03, 2021 2:47 pm
Phoenix Version: v1.1.0.6
Has thanked: 11 times
Been thanked: 8 times

Dont pad GTIN numbers help

Post 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),


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Dont pad GTIN numbers help

Post 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']);
}
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Dont pad GTIN numbers help

Post 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).
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply