2011-03-10 54 views
2

在將1.4之前的Magento站點升級到1.4.1.2版本過程中,我遇到了一個問題。在產品列表視圖頁面上,查看所有產品的選項僅顯示10(超過10種產品的類別)。下面是從系統配置的目錄部分的一些相關設置:Magento當產品列表頁面上的limit = all時,產品數量不正確

List Mode: Grid Only 
Products per Page on Grid Allowed Values: 8,16,32 
Products per Page on Grid Default Value: 8 
Allow All Products per Page: Yes 

有在佈局文件主題/佈局/ catalog.xml中設置沒有明確的限制。

在產品列表視圖中,如果「limit」參數設置爲允許的整數值之一(8,16,32),則列表按預期工作。但是如果使用參數「limit = all」,則只顯示10種產品。

使用firephp延伸看產品列表頁與184級的產品類別,我看到以下內容:

limit=16 
THEME/template/catalog/product/list.phtml: $this->getLoadedProductCollection()->count() returns 16 
THEME/template/catalog/product/list/toolbar.phtml: $this->getCollection()->getSize() returns 184 

limit=all 
THEME/template/catalog/product/list.phtml: $this->getLoadedProductCollection()->count() returns 10 
THEME/template/catalog/product/list/toolbar.phtml: $this->getCollection()->getSize() returns 184 

我看了在_getProductCollection()方法Mage_Catalog_Block_Product_List,但不要」 t查看任何地方設置的查詢限制。任何想法,10這個限制來自或如何讓「全部」限制正常工作?

更新

計數()和的getSize()在主題/模板/目錄/產品/ list.phtml

limit=16 
THEME/template/catalog/product/list.phtml: $this->getLoadedProductCollection()->count() returns 16 
THEME/template/catalog/product/list.phtml: $this->getLoadedProductCollection()->getSize() returns 184 
THEME/template/catalog/product/list/toolbar.phtml: $this->getCollection()->getSize() returns 184 

limit=all 
THEME/template/catalog/product/list.phtml: $this->getLoadedProductCollection()->count() returns 10 
THEME/template/catalog/product/list.phtml: $this->getLoadedProductCollection()->getSize() returns 184 
THEME/template/catalog/product/list/toolbar.phtml: $this->getCollection()->getSize() returns 184 

這隻發生在我的自定義主題返回不同的值。如果我將主題切換到「基本」包,那麼limit = all條件將爲count()和getSize()返回184個產品。我的自定義主題只有對list.phtml的小標記/ CSS更改(PHP代碼相同)。

回答

0

傳呼機是罪魁禍首。 1.4之前的Magento主題在THEME/template/catalog/category/view.phtml中使用了一些傳呼機邏輯。在1.4.x中,傳呼機已被修改,並且需要在類別視圖頁面上設置明確的限制。

這裏的回收信息是,如果您發現自己實例化「product_list_toolbar_pager」,請確保將限制設置爲工具欄上使用的相同限制。

+0

你能告訴我你是如何解決這個問題的嗎? – Klettseb 2015-09-04 09:24:18