2011-07-05 71 views
0

我在我的Magento商店中有一個自定義主頁,其中顯示最近添加的150個產品,其中最新的產品是最新的。隱藏特定Magento類別頁面上的工具欄元素

這裏需要工具欄上的分頁(每頁30頁,5頁),但「排序方式」和「顯示」號碼顯示都不相關。

該頁面是使用Tridian新來港代碼(谷歌它),與一個小的調整,以entity_id降序排序集合,因爲created_at排序(在文章中建議)似乎無法正常工作。

因此,這基本上是一個主頁重定向到一個類別頁面,其中有一個覆蓋到位以顯示特定的產品集合(新到達)。

有人可以告訴我如何在這個頁面上隱藏這兩個選擇列表嗎?

乾杯, 羅布

+0

會要你命將鏈接添加到您的問題Tridian代碼和「文章」?它會消除你的問題中的任何含糊之處。 –

+0

通常情況下,不,但在這種情況下,是的,因爲我在我的iPhone上,並且鏈接進來是一個皇家的痛苦。使用Google我發佈的文字首先返回正確的項目(http://www.tridian.com/developer-blog/adding-new-arrivals-to-magento/)。我通常會第一次做這個:-) – robgt

回答

1

從理論上講這是可能與類別設計佈局更新,但它一直沒有那麼容易:

http://www.magentocommerce.com/boards/v/viewthread/46823/#t331000

您可以創建一個新的主題,由只需要更改文件以擺脫工具欄(黑客phtml文件),然後將此類別的自定義設計設置爲此主題。它將使用您的默認主題來填補空白,例如頁眉,頁腳等

0

我在代碼解決這一點,在toolbar.phtml,如下所示:

首先我設置一個當前類別變量的代碼的開始(我的是在第36行)。

<?php 
if (Mage::registry('current_category') != NULL) { 
    $curr_category = Mage::registry('current_category')->getName(); 
    $curr_category = strtolower($curr_category); 
} else { 
    $curr_category = ''; 
} 
?> 

然後我圍繞構建和輸出選擇列表的代碼塊在IF語句中測試變量值。

<?php if($curr_category != 'new arrivals'): ?> 
--- Select list code here --- 
<?php endif; ?> 

我希望能幫助別人!

乾杯!

0

我做到了這一點,它爲我工作。複製/app/design/frontend/base/default/template/catalog/product/list/toolbar.phtml,並將其放入您的/ app/design/frontend/default/[您的模板]/template/catalog/product/list /作爲toolbar_new.phtml。

創建CMS頁面,這增加了佈局更新:

<reference name="content"> 
      <block type="catalog/product_list" name="product_list" template="catalog/product/ga_gallery.phtml"> 
       <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbarnosort.phtml"> 
        <block type="page/html_pager" name="product_list_toolbar_pager"/> 
       </block> 
       <action method="setToolbarBlockName"><name>product_list_toolbar</name></action> 
       <action method="setCategoryId"><category_id>76</category_id></action> 
      </block>