Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using the uc_node_checkout and I need to set some fields that I have created. The php code is this

if (isset($order)) {
  foreach ($order->products as $product) {
    if (isset($product->data['node_checkout_nid'])) {
      $node = node_load($product->data['node_checkout_nid']);
      $node->field_productid['0']['value'] = $order->order_id;
      node_save($node);
    }
  }
}

If I create an order and add this line to the end of the php code, it dies and show a number. die($node->field_productid['0']['value']); When I remove that line and place and order the productid is empty.

share|improve this question

1 Answer

up vote 4 down vote accepted

Change this:

<?php
      $node->field_productid['0']['value'] = $order->order_id;
?>

To this:

<?php
      $node->field_productid[LANGUAGE_NONE][0]['value'] = $order->order_id;
?>

See if that helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.