【发布时间】:2018-07-23 21:35:08
【问题描述】:
我正在尝试在这样的自定义模块中使用 collectionFactory 获取所有产品:
$products = $this->_productCollectionFactory->create();
->addAttributeToSelect('*');
其中_productCollectionFactory在__construct()中被初始化为
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
问题是,在没有应用任何过滤器的情况下,集合中的产品数量小于我在 Magento db 中拥有的产品数量。
从后端结果我有 30.697 个产品,但 count($products) 只产生 22.000 个产品。
我错过了什么?考虑哪些产品,哪些不考虑?
【问题讨论】:
标签: magento collections magento2 product