我真的是新的Magento,我正在寻找一种方法来获得目录中的所有产品的列表,这些产品没有分配到任何类别。任何人可以提供任何帮助,如何才能实现这一点?多谢了。
vd2z7a6w1#
Select entity_id from catalog_product_entity where entity_id not in (select distinct product_id from catalog_category_product);这将为您提供不属于任何类别的所有产品实体ID。
Select entity_id from catalog_product_entity where entity_id not in (select distinct product_id from catalog_category_product);
yuvru6vn2#
您可以使用以下代码获取产品集合:
$product = Mage::getModel('catalog/product'); $productCollection = $product->getCollection() ->addAttributeToSelect('*'); foreach ( $productCollection as $_product ) { echo $_product->getName().'<br/>'; }
但是对于你的要求,你可以从下面的链接得到想法,可能是它帮助你。How do I get product category information using collections in Magento
2条答案
按热度按时间vd2z7a6w1#
Select entity_id from catalog_product_entity where entity_id not in (select distinct product_id from catalog_category_product);
这将为您提供不属于任何类别的所有产品实体ID。
yuvru6vn2#
您可以使用以下代码获取产品集合:
但是对于你的要求,你可以从下面的链接得到想法,可能是它帮助你。How do I get product category information using collections in Magento