Questions around the Aimeos bundle for the Symfony framework
Forum rules: Always add your Symfony, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3909 by alex110504
16 Feb 2017, 07:22
I am having trouble with $productItem->getRefItems( 'text', 'short', 'default' ) function, as it returns empty array. I have the demo product database installed, and have short and long text associated with the Demo article out of the box, however cannot see not only the short text in the catalog/lists component, but the product price either. I am talking about template in ext/ai-client-html/client/html/templates/catalog/lists/items-body-default.php.
There is a foreach loop in items-body-default.php starting around line 122:
<?php foreach( $productItem->getRefItems( 'text', 'short', 'default' ) as $textItem ) : ?>
<div class="text-item" itemprop="description">
<?php echo $enc->html( $textItem->getContent(), $enc::TRUST ); ?><br/>
</div>
<?php endforeach; ?>
which gets skipped because $productItem->getRefItems( 'text', 'short', 'default' ) returns empty array.
#3910 by aimeos
16 Feb 2017, 08:13
Where does the product items come from? Did you search for them yourself via
Code: Select all$productManager->searchItems( $criteria );

If yes, you have to add the domains you want to fetch too:
Code: Select all$productManager->searchItems( $criteria, array( 'text', 'price' ) );
#3931 by aimeos
21 Feb 2017, 09:33
A much better way is to set the default locale in the Symfony config.yml:
Code: Select all# app/config/config.yml
framework:
    default_locale: fr

Then, you can still use more languages in the future.