magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

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

Open Hanmac opened this issue 3 years ago • 3 comments

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: https://github.com/OpenMage/magento-lts/blob/5dee1c0988e5ebd7fb458d6b72163c69a545c53f/app/code/core/Mage/Catalog/Block/Product/View/Attributes.php#L67-L75

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

Hanmac avatar Dec 14 '21 15:12 Hanmac

I know about this issue because it has been hotly debated on Stackexchange. It affects the listing of attributes in the product page but also in the comparison window. I chose not to have any values so I created a local language file in which I set for the values N/A and No empty strings so that the box in the table has no content.

I think we could consider creating an option in the settings in the Catalog section of the Backend where to determine if the current values N/A, No are used or not.

addison74 avatar Dec 16 '21 14:12 addison74

really? they discuss that problem on Stackexchange a lot? i hope it isn't becaue of me :)

That's why i asked at this place what the best way would be:

  • having on the Attribute if it should be hidden when empty is a simple solution
  • having an event to dispatch might be more complex, but so it can be more controlled when at the attribute should be shown or not. (maybe have it depends on the user if wanted?)

Hanmac avatar Dec 16 '21 14:12 Hanmac

I would love to work on this feature if it's not something specific and would benefit a lot of OpenMage users.

elidrissidev avatar Dec 16 '21 19:12 elidrissidev