Child pages
  • [in-commerce] Incorrect order number formatting (lpad) [5.2.1]
Skip to end of metadata
Go to start of metadata

The typical order number looks like this: 000123-005. Internally it's being stored in 2 database columns.

Database ColumnExample ValuePadding SettingPadded Example Value
Number1236 symbols000123
SubNumber53 symbols005

Both number are left padded with 0 to have similar width. Unfortunately the MySQL's LPAD function, used to do that has documented side effect: if a padded number is longer, then padded length, then number is being cut off. This way 123 turns out into 12 (3 is cut off), when somebody sets padding from 6 to 2 symbols.

Related Tasks