I am working on a reverse auction for our youth group. I’m using D7 with the commerce_auction module. I ran into the error below when setting up the content type for the auction:
Notice: Undefined offset: 0 in commerce_auction_node_presave() (line 260 of /public_html/catz/sites/all/modules/commerce_auction/commerce_auction.module). EntityMalformedException: Missing bundle property on entity of type commerce_product. in entity_extract_ids() (line 7697 of /public_html/catz/includes/common.inc).
for the first notice, line 260 contains this: $product_reference = $product_reference[0];
Does anyone know how to fix this error? There’s not a lot of commenting as yet on this auction module, so I can’t find a solution.
/** * Implements hook_node_presave(). */
function commerce_auction_node_presave($node) { $types = variable_get('commerce_auction_display_types', array()); if (in_array($node->type, $types) !== FALSE) { $product_reference = field_get_items('node', $node, 'field_product'); $product_reference = $product_reference[0]; $product = commerce_product_load($product_reference['product_id']); $price = field_get_items('commerce_product', $product, 'commerce_price'); $node->auction_starting_price[LANGUAGE_NONE][0]['amount'] = $price[0]['amount']; $node->auction_starting_price[LANGUAGE_NONE][0]['currency_code'] = $price[0]['currency_code']; } }