Page 1 of 1

Can't fetch attributes images at suggested products

Posted: 03 Feb 2018, 03:24
by Travin
Hi all!
I can't fetch images of atributes of suggested products.

I have suggested products at my client\html\templates\catalog\detail\body-default.php

Code: Select all

<?php if( ( $posItems = $this->detailProductItem->getRefItems( 'product', null, 'suggestion' ) ) !== []
            && ( $products = $getProductList( $posItems, $this->get( 'detailProductItems', [] ) ) ) !== [] ) : ?>

            <section class="catalog-detail-suggest">
                <?= $this->partial(
                    $this->config( 'client/html/common/partials/products', 'common/partials/products-atpack.php' ),
                    array( 'products' => $products, 'itemprop' => 'isRelatedTo' )
                ); ?>
            </section>

        <?php endif; ?>
At the suggested product I have the same code for including attributes like into the single product

Code: Select all

<div class="items-attribute items-attribute<?=$productItem->getId();?>">
                    <?= $this->partial(
                        'common/partials/attribute-custom.php',
                        array(
                            'productItem' => $productItem,
                            'attributeItems' => $this->get( 'attributeItems', [] ),
                            'attributeConfigItems' => $productItem->getRefItems( 'attribute', null, 'config' ),
                            'attributeCustomItems' => $productItem->getRefItems( 'attribute', null, 'custom' ),
                            'attributeHiddenItems' => $productItem->getRefItems( 'attribute', null, 'hidden' ),
                            'subClass' => $productItem->getId()
                        )
                    ); ?>
                </div>
Finally, at my attribute-custom.php I am recieving attribute's images.

Code: Select all

<?php 
foreach( $attribute->getListItems( 'media', 'default' ) as $listItem ) : 
echo 'cool! I'm attribute's image!';
endforeach;
 ?>
But this code is working only at the single product. I can't fetch images of atributes of suggested products. What can I do?

Re: Can't fetch attributes images at suggested products

Posted: 04 Feb 2018, 15:37
by aimeos
In 2017.10, second level references (images of attributes fetched along with products) are not available automatically. This is the case since 2018.01. Before, you have to match with the items in "attributeItems", which contains those images.