Only tangentially related to node_checkout, hoping to reach others using similar technique. If not appropriate here, I'll move it.

Using this module snippet to populate fields for a view of paid registrations associated with the training product node purchased (to have attendee lists per training). The method is adding 2 fields (training_name + training_ID) in the node_checkout node (registration), then writing the product's sku and title into the checkout node, where I can access it in the view.

The mystery is I have it working flawlessly, but on a duplicate installation the variables are not passed (both are sibling subthemes on a multisite). Debugging this for days with every deductive scenario imaginable, I just created a third install and built it piecemeal, nothing imported, and it does not work.

One obscure difference is the original working install is using a database created on mySql 4, and the present databases created after switching to MySqi 5. This seems unrelated but I'm desperate to solve. Have examined and cleaned up the databases and have clean tidy product + order tables, sku all as expected.

These are pristine and smoothly running installs, only the lack of these variables getting filled on 2 out of 3. Here's the code (begins w/ open php tag):

function getsku_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'registration_node_form':
    if (arg(1) == 'add') {
      $product_nid = $_GET['product_nid'];
      $training = node_load($product_nid);
      $training_name = $training->title;
      $form['field_training_name'][0]['#default_value']['value'] = $training_name;
      //get SKU based on training nid
      $sku_query = 'SELECT model from uc_products where nid = %d';
      $sku = db_result(db_query($sku_query,$product_nid));
      $form['field_training_id'][0]['#default_value']['value'] = $sku;
      break;
    }
  }
}

The fields in my checkout node are correct (appear blank without the module).
Clicking add to cart, in the working version, they appear populated w/ the vars (w/ perm to view).
In the non working version, they don't appear at all (+ those fields are blank in the view).
The product SKUs are correctly in the database.

Can anyone shed light on this?

Comments

echoz’s picture

Solved (thanks Steve)!
It was due to having a lower weight in the system table, to I assume node_checkout, which has a weight of 100. I still don't know how it worked in my original, where the weights were the same.

echoz’s picture

Status: Active » Closed (fixed)