Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
lsolesen CreditAttribution: lsolesen commentedComment #2
rszrama CreditAttribution: rszrama commentedSorry, 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.