我可以毫不费力地在CMS页面中嵌入一个块。我也可以毫无困难地将参数传递给块。
我要做的是在CMS页面中嵌入一个块,该页面返回特定搜索短语的搜索结果。
嵌入具有特定标签的所有产品也会有所帮助。
两者都不容易做到。
答案 0 :(得分:3)
我一直在寻找同样的东西,到目前为止我的发现......
$search = Mage::getSingleton('catalogsearch/advanced')->addFilters(array('name' => $term));
$prodCollection = $search->getProductCollection();
然后你可以浏览收藏 -
<?php
$i=1; // To display number of items in the page (Here we restricted upto 4)
foreach($prdIds as $_prdIds){ // Fetching out the products
$prodId = $_prdIds;
$obj = Mage::getModel(‘catalog/product’);
$_product = $obj->load($prodId);
...
?>
希望它可以帮助某人..