2014-10-06 65 views
0

我按照這裏的指南,允許根據產品的屬性設置爲應用佈局更新: http://magebase.com/magento-tutorials/creating-custom-layout-handles/Magento的顯示在列表/網格視圖屬性,基於屬性設置

理想我想顯示出對某些屬性基於屬性集的列表和網格視圖的目錄類別頁面。

所以我一直在local.xml中

<!-- CATALOG LIST/GRID --> 
    <PRODUCT_ATTRIBUTE_SET_Antibodies> 
     <reference name="extra.product.detail.list"> 
      <block type="core/template" name="antibody.detail.extra" template="catalog/product/list/detail/antibodies.phtml" /> 
     </reference> 
    </PRODUCT_ATTRIBUTE_SET_Antibodies> 

加入這一點,這裏是extra.product.detail.list參考(瘦身)

<catalog_category_layered translate="label"> 
    <label>Catalog Category (Anchor)</label> 
    <reference name="root"> 
     <action method="setTemplate"><template>page/2columns-left-flipped.phtml</template></action> 
    </reference>    
    <reference name="left"> 
     <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/> 
    </reference> 
    <reference name="content"> 
     <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml"> 
      <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"> 

       <!-- ADDED THIS --> 
       <block type="core/text_list" name="extra.product.detail.list" as="extra_product_detail_list" /> 

      </block> 
     </block> 
    </reference> 
</catalog_category_layered> 

我似乎無法在類別頁面上顯示任何內容?該佈局更新是否僅適用於產品頁面?

任何幫助將深表謝意。

回答

0

骯髒的解決方法....現在。

<?php $attributeSetId = $_product->getAttributeSetId(); ?> 
<?php 
$attributeSetDetailTemplate = false; 
switch($attributeSetId): 
    case 9: // Antibodies 
     $attributeSetDetailTemplate = 'antibodies'; 
    break; 
endswitch; 
if($attributeSetDetailTemplate) echo $this->getLayout()->createBlock('catalog/product_list')->setTemplate('catalog/product/list/detail/'.$attributeSetDetailTemplate.'.phtml')->setProductId($_product->getId())->toHtml(); 
         ?>