Display block on specific node type, and set current node ID as view argument for node reference.

  1. <?php  
  2. // Make sure this is a block version of the view, and the current page is a node
  3. if ($view->build_type == 'block' && arg(0) == 'node' && is_numeric(arg(1))) {
  4.        
  5.         // load node info to determine content type
  6.         $node = node_load(array('nid' => arg(1)));
  7.        
  8.         // check if content type is product
  9.         if($node->type == 'product') {
  10.        
  11.         // set current node ID as argument
  12.         $args[0] = arg(1);
  13.        
  14.         return $args;
  15.         }
  16. }  ?>