사용자 지정 PHTML을 사용하여 사용자 지정 모듈에서 getPriceHTML ()을 사용하는 방법

magento.stackexchange https://magento.stackexchange.com//questions/35394

  •  12-12-2019
  •  | 
  •  

문제

제품을 인쇄 할 사용자 지정 PHTML이있는 사용자 정의 모듈이 있습니다.그러나 아래 코드

$this->getPriceHtml($_product, true);
.

는 해당 페이지에서 어떤 것을 렌더링하지 않습니다.그래서 코드를 로 변경하려고했습니다.

$product_block = new Mage_Catalog_Block_Product;
echo $product_block->getPriceHtml($_product, true);
.

그러나 이와 같은 오류 메시지가 생성되었습니다.

회원 함수에 대한 호출 xx 라인의 비 객체에서 getStoreLabel ()

어떻게이 문제를 해결할 수 있습니까?

도움이 되었습니까?

해결책

hkinterview,

사용자 지정 PHTML 블록 클래스 should need to extends Mage_Catalog_Block_Product_Abstract

then  `$this->getPriceHtml($_product, true);` will be workss 
.

예제

class YoumoduleNamespace_yourModuleName_Block_yourclass extends Mage_Catalog_Block_Product_Abstract  
.

다른 팁

이 솔루션을 사용할 수 있습니다 http://davemakaulay.com/call-이 getpricehtml-custom-magento-template / 당신이 일부 수업을 확장하고 싶지 않으면

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top