0

Or do you need product-type1.tpl.php, product-type2.tpl.php, etc? I would like to theme every single product on the site but there are multiple product types.

  • Typically you would have a content type per product type for the sake of CMS. You can theme by content type. – Alex Gill Oct 15 '12 at 9:34
  • Yeah product types are actually content types. Are you now saying you think product/content-type1.tpl.php is the only way to do it across all products? – o_O Oct 15 '12 at 9:36
  • Please see answer. – Alex Gill Oct 15 '12 at 10:22
2

You could do the following in your theme processing...

function YOURTHEME_process_node(&$vars) {

    //dsm($vars);
    //dsm($vars['theme_hook_suggestions']);

    // If some node type then...
    if ($vars['node']->type) {
                // add a template suggestion
        $vars['theme_hook_suggestions'][] = 'node__product';

    }

}

Then you add a template file 'node--product.tpl.php'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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