Hi

Thanks for the modules.

Im trying to update the product values through code but keep getting the following error.

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'entities' for column 'delta' at row 2: INSERT INTO {field_data_field_product} (entity_type, entity_id, revision_id, bundle, delta, language, field_product_product_id)

The actual code I am trying is similar to below

$node->field_product['und']['entities'][0]['form']['commerce_price']['und'][0]['amount'] = $amount;

This is how the structure appears for the product reference fields when creating a product display.

Please could you advise the correct way to alter values through code.

Thank you

Comments

lsolesen’s picture

Project: Commerce Kickstart » Commerce Core
Version: 7.x-2.9 » 7.x-1.x-dev
Component: Code » Product
Issue summary: View changes
rszrama’s picture

Status: Active » Closed (won't fix)

Sorry, we don't offer developer support like this in the Commerce queue. Please search the Drupal stack exchange or something for examples of manipulating reference field values with the entity metadata wrapper.