To test this you need to have another line item type enabled besides "product". Like shipping or coupon or something.
Create a View of line items of all types.
Create a relationship to the referenced product; do not require.
Add the Commerce Product Type field to the View using the Product relationship.
Create a Page display.
Go to the page: you should see this warning:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain()
The problem is in commerce_product_handler_field_product_type.inc.
...
function render($values) {
$type = $this->get_value($values);
// Return the raw value if specified.
if (!empty($this->options['use_raw_value'])) {
return $this->sanitize_value($type);
}
$value = commerce_product_type_get_name($type);
return $this->render_link($this->sanitize_value($value), $values);
}
...
$type will be null on rows that are not product line items. Thus the commerce_product_type_get_name() returns an array of all product types which then gets passed to check_plain via sanitize_value().
Patch in the comments.
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce-views_product_type-1996780-1.patch | 1.2 KB | krlucas |
Comments
Comment #1
krlucas CreditAttribution: krlucas commentedHere's a patch.
Comment #2
rszrama CreditAttribution: rszrama commentedNice find and perfect patch. Thanks!