magento 分类指定id插入,id存在更新 - create category by category id
来源:互联网 发布:jquery json转object 编辑:程序博客网 时间:2024/06/14 07:48
private function updateCategory($category_array){Mage::register('isSecureArea', 1);foreach($category_array as $category){$id = $category->id;$parent_id = $category->parent_id;$name = $category->name;$is_active = $category->is_active;$level = $category1->level;$url_key = $category->url_key;$url = $category->url;$position = $category->position;$category_model = Mage::getModel('catalog/category')->load($id);if(!$category_model->getId()){$categoryID = $id; //Your category ID$categoryName = $name; //Your category name$parentCategory = Mage::getModel('catalog/category')->load($parent_id); //Your parent category's ID//1st save with initial category information (inc. ID)if($parentCategory->getId()){$category = new Mage_Catalog_Model_Category();$category->setName($categoryName);$category->setId($categoryID);$category->setPath($parentCategory->getPath()); //Shouldn't be needed here$category->setIsActive(1);$category->setPosition($position);$category->save();//2nd save with correct path underneath the parent category$category->setPath($parentCategory->getPath() . '/' . $categoryID);$category->save();}}else{//$category_model->setName($name)->save();$category_model->setParentId($parent_id)->setName($name)->setIsActive($is_active)->setLevel($level)->setUrlKey($url_key)->setUrl($url)->setPosition($position)->save();}}Mage::unregister('isSecureArea');}
0 0
- magento 分类指定id插入,id存在更新 - create category by category id
- get category id from product
- OC基础-id+构造方法+自定义构造方法+分类Category
- magento 首页调用指定ID产品
- 【objectivet-c】语法(五)Category和id
- 新建一个分类的api ,Create new magento Rest api to get category list in magento
- ID
- id
- id
- id
- ID
- ID
- @Id
- ID
- 利用EF 插入数据库指定ID
- Shop By Category in Magento HomePage
- Magento Featured Category推荐分类模块安装
- Magento导出所有分类ID和名称到数组中
- 【Winpcap新手】使用Winpcap编程,无法捕获数据包
- jquery weather 天气显示控件
- 调整数组顺序使奇数位于偶数前面
- unable to dequeue a cell with identifier xxx - must register a nib or a class for the identifier
- 使用ping测试MTU值
- magento 分类指定id插入,id存在更新 - create category by category id
- hadoop0.20.2中的KeyValueInputFormat
- C# .net 如何抓取网页内容
- new 和 alloc/init 的差别
- EVT、DVT、PVT、MP等简介
- 黑马程序员——【Java】IO——File:遍历目录下java文件
- uploadify上传控件
- 自动检测iOS网络并可跳转至设置界面设置网络
- Jsp 显示图片问题(相对路径)