Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I created a custom view that was used to output a print version of an invoice. The view used the commerce_kickstart_ui module and output the error undefined property: stdClass::$type in commerce_kickstart_product_ui.module line 69
when ever I tried to print the invoice which was output without any Drupal blocks or regions. Only the invoice content was displayed in the browser.
The problematic code was as follows:
/**
* Override or insert variables into the page template.
*/
function commerce_kickstart_product_ui_preprocess_page(&$vars) {
$product_display_types = commerce_product_reference_node_types();
if (!empty($vars['node']) && isset($product_display_types[$vars['node']->type])) {
$vars['title'] = "";
}
}
I amended the code in the module to the following:
/**
* Override or insert variables into the page template.
*/
function commerce_kickstart_product_ui_preprocess_page(&$vars) {
$product_display_types = commerce_product_reference_node_types();
if (isset($vars['node']->type)) {
if (!empty($vars['node']) && isset($product_display_types[$vars['node']->type])) {
$vars['title'] = "";
}
}
}
Works in that there are no more error messages displayed when I print the invoice but any comments would be appreciated.
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce_kickstart-fix-underfined-property-type-2020355-1.patch | 1.18 KB | jsacksick |
Comments
Comment #1
jsacksick CreditAttribution: jsacksick commentedI don't understand how a node could not have a type, but anyway I committed a slightly different patch.