码迷,mamicode.com
首页 > 其他好文 > 详细

Item with the same id "98" already exist

时间:2014-11-24 15:08:59      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   使用   sp   on   div   

在magento项目中多次遇到这样一个错误:

Item (Bluecom_Onefieldusername_Model_Customer) with the same id "98" already exist

解决方案:

(1) 新建一个类,必须继承Varien_Object

 

class Mypackage_Mymodule_Model_UniqueId extends Varien_Object{

    public function getUniqueNumber(){

        list($usec, $sec) = explode(" ", microtime());
        return uniqid(mt_rand().$sec.($usec*1000000));
    }

    public function getId(){

        return $this->getUniqueNumber();
    }
}

 

(2)在getCollection后面使用setItemObjectClass(‘mymodule/uniqueId‘)

 

Item with the same id "98" already exist

标签:style   blog   io   ar   color   使用   sp   on   div   

原文地址:http://www.cnblogs.com/fengliang/p/4118611.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!