製品リストページの製品フィルター
-
12-12-2019 - |
質問
製品リストページで製品をフィルタリングし、構成可能な製品タイプのみを表示したいと考えています。
後のcatalog/product/list.phtmlファイル内
$_productCollection=$this->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();
商品リストページでエラーが発生します Column not found: 1054 Unknown column 'e.type_id' in 'where clause'
.
注記:Amaty 製品のフィルター拡張機能を使用しています。
解決
ダメダメダメ。
これをやりたい場合は 全て ページを非アクティブ化するか、Web サイトからすべてのシンプルを削除するだけです。
特定のページに対してのみ実行したい場合は、フックするオブザーバーを実装する必要があります。 catalog_block_product_list_collection
そこにフィルターを追加します。
製品リストを再ロードすると、パフォーマンスが低下します。
所属していません magento.stackexchange