Skip to content

Better Config how Product Attributes are shown in the View when not set #1899

Open
@Hanmac

Description

@Hanmac

Description (*)

  • Some Shop Owner wants that some attributes in the Product Attribute View Grid are only shown when they have a value inside.
  • Currently there is no way to config what attributes should be shown, or how.

It is especially this part:

if (!$product->hasData($attribute->getAttributeCode())) {
$value = Mage::helper('catalog')->__('N/A');
} elseif (is_null($value) || $value === false || $value === '') {
$value = Mage::helper('catalog')->__('No');
} elseif ($attribute->getFrontendInput() == 'price' && is_string($value)) {
$value = Mage::app()->getStore()->convertPrice($value, true);
}
if (is_string($value) && strlen($value)) {

The first section with "N/A" technically can't happen because even if the attribute isn't set for the product, the product still has null set for the attribute so "N/A" can't be true.

same with the strlen($value) check below, you can't make it return it an empty string because it is getting replaced above anyway.

to better hide Attributes which are "N/A" or "No" i would like either something that can be configured on the Product Attribute, like "don't show on empty" or something. Or for even more flexibility, add a observer that controls show the attribute is shown, or is hidden.

Expected behavior (*)

Some attributes aren't shown, depending on the value or other properties.

Benefits

It is more configurable for the Shop Owner how some attributes are rendered.

Additional information

Slightly related to this: #1300

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions