首页 > 其他 > 详细

Item with the same id "98" already exist

时间:2014-11-24 15:07:12      阅读:221      评论:0      收藏:0      [点我收藏+]

在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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!