ホームページに階層化されたナビゲーションを表示しようとしています。私はmagento 1.9.0を使用しています。次のxmlを挿入しましたLayout Update XML
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
次に、次のようにapp\code\core\Mage\Catalog\Model\layer.php
変更された関数getCurrentCategory()
で、ホームページのルート カテゴリを取得します。
public function getCurrentCategory()
{
$category = $this->getData(’current_category’);
if (is_null($category)) {
if ($category = Mage::registry(’current_category’)) {
$this->setData(’current_category’, $category);
}
else {
$category = false;
$this->setData(’current_category’, $category);
}
}
// added to make this work for front page:
if(is_null($category) || $category == false) {
$home_category = Mage::getModel(’catalog/category’)->load(4); //number must correspond to ‘all products page’ category
$this->setData(’current_category’, $home_category);
$category = $this->getData(’current_category’);
return $category;
}
//end addition
return $category;
}
しかし、次のエラーが発生しました:
致命的なエラー: 174 行目の app\code\core\Mage\Catalog\Model\Layer.php の非オブジェクトに対するメンバー関数 load() の呼び出し
助けてください。