我从 Web 服务中获取了 magento id 列表。我将这些加载到和数组$product_ids
中,所以我有这样的东西:
Array
(
[0] => 1965
[1] => 3371
[2] => 1052
)
然后我可以把它变成一个集合:
$collection = Mage::getModel('catalog/product')->getCollection()
->addIdFilter($product_ids);
使用我的 Magento 检查器,我看到类别页面使用类Mage_Catalog_Block_Product_List
来显示产品列表。我想在课堂上做类似的事情。我试过加载:
$ProductList = new Mage_Catalog_Block_Product_List();
$ProductList->setCollection($collection);
然后我尝试加载结果的 HTML,如下所示:
$CollectionHTML = $ProductList->_toHtml();
但是$CollectionHTML
是空的。
我将如何获得您在列表视图中看到的 HTML(即前端/base/default/template/catalog/product/list.phtml 的生成输出,但给定我的集合)?