Page 1 of 1

Export, domain "catalog", items?

Posted: 27 Apr 2017, 11:26
by 27bit.ru
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.

Re: Export, domain "catalog", items?

Posted: 27 Apr 2017, 21:05
by aimeos
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 ... rd.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 );