Skip to content

Instantly share code, notes, and snippets.

@karelbemelmans
Created March 27, 2013 14:38
Show Gist options
  • Save karelbemelmans/5254674 to your computer and use it in GitHub Desktop.
Save karelbemelmans/5254674 to your computer and use it in GitHub Desktop.
dpm a $node and its attached $product
<?php
/**
* Implements hook_node_view().
*/
function foo_node_view($node, $view_mode, $langcode) {
if ($node->type == 'product_display') {
$product_id = $node->field_product[LANGUAGE_NONE][0]['product_id'];
$product = commerce_product_load($product_id);
dpm ($node, 'node');
dpm ($product, 'product');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment