1つの機能を追加して、通常のクイック検索を実行したいと考えています。特定のカテゴリの結果が最初に表示されます。
これまでに変更 protected function _getProductCollection()
を加えましたがMage_CatalogSearch_Block_Result
、これは機能しますが、2つの結果グループに適用したいカスタム検索結果(価格や名前など)は無視されます。
私の追加コードは次のとおりです。
$initial = $this->_productCollection->getAllIds();
$this->_productCollection->addCategoryFilter(Mage::getModel('catalog/category')->load(3));
$newids = $this->_productCollection->getAllIds();//$this->_productCollection->getAllIds();
$merged_ids = array_merge($newids, $initial);
$merged_ids = array_unique($merged_ids);
$this->_productCollection->addCategoryFilter(Mage::getModel('catalog/category')->load(2));
$this->_productCollection->getSelect()->order("find_in_set(e.entity_id,'".implode(',',$merged_ids)."')");
ここで、猫2はルートカテゴリです。
では、コレクションはどこにソートされていますか?これをそこに移動すると、私が信じているトリックを実行するはずです(?)。