无法以编程方式在Magento 1.7.0.2中为类别设置"page layout"



我想在 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();

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

 $category->setPageLayout('three_columns');  

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

- empty
 - one_column
 - two_columns_left
 - two_columns_right
 - three_columns

最新更新