Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento:如何将一个模块中的.phtml包含在另一个模块中_Magento_Module_Block - Fatal编程技术网

Magento:如何将一个模块中的.phtml包含在另一个模块中

Magento:如何将一个模块中的.phtml包含在另一个模块中,magento,module,block,Magento,Module,Block,我安装了两个模块 一个模块(模块1)是为一页签出而开发的,它工作正常。它用一些新的装运方法等取代了available.phtml 我想在一个新的出纳(模块2)中包含此功能,该出纳不基于onepage结账。所以我试着这样做: <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('unifaun/checkout/onepage/shipping_method/available.p

我安装了两个模块

一个模块(模块1)是为一页签出而开发的,它工作正常。它用一些新的装运方法等取代了available.phtml

我想在一个新的出纳(模块2)中包含此功能,该出纳不基于onepage结账。所以我试着这样做:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('unifaun/checkout/onepage/shipping_method/available.phtml')->toHtml(); ?>
我不确定这些信息是否足以解决这个问题,但我想我可以尝试一下,然后发布它,看看是否有人知道我做错了什么。:)


干杯

您正在包括一个类型为
核心/模板的基本块,所有块都基于此

因此,在您的上下文中,找不到方法
getShippingRates

因此,将以下内容更改为:


其中
模块块\u name
是模块块中的文件夹,例如
/block/the/block/name.php

我的答案解决了您的问题吗?
<?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
    <p><?php echo Mage::helper('unifaun')->__('No shipping methods that suit your order were found. Please contact customer service.') ?></p>
<?php else: ?>
etc... 
<?php       
    $country = Mage::getStoreConfig('shipping/origin/country_id');
    $postcode = Mage::getStoreConfig('shipping/origin/postcode');
    $city = Mage::getStoreConfig('shipping/origin/city');

    $quote = Mage::getSingleton('checkout/session')->getQuote();
    $quote->getShippingAddress()
        ->setCountryId($country)
        ->setCity($city)
        ->setPostcode($postcode)
        ->setCollectShippingRates(true);        
?>
$_shippingRateGroups = $this->getShippingRates()