pixelant / pxa_product_manager

Product Manager. Allow to create and list products on a site. Create dynamical attributes for products. Filter by categories and attributes
11 stars 12 forks source link

[FEATURE] Attributes on List under Product Name #408

Open nasiri opened 9 months ago

nasiri commented 9 months ago

Hello dear Pixelants Team,

is there any option on the new ProductRender Site to show any Attributes to the Product like before using. product.attribute.name ... It should be possible in the Fluid Template Partial/Cards .... But it isn't since the last updates happened.

Regards and Greetings Hamon

pixelmatseriks commented 9 months ago

Hi,

By default no attributes are returned in product list mode, but it is possible to add additional fields and attributes to return in XHR result for product list. Note, if an additional attribute is added to the product list, all attributes on each product is mapped to the product since the attribute_value field will be added to product attributes. This can have a big impact on the performance if installation contains many products and attributes.

See: https://docs.typo3.org/p/pixelant/pxa-product-manager/main/en-us/Configuration/Index.html#settings-listview-additionalattributes

Also note that by default the "card" partial is used in both "vue" and "extbase" mode, so some special condition might be needed to make the cards work in both "vue" and "extbase" mode.

An alternative that doesn't impact the performance like attributes might do is to extend the product model and then include additional fields to the XHR result for product list.

See: https://docs.typo3.org/p/pixelant/pxa-product-manager/main/en-us/Configuration/Index.html#settings-listview-additionalfields and https://docs.typo3.org/p/pixelant/pxa-product-manager/main/en-us/Developers/ModelExtender/Index.html

nasiri commented 9 months ago

While we don't have a lot of products, the first example is the preferred one.

Shouldnt this code work then?

plugin.tx_pxaproductmanager.settings.listView.additionalAttributes = xxx1, xxx2 plugin.tx_pxaproductmanager.settings.listView.includeEmptyAdditionalAttributes = xxx1, xxx2

Inside partial/cards then added following:

`

{product.attribute_value.xxx1}
{product.name}
` Still no Attribute xxx1 inside of the Listview. Is {product.attribute_value.xxx1} or {product.attribute.value.xxx1} right? Regards and thanks in advance.
pixelmatseriks commented 9 months ago

A way to see what data that is returned to the product list is by checking the network and the Fetch/XHR result (type 1606131593). There is no "attribue_value" key in the "list" result, so it should look something like: product.xxx1.label and product.xxx1.data, but the data can look different depending on the type of the fetched attribute, e.g. an array.

nasiri commented 9 months ago

Thx. Now at least it works for the non-array attribute. ;) Fetching the XHR Result helped too.

Any solution, how to iterate, if the data is in an array. i am not found of how to render/itterate any vue mode version array.

For Attribute with Option Array (rendering the whole array as a string works thou, itterating doesn't):

{ "pid": 84, "title": "xxx2", "uid": 2, "value": "xxx2" }

I cant even adress the first attribute xxx1 (no array) without the Viewhelper "v-text" in Partial/Cards Fluid Template (I assume it's the same reason i can't itterate):

<span class="product-item-text product-item-title" v-text="product.xxx1.data"></span> works

{product.xxx1.data} isn't