无法以编程方式在Magento 1.7.0.2中为类别设置“页面布局”

时间:2014-02-13 08:29:08

标签: php magento

我想在PHP脚本中在Magento中创建类别。一切正常,但没有为该类别设置页面布局:

$category = Mage::getModel('catalog/category');

// <MyProblem>
$category->setData('page_layout', 'two_columns_left');
// </MyProblem>

$category->setStoreId($storeViewId);
$category->setName($name);
$category->setIsActive('1');
$category->setIncludeInMenu('1');
$category->setDescription($description);
$category->setDisplayMode('PRODUCTS');
$category->setPageLayout('two_columns_left');
$category->setIsAnchor('0');
$category->setParentId($parentId);
$parentCategory = Mage::getModel('catalog/category')->load($parentId);
$category->setPath($parentCategory->getPath());
$category->save();

1 个答案:

答案 0 :(得分:0)

您可以通过这种方式设置类别布局

 $category->setPageLayout('three_columns');  

three_columns是您的自定义布局,您可以在

之间设置不同的布局
- empty
 - one_column
 - two_columns_left
 - two_columns_right
 - three_columns