Rendering attribute media in product partial
Posted: 26 Mar 2017, 16:03
Hi,
I'm currently adapting aimeos for a webshop. Now i want to show some product attributes (more specifically the attribute's image) on the product cards, e.g. in the list view, suggested and recently viewed products, etc.
Since it is always rendered via client/html/templates/common/partials/products-default.php I somehow need to make the attribute data available there.
So far I've adapted the domains that are fetched with the product (added 'attribute' to both client/html/catalog/domains and client/html/basket/related/bought/standard/domains, while setting client/html/catalog/detail/domains to the default from the detail html client), but that only loads the attribute data itself, not the associated media.
Since the "context" variable is not available in views, it's impossible to create managers there, so the only "standard" solution I see right now is adapting clients and templates to load the attribute media data and transfer it to the partial. but that would require overriding at least 6 files (since the partial is used by basket/related/bought, catalog/detail and catalog/lists).
One hack would be to put the context into a global variable and use it in the view. Not very elegant, but nobody has to build upon my code.
Are these the only potential solutions? Or am I missing something?
In case it's relevant: I'm using aimeos 17.3 with TYPO3 7.6.
I'm currently adapting aimeos for a webshop. Now i want to show some product attributes (more specifically the attribute's image) on the product cards, e.g. in the list view, suggested and recently viewed products, etc.
Since it is always rendered via client/html/templates/common/partials/products-default.php I somehow need to make the attribute data available there.
So far I've adapted the domains that are fetched with the product (added 'attribute' to both client/html/catalog/domains and client/html/basket/related/bought/standard/domains, while setting client/html/catalog/detail/domains to the default from the detail html client), but that only loads the attribute data itself, not the associated media.
Since the "context" variable is not available in views, it's impossible to create managers there, so the only "standard" solution I see right now is adapting clients and templates to load the attribute media data and transfer it to the partial. but that would require overriding at least 6 files (since the partial is used by basket/related/bought, catalog/detail and catalog/lists).
One hack would be to put the context into a global variable and use it in the view. Not very elegant, but nobody has to build upon my code.
Are these the only potential solutions? Or am I missing something?
In case it's relevant: I'm using aimeos 17.3 with TYPO3 7.6.