Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4173 by 27bit.ru
27 Apr 2017, 11:26
Typo3 - 7.6.16, Aimeos - 16.10.5
Hello. I do the export of goods, and I faced the problem of outputting data with "catalog"
I need the data "id" and "label"
Are there any ready-made items in the store?
Or give a living example of how to create them.
Thank you.
#4174 by aimeos
27 Apr 2017, 21:05
You can extend your own class from the product export controller and look up the categories of the products and assign them to the view in addItem():
https://github.com/aimeos/ai-controller-jobs/blob/master/controller/jobs/src/Controller/Jobs/Product/Export/Standard.php#L65

To fetch the category data:
Code: Select all$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' );
$search = $manager->createSearch( true );
$expr = [
    $search->compare( '==', 'catalog.lists.refid', array_keys( $items ) ),
    $search->compare( '==', 'catalog.lists.domain', 'product' ),
    $search->getConditions(),
];
$search->setConditions( $search->compare( '&&', $expr ) );
$search->setSlice( 0, 0x7fffffff );
$listItems = $manager->searchItems( $search );

$catids = [];
foreach( $listItems as $listItem ) {
    $catids[] = $listItem->getParentId();
}

$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' );
$search = $manager->createSearch( true );
$expr = [
    $search->compare( '==', 'catalog.id', $catIds ),
    $search->getConditions(),
];
$search->setConditions( $search->compare( '&&', $expr ) );
$search->setSlice( 0, 0x7fffffff );
$catItems = $manager->searchItems( $search );