For some products it is preferable to hide everything about shipping. When I disable the shipping field on the form display (remove it from the create/edit node form), I run into a EntityStorageException when saving a new node.

Steps to reproduce:

  1. Create a product node type
  2. Hide the shippable field
  3. Create a new node

I get this message:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'shippable' at row 1: INSERT INTO {uc_products} (vid, nid, model, cost, price, weight, weight_units, length, width, height, length_units, pkg_qty, default_qty, shippable) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => 4864 [:db_insert_placeholder_1] => 4867 [:db_insert_placeholder_2] => KK [:db_insert_placeholder_3] => 0.00 [:db_insert_placeholder_4] => 0.00 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => lb [:db_insert_placeholder_7] => 0 [:db_insert_placeholder_8] => 0 [:db_insert_placeholder_9] => 0 [:db_insert_placeholder_10] => in [:db_insert_placeholder_11] => 1 [:db_insert_placeholder_12] => 1 [:db_insert_placeholder_13] => ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 756 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Apparently, my MySQL database cannot translate the empty value for the shippable column into 'false'.

It is pretty easy to solve by just typecasting the value to integer. See patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bjaxelsen created an issue. See original summary.

bjaxelsen’s picture

longwave’s picture

Status: Active » Needs review

  • longwave committed b6c864b on 8.x-4.x authored by bjaxelsen
    Issue #2720069 by bjaxelsen: Hidden shippable field causes...
longwave’s picture

Status: Needs review » Fixed

Committed, thanks for the patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.