This refers to http://drupal.org/node/1897828#comment-6982712 (Commerce Price Table makes default price visible if it has been hidden by another module) and http://drupal.org/node/1823012#comment-6903034 (ief integration):

If the default price is hidden, I can create new products for a display. But if I try to add one of these new products to the cart, I get the following error:

Notice: Undefined index: currency_code in CommerceLineItemEntityController->save() (line 69 of /srv/www/htdocs/sites/all/modules/commerce/modules/line_item/includes/commerce_line_item.controller.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'commerce_unit_price_currency_code' cannot be null: INSERT INTO {field_data_commerce_unit_price} (entity_type, entity_id, revision_id, bundle, delta, language, commerce_unit_price_amount, commerce_unit_price_currency_code, commerce_unit_price_data) 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); Array ( [:db_insert_placeholder_0] => commerce_line_item [:db_insert_placeholder_1] => 6 [:db_insert_placeholder_2] => 6 [:db_insert_placeholder_3] => product [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 800 [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => a:1:{s:10:"components";a:1:{i:0;a:3:{s:4:"name";s:10:"base_price";s:5:"price";a:3:{s:6:"amount";s:3:"800";s:13:"currency_code";s:3:"EUR";s:4:"data";a:0:{}}s:8:"included";b:1;}}} ) in field_sql_storage_field_storage_write() (line 448 of /srv/www/htdocs/modules/field/modules/field_sql_storage/field_sql_storage.module).

I'm not sure why Commerce tries to access the commerce_price, here. One way to solve this is the fix from akalata: set the default amount to 0 if the field is hidden.

I'll separate the patch and attach it to this issue. I don't think that this will have any side effects. If this bug only occurs in combination with IEF, it could be moved into commerce_price_table_ief.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Cybso’s picture

commerce_price_table-set_default_amount_to_0_if_hidden-1899052-1.patch is a patch to commerce_price_table.module that fixes the problem globally.

commerce_price_table_ief-set_default_amount_to_0_if_hidden-1899052-1.patch adds this solution only to product forms that are edited using the new commerce_price_table_ief module.

pcambra’s picture

Status: Needs review » Postponed (maintainer needs more info)

I can't reproduce this problem...

Cybso’s picture

I'm very busy at the moment getting the shop done. I'll care about this (and the other tickets I'm involved in) in a few days when I have more time to do this.

Cybso’s picture

I'm not able to reproduce this, either, at least using the Kickstart Demo Store.