Php 对magento 1.9中的非对象调用成员函数getSortedChildren()
我已经安装了magento 1.9。我想在主页上显示所有产品 所以我在主页内容部分添加了代码Php 对magento 1.9中的非对象调用成员函数getSortedChildren(),php,magento,Php,Magento,我已经安装了magento 1.9。我想在主页上显示所有产品 所以我在主页内容部分添加了代码 {{block type=“catalog/product\u list”name=“home.catalog.product.list”alias=“products\u homepage”template=“catalog/product/list.phtml”} 但它在第74行的C:\xampp\htdocs\magento\app\design\frontend\rwd\default\temp
{{block type=“catalog/product\u list”name=“home.catalog.product.list”alias=“products\u homepage”template=“catalog/product/list.phtml”}
但它在第74行的C:\xampp\htdocs\magento\app\design\frontend\rwd\default\template\catalog\product\list.phtml中显示对非对象上的成员函数getSortedChildren()的调用
但当我在主页中添加新产品时,它会很好地工作
我可以知道如何修理这个吗
感谢您的帮助
谢谢。对list.phtml文件进行简单编辑即可修复此错误 这是文件的位置
Magento/app/design/frontend/default/your_theme/template/catalog/product/
将代码段从第73行更改为第80行,更改为:
<?php
$_nameAfter = $this->getChild('name.after');
if(is_object($_nameAfter)):
$_nameAfterChildren = $_nameAfter->getSortedChildren();
foreach($_nameAfterChildren as $_nameAfterChildName):
$_nameAfterChild = $this->getChild('name.after')
->getChild($_nameAfterChildName);
$_nameAfterChild->setProduct($_product);
?>
<?php echo $_nameAfterChild->toHtml(); ?>
<?php endforeach; ?>
<?php endif ?>
有关如何自定义模板,请参阅以下两篇wiki文章:
希望对您有所帮助对list.phtml文件进行简单编辑即可修复此错误 这是文件的位置
Magento/app/design/frontend/default/your_theme/template/catalog/product/
将代码段从第73行更改为第80行,更改为:
<?php
$_nameAfter = $this->getChild('name.after');
if(is_object($_nameAfter)):
$_nameAfterChildren = $_nameAfter->getSortedChildren();
foreach($_nameAfterChildren as $_nameAfterChildName):
$_nameAfterChild = $this->getChild('name.after')
->getChild($_nameAfterChildName);
$_nameAfterChild->setProduct($_product);
?>
<?php echo $_nameAfterChild->toHtml(); ?>
<?php endforeach; ?>
<?php endif ?>
有关如何自定义模板,请参阅以下两篇wiki文章:
$_renderers = $this->getParentBlock()->getChild('state_renderers')->getSortedChildren();
到
这将解决您的问题更改代码
$_renderers = $this->getParentBlock()->getChild('state_renderers')->getSortedChildren();
到
这将解决您的问题您对list.phtml做过任何修改吗?@Shivanand,我检查了原始代码,发现可能存在此错误!我有一个修复程序,但我不知道是否可以编辑magento打包文件可以编辑打包文件。但首先,如果它们是主题包文件,则需要将它们复制到您自己的主题包中;如果它们是代码/核心文件,则需要将它们复制到具有相同目录结构的代码/本地。您是否对list.phtml进行了任何修改?@Shivanand,我检查了原始代码,发现可能存在此错误!我有一个修复程序,但我不知道是否可以编辑magento打包文件可以编辑打包文件。但首先,如果它们是主题包文件,则需要将它们复制到您自己的主题包中;如果它们是代码/核心文件,则需要复制到code/local中,并且具有相同的目录结构。