Php 扩展Magento';s在新模块中的功能
我正试着在一个新模块中如何使用Magento的本机函数。举个简单的例子,假设我有一个基本的shell,比如: app/code/local/Me/Test/Block/Container.phpPhp 扩展Magento';s在新模块中的功能,php,magento,Php,Magento,我正试着在一个新模块中如何使用Magento的本机函数。举个简单的例子,假设我有一个基本的shell,比如: app/code/local/Me/Test/Block/Container.php <?php class Me_Test_Block_Container extends Mage_Core_Block_Template { } 但它返回空白。有人能帮我了解更多吗?我将getCurrentCategory函数复制到Container.php中,但没有成功。我是否应该更改lay
<?php
class Me_Test_Block_Container extends Mage_Core_Block_Template
{
}
但它返回空白。有人能帮我了解更多吗?我将
getCurrentCategory
函数复制到Container.php中,但没有成功。我是否应该更改layout.xml中的块类型以使用该函数,或者正确的方法是什么 您可以通过以下方式获取类别:
$_category = Mage::registry('current_category');
产品是这样的:
$_product = Mage::registry('current_product');
在使用它之前,请检查其值是否为空
$_product = Mage::registry('current_product');