2010-04-12 5 views
1

내 제품에 몇 가지 새로운 속성을 추가했습니다 (부울 "예/아니오"필드). 제품 세부 정보 페이지 및 그리드보기에 표시되는 가격을 활성화/비활성화하는 변수입니다.그리드 표시의 새 제품 속성에 액세스 할 수 없음

제품 정보 페이지에서 문제를 해결할 수있었습니다. 하지만 제품 그리드 페이지에서 나는 그 변수에 액세스하는 것 같습니다. 특히, 내가 일하는 템플릿은 catalog/product/list.phtml입니다.

필자는이 레이아웃/catalog.xml 같은 XML 파일을 추가하는 시도 :

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml"> 
    <action method="addAttribute"><name>DisplayPrice</name></action> 
    <action method="addAttribute"><name>CustomOrder</name></action>    

</block> 

내가 그렇게 카탈로그/제품/list.phtml처럼 속성에 액세스하려고 :

<?php echo $_product->getDisplayPriceName()? "Yes" : "No" ; echo $_product->getCustomOrderName()? "Yes" : "No" ;?> 

필자 또한 마법사 설정 파일 응용 프로그램/코드/코어/카탈로그에 추가/등/config.xml에 : t에서

<frontend> 
<!---- stuff before this --> 
     <product> 
      <collection> 
       <attributes> 
        <name /> 
        <url_key /> 
        <price /> 
        <special_price /> 
        <custom_order />  <!--new attribute --> 
        <display_price />  <!--new attribute --> 
        <special_from_date /> 
        <special_to_date /> 
        <short_description /> 
        <thumbnail /> 
        <small_image /> 
        <image_label /> 
        <thumbnail_label /> 
        <small_image_label /> 
        <tax_class_id /> 
        <status /> 
        <news_from_date /> 
        <news_to_date /> 
        <created_at /> 
        <updated_at /> 
       </attributes> 
      </collection> 
     </product> 
    </frontend> 

그의 포인트는 어둠 속에서 촬영. 나는 Magento 백엔드에 대해 충분히 알지 못한다. 어떤 피드백이라도 대단히 감사하겠습니다.

미리 감사드립니다.

답변

0

제품을로드 할 때로드 할 사용자 지정 특성을 지정하십시오 .Magento는 기본적으로 해당 특성을로드하지 않습니다. 제 생각에는 그렇지만 그렇게해야합니다.

$products = Mage::getModel('catalog/product')->getCollection() 
    ->addAttributeToSelect("custom_order") 
    ->addAttributeToSelect("display_price ") 
; 
관련 문제