2010-09-21 123 views
0

我不知道我的標題是否可以,但我想要做的事情就像畫廊或至少我的客戶這樣稱呼它......大聲笑.....我'嘗試做類似搜索結果頁面但沒有搜索條件的東西,沒有過濾器,只需點擊鏈接並查看產品列表,使用相同的功能,更改視圖模式(表格,列表),選擇數量產品展示和尋呼機,我在這裏需要一些幫助,我做了什麼至今,我創建了一個新的控制器,在我的XML佈局只是一個行動Magento產品畫廊

public function listAction(){ 
    $this->loadLayout(); 
    $this->renderLayout(); 
} 

簡單

<catalog_products_list> 
    <reference name="root"> 
     <action method="setTemplate"><template>page/1columns.phtml</template></action> 
    </reference> 
    <reference name="left"> 
     <block type="catalogsearch/layer" name="catalogsearch.leftnav" before="-" template="catalog/layer/view.phtml"/> 
    </reference> 
    <reference name="content"> 
      <block type="catalog/product_uhmalist" name="search_result_list" template="catalog/product/list.phtml"> 
       <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> 
        <block type="page/html_pager" name="product_list_toolbar_pager"/> 
       </block> 
       <block type="core/text_list" name="additional"> 
        <block type='enterprise_search/suggestions' name='search_suggestions' template="search/suggestions.phtml"></block> 
        <block type='enterprise_search/recommendations' name='search_recommendations' template="search/recommendations.phtml"></block> 
       </block> 
       <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action> 
       <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action> 
       <action method="setToolbarBlockName"><name>product_list_toolbar</name></action> 
       <action method="setPageLayout"><layout>three_columns</layout></action> 
      </block> 
      <action method="setListOrders"/> 
      <action method="setListModes"/> 
      <action method="setListCollection"/> 
    </reference> 
</catalog_products_list> 

它與catalogsearch.xml中的catalogsearch_result_index塊幾乎相同,當我試圖去我的新頁面時,它顯示我沒有產品,集合是空的,所以,我更改了app \ code中的funcion _getProductCollection()的內容\核心\法師\目錄\塊\產品\ list.php的這個

if (is_null($this->_productCollection)) { 
     $category = Mage::getModel('catalog/category')->load(5); 
     $productCollection = $category->getProductCollection(); 
     Mage::getModel('catalog/layer')->prepareProductCollection($productCollection); 
     $this->_productCollection = $productCollection->load(); 
    } 
    return $this->_productCollection; 

我不喜歡改變的核心代碼,但現在我試圖讓它工作,所以,當我刷新它顯示我的產品,我可以改變視圖模式,我可以看到產品的數量,但是,傳呼機不起作用,當我改變產品的數量時,我無法顯示,它什麼也不做,只是改變標籤8項目8的項目1-8,並不分組,如果我選擇5,它應該只顯示5項,但我可以看到8我有我的分貝,所以,

我的代碼有什麼問題?我怎樣才能讓傳呼機工作?
謝謝

回答

0

我要回答自己。

我在XML佈局中做了一些錯誤的步驟。我改變

<reference name="left"> 
    <block type="catalogsearch/layer" name="catalogsearch.leftnav" before="-" template="catalog/layer/view.phtml"/> 
</reference> 

<reference name="left"> 
    <block type="catalog/layer" name="catalogsearch.leftnav" before="-" template="catalog/layer/view.phtml"/> 
</reference> 

,我改變了這一行的默認值

<block type="catalog/product_uhmalist" name="search_result_list" template="catalog/product/list.phtml"> 

<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"> 

現在一切工作,甚至尋呼機。無論如何,感謝大家誰閱讀我的帖子