2014-02-13 126 views
0

我想在PHP腳本中創建Magento中的類別。一切工作正常,但該類別不設置頁面佈局:無法以編程方式爲Magento 1.7.0.2中的類別設置「頁面佈局」

$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(); 
+0

你有試過我的解決方案嗎?它爲我工作,所以我敢肯定它會爲你工作 –

+0

對不起,這是我的錯。它已經工作。我沒有在後端選擇正確的storeview來查看結果:-( – user3305080

回答

0

你可以從這樣

$category->setPageLayout('three_columns'); 

哪裏three_columns是你的自定義佈局,您可以設置中的不同佈局設置類別佈局

- empty 
- one_column 
- two_columns_left 
- two_columns_right 
- three_columns 
相關問題