调试Magento的方法几则
I. 在app目录外调试
在Magento安装目录下,建立php文件(假设为list.php),内容如下:
<?php $collection = Mage::getModel('catalog/category')->getCollection(); ..... $collection->load(); echo $colleciton->getSelectSql();?>
III. 输出对象的类型
Magento常常产生非常大的对象,调试时如果使用var_dump($obj)会导致系统崩溃,这是常常使用
get_class($obj)
输出对象的类型,然后再慢慢分析这个类的作用!
$_category->getChildren()