Retrieve items / products of two catalogs / categories?
Posted: 22 Jul 2016, 21:52
i created 2 catalogs. I want all items, that are in both catalogs, the ids of the catalogs are 7 and 13.
product with id 36 is in both
What I tried is this:
myitems is empty array
now when commenting out one category requirement I get both times a resultset that contains the product id 36
am i missing something?
product with id 36 is in both
What I tried is this:
Code: Select all
$context = CmcAimeosHelper::getContext();
$manager = \Aimeos\MShop\Index\Manager\Factory::createManager($context );
$search = $manager->createSearch(true);
$expr[] = $search->compare('==', 'index.catalog.id', 7);
$expr[] = $search->compare('==', 'index.catalog.id', 13);
$search->setConditions($search->combine( '&&', $expr ));
$myitems = $manager->searchItems($search);
var_dump($myitems );;
now when commenting out one category requirement I get both times a resultset that contains the product id 36
Code: Select all
$context = CmcAimeosHelper::getContext();
$manager = \Aimeos\MShop\Index\Manager\Factory::createManager($context );
$search = $manager->createSearch(true);
//$expr[] = $search->compare('==', 'index.catalog.id', 7);
$expr[] = $search->compare('==', 'index.catalog.id', 13);
$search->setConditions($search->combine( '&&', $expr ));
$myitems = $manager->searchItems($search);
var_dump($myitems );;
Code: Select all
$context = CmcAimeosHelper::getContext();
$manager = \Aimeos\MShop\Index\Manager\Factory::createManager($context );
$search = $manager->createSearch(true);
$expr[] = $search->compare('==', 'index.catalog.id', 7);
//$expr[] = $search->compare('==', 'index.catalog.id', 13);
$search->setConditions($search->combine( '&&', $expr ));
$myitems = $manager->searchItems($search);
var_dump($myitems );;
am i missing something?