Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get products from virtual category by categoryID? #862

Closed
jellesiderius opened this issue Apr 12, 2018 · 1 comment
Closed

Get products from virtual category by categoryID? #862

jellesiderius opened this issue Apr 12, 2018 · 1 comment

Comments

@jellesiderius
Copy link

jellesiderius commented Apr 12, 2018

Is it possible to get a product collection just by categoryID?

Preconditions
OS: Linux debian-8 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux
Magento Version: 2.2.3 CE
ElasticSuite Version: 2.5
Environment: developer

@jellesiderius jellesiderius changed the title Get products from category by categoryID? Get products from virtual category by categoryID? Apr 12, 2018
@romainruaud
Copy link
Collaborator

Hello @jellesiderius

Please detail a bit more what you are trying to do.

If you are planning to retrieve an Elasticsearch based collection filtered on a given category, you can instantiate the Fulltext product collection and use the addCategoryFilter method, like this :

use Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\CollectionFactory as FulltextCollectionFactory;

$productCollection = $this->collectionFactory->create();
$productCollection->addCategoryFilter($categoryId);

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants