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.

3
  • Typically you would have a content type per product type for the sake of CMS. You can theme by content type.
    – Alex Gill
    Commented Oct 15, 2012 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
    Commented Oct 15, 2012 at 9:36
  • Please see answer.
    – Alex Gill
    Commented Oct 15, 2012 at 10:22

1 Answer 1

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 and acknowledge you have read our privacy policy.

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