Can't fetch attributes images at suggested products

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Travin
Posts: 70
Joined: 18 Dec 2017, 03:12

Can't fetch attributes images at suggested products

Post by Travin » 03 Feb 2018, 03:24

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?
Laravel 6.18.19 | php 7.4.7 | Xubuntu | Aimeos Laravel 2019.10.5

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Can't fetch attributes images at suggested products

Post by aimeos » 04 Feb 2018, 15:37

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply