Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Attributes on List under Product Name #408

Open
nasiri opened this issue Oct 25, 2023 · 4 comments
Open

[FEATURE] Attributes on List under Product Name #408

nasiri opened this issue Oct 25, 2023 · 4 comments

Comments

@nasiri
Copy link

nasiri commented Oct 25, 2023

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
Copy link
Member

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
Copy link
Author

nasiri commented Nov 8, 2023

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:

<f:section name="productName"> <f:if condition="!{product}"> <f:then> <div class="item-title"> <span class="product-item-text product-item-title" v-text="product.name"></span>{product.attribute_value.xxx1} </div> </f:then> <f:else> <div class="item-title"> <span class="product-item-text product-item-title">{product.name}</span> </div> </f:else> </f:if> </f:section>

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
Copy link
Member

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
Copy link
Author

nasiri commented Nov 9, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants