elasticsuite icon indicating copy to clipboard operation
elasticsuite copied to clipboard

Make use of product attribute's display_pattern on product view page

Open ecrocombe opened this issue 1 year ago • 2 comments

Product attributes configured as a slider with a display_pattern display's correctly in layered navigation, but not on frontend product view page.

Without displaying the unit of measurement for the attribute, the information displayed is pretty useless, this could be grams, ounces, the customer viewing the product wouldn't know.

Also, could we scope display_pattern to store_view? Since it could include 'pieces' or 'куски'.

Sample image of layered navigation in category view on frontend displaying correctly.

image

Sample image of the same attribute on the product view on frontend:

image

Result of select * from eav_attribute as e join catalog_eav_attribute as c on c.attribute_id = e.attribute_id where attribute_code = 'ica_features_maximumweightcapacity';

+--------------+----------------+------------------------------------+-----------------+--------------------------------------------------------+--------------+---------------+----------------+----------------+-------------------------+-----------------+--------------+-------------+-----------------+---------------+-----------+------+--------------+-------------------------+-----------+------------+---------------+---------------+---------------+---------------------+--------------------------+-------------------------+-------------------------+-------------------------+------------------+----------+-------------------------------+----------+--------------------+-------------------------+----------------------------+-----------------+--------------------+-----------------------+---------------+------------------------+-----------------+------------------------------+-----------------------+-------------------------+----------------+------------------+---------------------+-----------------+-------------------+------------------------+-------------------------+-------------------------+---------------------------+--------------+----------------+------------------+
| attribute_id | entity_type_id | attribute_code                     | attribute_model | backend_model                                          | backend_type | backend_table | frontend_model | frontend_input | frontend_label          | frontend_class  | source_model | is_required | is_user_defined | default_value | is_unique | note | attribute_id | frontend_input_renderer | is_global | is_visible | is_searchable | is_filterable | is_comparable | is_visible_on_front | is_html_allowed_on_front | is_used_for_price_rules | is_filterable_in_search | used_in_product_listing | used_for_sort_by | apply_to | is_visible_in_advanced_search | position | is_wysiwyg_enabled | is_used_for_promo_rules | is_required_in_admin_store | is_used_in_grid | is_visible_in_grid | is_filterable_in_grid | search_weight | is_pagebuilder_enabled | additional_data | is_displayed_in_autocomplete | is_used_in_spellcheck | facet_min_coverage_rate | facet_max_size | facet_sort_order | facet_boolean_logic | display_pattern | display_precision | sort_order_asc_missing | sort_order_desc_missing | is_display_rel_nofollow | include_zero_false_values | is_spannable | norms_disabled | default_analyzer |
+--------------+----------------+------------------------------------+-----------------+--------------------------------------------------------+--------------+---------------+----------------+----------------+-------------------------+-----------------+--------------+-------------+-----------------+---------------+-----------+------+--------------+-------------------------+-----------+------------+---------------+---------------+---------------+---------------------+--------------------------+-------------------------+-------------------------+-------------------------+------------------+----------+-------------------------------+----------+--------------------+-------------------------+----------------------------+-----------------+--------------------+-----------------------+---------------+------------------------+-----------------+------------------------------+-----------------------+-------------------------+----------------+------------------+---------------------+-----------------+-------------------+------------------------+-------------------------+-------------------------+---------------------------+--------------+----------------+------------------+
|         1103 |              4 | ica_features_maximumweightcapacity | NULL            | Magento\Catalog\Model\Attribute\Backend\DefaultBackend | varchar      | NULL          | NULL           | text           | Maximum weight capacity | validate-number | NULL         |           0 |               1 | NULL          |         0 | NULL |         1103 | NULL                    |         1 |          1 |             1 |             1 |             1 |                   1 |                        1 |                       0 |                       0 |                       0 |                0 | NULL     |                             0 |        0 |                  0 |                       0 |                          0 |               0 |                  0 |                     0 |             1 |                      0 | NULL            |                            0 |                     1 |                       1 |             10 | _count           |                   0 | %s kg           |                 0 | _last                  | _first                  |                       0 |                         0 |            0 |              0 | standard         |
+--------------+----------------+------------------------------------+-----------------+--------------------------------------------------------+--------------+---------------+----------------+----------------+-------------------------+-----------------+--------------+-------------+-----------------+---------------+-----------+------+--------------+-------------------------+-----------+------------+---------------+---------------+---------------+---------------------+--------------------------+-------------------------+-------------------------+-------------------------+------------------+----------+-------------------------------+----------+--------------------+-------------------------+----------------------------+-----------------+--------------------+-----------------------+---------------+------------------------+-----------------+------------------------------+-----------------------+-------------------------+----------------+------------------+---------------------+-----------------+-------------------+------------------------+-------------------------+-------------------------+---------------------------+--------------+----------------+------------------+

ecrocombe avatar Sep 02 '23 15:09 ecrocombe

Hello @ecrocombe,

Thanks for your PR. I will discuss this issue with our team because your solution has changed the default behavior of Magento legacy. And we can't do it in order to our Support Policy. An alternative way is to use a translation mechanism.

Also, could we scope display_pattern to store_view? Since it could include 'pieces' or 'куски'.

As for this, is not possible cause the attribute property is not in the Scope configuration.

BR, Vadym

vahonc avatar Sep 04 '23 14:09 vahonc

Hello @ecrocombe,

I guess if you wanted to allow a developer to change the display pattern according to language, you could probably try to call the translation system on the configured display_pattern string before replacing the value inside it.

Regards,

rbayet avatar Sep 05 '23 07:09 rbayet