Skip to content

Instantly share code, notes, and snippets.

@dyslabpro
Last active December 14, 2015 21:19
Show Gist options
  • Save dyslabpro/5150504 to your computer and use it in GitHub Desktop.
Save dyslabpro/5150504 to your computer and use it in GitHub Desktop.
<?php
function custom_contact_lenses_field_extra_fields() {
$extra['node'][CUSTOM_CONTACT_LENSES_NODE_TYPE]['display']['cl_also_sold_as_price'] = array(
'label' => t('Also sold@price'),
'description' => t(''),
'configurable' => TRUE,
'weight' => -10,
);
return $extra;
}
function custom_contact_lenses_node_view($node, $view_mode, $langcode) {
//cl_also_sold_as_price
if ($also_sold = $wrapper->field_cl_also_sold_as->value()) {
$vars_also_sold = _custom_contact_lenses_cl_product_vals2($also_sold->title, array(), $also_sold->nid);
$node->content['cl_also_sold_as_price'] = array(
'#type' => 'item',
'#name' => 'cl_also_sold_as_price',
'#markup' => t('!link @ @price', array(
'!link' => l($also_sold->title, 'node/' . $also_sold->nid),
'@price' => commerce_currency_format($vars_also_sold['price'], $vars_also_sold['currency_code'])
))
);
}
else {
$node->content['cl_also_sold_as_price'] = NULL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment