0

I have views of ubercart products which are displayed in a table by standard drupal view standards. How can i theme individual product fields ?

views-view-field.tpl is having the complete product listed inside $output variable.. I want to solve this in a template file where all fields are available individually ..

2 Answers 2

1

You could use Display Suite and DS Extras, then enable Field Templates. This gives you full control of the field markup in your view modes. It might also be a bit cleaner as well, depending on what you're trying to accomplish.

0

Inside the views-view-field.tpl.php, you can use the $row variable to get your other fields. If you're using the Devel module, just send a dsm($row); to get the path to the fields you want to access.

For example I've this inside a views field template, to check if a user have something inside the field "twitter_account" :

$twitter_account = "";
if(isset($row->field_field_twitter_account[0]['raw']['value'])){
    $twitter_account = $row->field_field_twitter_account[0]['raw']['value'];
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.