You are here

function uc_varprice_node_view in UC Variable Price 7

Implements hook_node_view(). Summary of alterations: 1) Removes price displays from variable priced product nodes. 2) Inserts Variable Price product feature on product node creation.

File

./uc_varprice.module, line 141
Defines a product feature to turn any product into a variable priced product.

Code

function uc_varprice_node_view($node, $view_mode = 'full') {

  // If this node has a variable price product feature...
  if (db_query("SELECT pfid FROM {uc_product_features} WHERE fid = :fid AND nid = :nid", array(
    ':fid' => 'varprice',
    ':nid' => $node->nid,
  ))
    ->fetchField()) {

    // Hide all the prices from display.
    $node->content['cost']['#access'] = FALSE;
    $node->content['list_price']['#access'] = FALSE;
    $node->content['sell_price']['#access'] = FALSE;
    $node->content['display_price']['#access'] = FALSE;
  }
}