Jump to content
xlkiller

Show Prodct Image from Declination

Recommended Posts

Posted (edited)

Hi

I am looking to display in the list of product templates/catalog/_partials/miniatures/product.tpl the image of the combination chosen in the filter and not the default image of the product.

Thank you for your help

Edited by xlkiller (see edit history)

Share this post


Link to post
Share on other sites

You can see all the product data with {$ produt | json_encode} and therefore display the desired data with {$ product.myimage}.

 

Share this post


Link to post
Share on other sites
Posted (edited)
29 minutes ago, Andriano said:

You can see all the product data with {$ produt | json_encode} and therefore display the desired data with {$ product.myimage}.

Thank you for your help.

With {$product|json_encode} I always get the same image url which is the main image of the product, I can't get the urls for all attributes ­čśĽ

Edited by xlkiller (see edit history)

Share this post


Link to post
Share on other sites

Give me the result of {$product|json_encode}

Share this post


Link to post
Share on other sites
2 minutes ago, Andriano said:

Give me the result of {$product|json_encode}

 

Product with 2 attributes and 1 different image per attribute:

 

{"add_to_cart_url":"https:\/\/boutique.lenvoleedescouleurs.com\/fr\/panier?add=1&id_product=2&id_product_attribute=158","id":"2","attributes":{"4":{"id_attribute":"51","id_attribute_group":"4","name":"100g","group":"Poid","reference":"blond_dore_beige_100g","ean13":"","isbn":"","upc":""}},"show_price":false,"weight_unit":"kg","url":"https:\/\/boutique.lenvoleedescouleurs.com\/fr\/blond-dore-beige-2-158.html#\/51-poid-100g","canonical_url":"https:\/\/boutique.lenvoleedescouleurs.com\/fr\/blond-dore-beige-2-.html","condition":false,"delivery_information":"","embedded_attributes":{"id_product":"2","id_supplier":"0","id_manufacturer":"0","id_category_default":"44","id_shop_default":"1","on_sale":"0","online_only":"0","ecotax":"0.000000","quantity":0,"minimal_quantity":"1","low_stock_threshold":null,"low_stock_alert":"0","price":"25,00\u00a0\u20ac","unity":"","unit_price_ratio":"0.000000","additional_shipping_cost":"0.00","reference":"blond_dore_beige","out_of_stock":"1","customizable":"0","uploadable_files":"0","text_fields":"0","redirect_type":"404","id_type_redirected":"0","available_for_order":"1","available_date":null,"show_condition":"0","condition":"new","show_price":"1","indexed":"1","visibility":"both","is_virtual":"0","cache_default_attribute":"158","date_add":"2018-01-16 15:22:43","date_upd":"2020-07-27 18:25:58","advanced_stock_management":"0","pack_stock_type":"3","description":"<p><strong>Nuances, Reflets & Sp\u00e9cificit\u00e9s de la Couleur<\/strong><br \/>Peut \u00eatre utilis\u00e9 seul ou m\u00e9lang\u00e9 \u00e0 d'autres nuances de blond. Le blond dor\u00e9 beige convient \u00e0 une chevelure claire. Donne un reflet l\u00e9ger sur les cheveux blancs. Ne jaunit pas. Cette couleur donne un aspect naturel, sans vraiment qu'il y est un effet racine apr\u00e8s 4 semaines de repousse. Selon le % de cheveux blancs et sa r\u00e9partition, il peut donner un effet m\u00e9ch\u00e9. C'est une coloration-soin \u00e0 base de plantes colorantes et soignantes Ayurv\u00e9diques et de silice. Donne de la brillance et du volume. La camomille va donner un l\u00e9ger reflet dor\u00e9, tout en enveloppant la cliente gr\u00e2ce \u00e0 ses propri\u00e9t\u00e9s calmantes.<br \/><br \/><strong>Petite Histoire de plante<\/strong><br \/>La camomille, dont les fleurs sont extraites en poudre, colore le cheveu en dor\u00e9 clair. La camomille matricaire, comme son nom l'indique - matrice, est une plante rassurante, calmante car elle est reli\u00e9e au placenta (m\u00e8re).<\/p>","description_short":"<p>De la nacre \u00e0 l'\u00e9b\u00e8ne, entrez dans l'univers vibratoire des plantes colorantes.<\/p>\r\n<p><span style=\"text-decoration: underline;\">Flavono\u00efdes :<\/span> jaune <br \/><span style=\"text-decoration: underline;\">Hauteur de ton :<\/span> 7 \u00e0 10 <br \/><span style=\"text-decoration: underline;\">Pourcentage de cheveux blancs :<\/span> 20 \u00e0 100%<br \/><span style=\"text-decoration: underline;\">Temps de pose :<\/span> 15 \u00e0 45 mn<\/p>","link_rewrite":"blond-dore-beige","meta_description":"","meta_keywords":"","meta_title":"","name":"Blond Dor\u00e9 Beige","available_now":"","available_later":"","delivery_in_stock":"","delivery_out_stock":"","new":"0","id_product_attribute":"158","allow_oosp":1,"category":"colorations","category_name":"Colorations","link":"https:\/\/boutique.lenvoleedescouleurs.com\/fr\/blond-dore-beige-2-.html","attribute_price":0,"price_tax_exc":20.83,"price_without_reduction":24.996,"reduction":0,"specific_prices":false,"quantity_all_versions":0,"id_image":"fr-default","features":[],"attachments":[],"virtual":0,"pack":0,"packItems":[],"nopackprice":0,"customization_required":false,"attributes":{"4":{"id_attribute":"51","id_attribute_group":"4","name":"100g","group":"Poid","reference":"blond_dore_beige_100g","ean13":"","isbn":"","upc":""}},"rate":20,"tax_name":"TVA FR 20%","ecotax_rate":0,"unit_price":"","images":[{"bySize":{"small_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"cart_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-cart_default\/blond-dore-beige.jpg","width":125,"height":167},"home_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"medium_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-medium_default\/blond-dore-beige.jpg","width":452,"height":603},"large_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800}},"small":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"medium":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"large":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800},"legend":"Coloration V\u00e9g\u00e9tale Blond Dor\u00e9 Beige 100g","cover":"1","id_image":"150","position":"1","associatedVariants":["158"]}],"cover":{"bySize":{"small_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"cart_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-cart_default\/blond-dore-beige.jpg","width":125,"height":167},"home_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"medium_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-medium_default\/blond-dore-beige.jpg","width":452,"height":603},"large_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800}},"small":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"medium":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"large":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800},"legend":"Coloration V\u00e9g\u00e9tale Blond Dor\u00e9 Beige 100g","cover":"1","id_image":"150","position":"1","associatedVariants":["158"]},"has_discount":false,"discount_type":null,"discount_percentage":null,"discount_percentage_absolute":null,"discount_amount":null,"discount_amount_to_display":null,"price_amount":25,"unit_price_full":"","show_availability":false,"availability_message":null,"availability_date":null,"availability":null},"file_size_formatted":null,"attachments":[],"quantity_discounts":[],"reference_to_display":"blond_dore_beige_100g","grouped_features":null,"seo_availability":"https:\/\/schema.org\/PreOrder","labels":{"tax_short":"TTC","tax_long":"TTC"},"ecotax":{"value":"0,00\u00a0\u20ac","amount":"0.000000","rate":0},"flags":[],"main_variants":[],"specific_references":null,"id_product":"2","id_supplier":"0","id_manufacturer":"0","id_category_default":"44","id_shop_default":"1","id_tax_rules_group":"7","on_sale":"0","online_only":"0","ean13":"","isbn":"","upc":"","quantity":0,"minimal_quantity":"1","low_stock_threshold":null,"low_stock_alert":"0","price":"25,00\u00a0\u20ac","wholesale_price":"0.000000","unity":"","unit_price_ratio":"0.000000","additional_shipping_cost":"0.00","reference":"blond_dore_beige","supplier_reference":"","location":"","width":"0.000000","height":"0.000000","depth":"0.000000","weight":"0.150000","out_of_stock":"1","additional_delivery_times":"1","quantity_discount":"0","customizable":"0","uploadable_files":"0","text_fields":"0","active":"1","redirect_type":"404","id_type_redirected":"0","available_for_order":"1","available_date":null,"show_condition":"0","indexed":"1","visibility":"both","cache_is_pack":"0","cache_has_attachments":"0","is_virtual":"0","cache_default_attribute":"158","date_add":"2018-01-16 15:22:43","date_upd":"2020-07-27 18:25:58","advanced_stock_management":"0","pack_stock_type":"3","state":"1","id_shop":"1","id_lang":"1","description":"<p><strong>Nuances, Reflets & Sp\u00e9cificit\u00e9s de la Couleur<\/strong><br \/>Peut \u00eatre utilis\u00e9 seul ou m\u00e9lang\u00e9 \u00e0 d'autres nuances de blond. Le blond dor\u00e9 beige convient \u00e0 une chevelure claire. Donne un reflet l\u00e9ger sur les cheveux blancs. Ne jaunit pas. Cette couleur donne un aspect naturel, sans vraiment qu'il y est un effet racine apr\u00e8s 4 semaines de repousse. Selon le % de cheveux blancs et sa r\u00e9partition, il peut donner un effet m\u00e9ch\u00e9. C'est une coloration-soin \u00e0 base de plantes colorantes et soignantes Ayurv\u00e9diques et de silice. Donne de la brillance et du volume. La camomille va donner un l\u00e9ger reflet dor\u00e9, tout en enveloppant la cliente gr\u00e2ce \u00e0 ses propri\u00e9t\u00e9s calmantes.<br \/><br \/><strong>Petite Histoire de plante<\/strong><br \/>La camomille, dont les fleurs sont extraites en poudre, colore le cheveu en dor\u00e9 clair. La camomille matricaire, comme son nom l'indique - matrice, est une plante rassurante, calmante car elle est reli\u00e9e au placenta (m\u00e8re).<\/p>","description_short":"<p>De la nacre \u00e0 l'\u00e9b\u00e8ne, entrez dans l'univers vibratoire des plantes colorantes.<\/p>\r\n<p><span style=\"text-decoration: underline;\">Flavono\u00efdes :<\/span> jaune <br \/><span style=\"text-decoration: underline;\">Hauteur de ton :<\/span> 7 \u00e0 10 <br \/><span style=\"text-decoration: underline;\">Pourcentage de cheveux blancs :<\/span> 20 \u00e0 100%<br \/><span style=\"text-decoration: underline;\">Temps de pose :<\/span> 15 \u00e0 45 mn<\/p>","link_rewrite":"blond-dore-beige","meta_description":"","meta_keywords":"","meta_title":"","name":"Blond Dor\u00e9 Beige","available_now":"","available_later":"","delivery_in_stock":"","delivery_out_stock":"","new":"0","id_product_attribute":"158","allow_oosp":1,"category":"colorations","category_name":"Colorations","link":"https:\/\/boutique.lenvoleedescouleurs.com\/fr\/blond-dore-beige-2-.html","attribute_price":0,"price_tax_exc":20.83,"price_without_reduction":24.996,"price_without_reduction_without_tax":20.83,"reduction":0,"reduction_without_tax":0,"specific_prices":false,"quantity_all_versions":0,"id_image":"fr-default","features":[],"virtual":0,"pack":0,"packItems":[],"nopackprice":0,"customization_required":false,"rate":20,"tax_name":"TVA FR 20%","ecotax_rate":0,"unit_price":"","images":[{"bySize":{"small_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"cart_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-cart_default\/blond-dore-beige.jpg","width":125,"height":167},"home_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"medium_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-medium_default\/blond-dore-beige.jpg","width":452,"height":603},"large_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800}},"small":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"medium":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"large":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800},"legend":"Coloration V\u00e9g\u00e9tale Blond Dor\u00e9 Beige 100g","cover":"1","id_image":"150","position":"1","associatedVariants":["158"]}],"cover":{"bySize":{"small_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"cart_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-cart_default\/blond-dore-beige.jpg","width":125,"height":167},"home_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"medium_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-medium_default\/blond-dore-beige.jpg","width":452,"height":603},"large_default":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800}},"small":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-small_default\/blond-dore-beige.jpg","width":98,"height":131},"medium":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-home_default\/blond-dore-beige.jpg","width":360,"height":480},"large":{"url":"https:\/\/boutique.lenvoleedescouleurs.com\/150-large_default\/blond-dore-beige.jpg","width":600,"height":800},"legend":"Coloration V\u00e9g\u00e9tale Blond Dor\u00e9 Beige 100g","cover":"1","id_image":"150","position":"1","associatedVariants":["158"]},"has_discount":false,"discount_type":null,"discount_percentage":null,"discount_percentage_absolute":null,"discount_amount":null,"discount_amount_to_display":null,"price_amount":25,"regular_price_amount":25,"regular_price":"25,00\u00a0\u20ac","discount_to_display":null,"unit_price_full":"","show_availability":false,"availability_message":null,"availability_date":null,"availability":null} 

 

Share this post


Link to post
Share on other sites

Give me the result of {$product->_getAttributeImageAssociations($product.id_product_attribute) | json_encode}

Share this post


Link to post
Share on other sites
24 minutes ago, Andriano said:

Give me the result of {$product->_getAttributeImageAssociations($product.id_product_attribute) | json_encode}

Attempted to call an undefined method named "_getAttributeImageAssociations" of class "PrestaShop\PrestaShop\Adapter\Presenter\Product\ProductListingLazyArray".

Share this post


Link to post
Share on other sites

_getAttributeImageAssociations is on Product.php Class and i use it on Product.tpl from Product List

Share this post


Link to post
Share on other sites

You have to override the productController.php file but it's a bit complex. I don't think we can see the data for the combinations on the category page. Can you give me a frontend screenshot of the product list because i don't see what you mean by "filter"?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More