您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Magento-仅加载可配置产品

Magento-仅加载可配置产品

问题getLoadedProductCollection()在于它已经被加载- 产品的数据已经从数据库中检索到。仅使用当前类别的产品集合也不足够,这将忽略“图层”(属性过滤器)。诀窍是先从列表中删除加载的产品。

// First make a copy, otherwise the rest of the page might be affected!
$_productCollection = clone $this->getLoadedProductCollection();
// Unset the current products and filter before loading the next.
$_productCollection->clear()
                   ->addAttributeToFilter('type_id', 'configurable')
                   ->load();

print_r($_productCollection) 也有问题,您不仅要输出产品,而且要输出资源的所有详细信息,即数据库连接,缓存的值以及产品的单个资源,等等。

在这种情况下,我认为您会更满意:

print_r($_productCollection->toArray())
其他 2022/1/1 18:13:38 有623人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶