简体   繁体   中英

Drupal preprocess_page variable passed to commerce-product-title.tpl.php does not load

I pass a variable in preprocess_page to the template files, so I think.

$vars['merk']=$merk;

It works fine when I call the variable in page.tpl.php . But when I call that variable in commerce-product-title.tpl.php it does not load, it returns null. I cannot find how to pass that variable to this tpl.php file.

Presuming that template is only used when displaying a product, which is a different entity to a page.

Try altering the vars in the product hook instead:

function hook_preprocess_commerce_product(&$vars) {
  $vars['merk']=$merk;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM