Posted by hkvega01 on March 4, 2013 at 10:55am
function easybreeze_preprocess_views_view_fields(&$vars) {
$view = $vars['view'];
if($view->name == "frontcatalog" || $view->name == "uc_catalog") {
foreach ($vars['fields'] as $id => $field) {
if ($id == "sell_price") {
$field_output = $view->style_plugin->get_field($view->row_index, $id);
$list_price_field_output = $view->style_plugin->get_field($view->row_index, "list_price");
$sell_price = $view->result[$view->row_index]->_field_data['nid']["entity"]->sell_price;
$list_price = $view->result[$view->row_index]->_field_data['nid']["entity"]->list_price;
if ($sell_price < $list_price) {
$vars['fields'][$id]->content = "".uc_currency_format($field_output)."";
$vars['fields']['list_price']->content = "".$list_price_field_output."";
} else {
$vars['fields']['list_price']->content = "".$list_price_field_output."";
}
}
}
}After i add this code to my module, the switch currency is not work to relative views, even though i clear all the cache or disable the module. Anyone can help?
Comments
_
there's no db code in there so there's no way that would save anything in the db.
And I don't believe that's a valid preprocess function for views.
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.