2014-02-28 76 views
1
$categories = $this->getCategories($sub_cats); 
$product->addToCategories($categories); 

foreach ($categories as $category) { 
    $product->category[] = $category; 
} 

當我想補充的產品類別,但我不能改變id_category_default如何添加一個新的產品

如何更改默認類別信息此代碼的工作很好,當更改默認類別ID?

回答

0

當您嘗試保存默認類別時,是否調用了save()方法?

$product->id_category_default = (int)$id_category; 
$product->addToCategories($categories); 
$product->save(); 
相關問題