在/app/design/frontend/default/[theme]/template/catalog/product/list.phtml中,您有以下代碼段可循環顯示$ _productCollection內容。Magento產品列表 - 按產品類型排序(可配置,然後簡單)
<?php $_collectionSize = $_productCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_productCollection as $_product): ?>
...
<?php endif; ?>
我想知道的是如何有按產品類型分類的$ _productCollection。 最終我想要的是先配置產品,然後展示簡單的產品。
幫助將不勝感激。
乾杯!
嘿@benmarks,我真的很感激它。我想這個線程已經加載的集合的問題:http://stackoverflow.com/questions/5280392/magento-load-only-configurable-products。但是它會根據評論提出與克隆方法相關的問題。 – EasyCo 2012-04-28 22:09:34
我似乎終於成功了。我還沒有完成深度測試,但我基本上取代了list.phtml中的第一行:'$ _productCollection = $ this-> getLoadedProductCollection()'with'$ _productCollection = $ this-> getLoadedProductCollection() - > clear( ) - > addAttributeToSort('type_id','ASC') - > load();'。這似乎保持了我的分層導航,但通過可配置然後簡單的排序。 – EasyCo 2012-04-28 22:41:51
您需要使用工具欄的排序和分頁以及評論進行一些測試。我懷疑這兩種情況都會出現問題。 – benmarks 2012-04-29 12:21:34