Export, domain "catalog", items?

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
27bit.ru
Posts: 36
Joined: 15 Jan 2017, 05:36

Export, domain "catalog", items?

Post 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.

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

Re: Export, domain "catalog", items?

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

Post Reply