Item (Mage_Catalog_Model_Product) with the same id ”xxx“ already exist
来源:互联网 发布:搜狗手机输入法mac 编辑:程序博客网 时间:2024/06/06 01:36
Step 1. Modify the core file lib/Varien/Data/Collection.php
, function addItem()
, but unlike this answer suggests, don't hide the error.
Instead, add extra error information to the exception thrown:
if (isset($this->_items[$itemId])) { throw new Exception('Item ('.get_class($item). ') with the same id "'.$item->getId().'" already exist' . '. SQL that caused this: ' . $this->getSelect()); }
Step 2. Take the offending query from your error report and run it by hand. See what records duplicate the collection key. Addorder by <key field>
as needed.
Dissect the query removing the participating tables one-by-one, and see which record caused the duplication.
I believe this patch should be in the core.
lib\Varien\Data\Collection.php
注释掉,未解决实际问题
public function addItem(Varien_Object $item) { $itemId = $this->_getItemId($item); if (!is_null($itemId)) {// if (isset($this->_items[$itemId])) {// throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');// }// if (isset($this->_items[$itemId])) {// throw new Exception('Item ('.get_class($item).// ') with the same id "'.$item->getId().'" already exist' .// '. SQL that caused this: ' . $this->getSelect());// } $this->_items[$itemId] = $item; } else { $this->_addItem($item); } return $this; }
编译之后需要对下列文件处理
includes\src\__default.php
\includes\src\Varien_Data_Collection.php
\includes\src\Varien\Data\Collection.php
0 0
- Item (Mage_Catalog_Model_Product) with the same id ”xxx“ already exist
- Magento: Item (Mage_Sales_Model_Order) with the same id “1” already exist
- magento catalog Model Product with the same id already exist
- VS2015报错: An item with the same key has already been added
- 容器service endpoint with name xxx already exist问题
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- Another MySQL daemon already running with the same unix socket
- Another MySQL daemon already running with the same unix socket.
- View with same id
- Ehcache依赖版本问题:Another CacheManager with same name 'es' already exists in the same VM.
- UE4自编译UE4Editor
- [自定义组件之四]利用Quartz2D实现圆形图片显示
- Activity生命周期
- 设计模式大全
- JSON 之GSON 解析
- Item (Mage_Catalog_Model_Product) with the same id ”xxx“ already exist
- 【转】史上最全的CSS hack方式一览
- hihocoder week 86 Spring Outing【思维】
- 23种设计模式
- mysql优化之thread_cache_size
- JDK5新特性之泛型
- 传入输入流即可将流中的数据转成String
- 当存放表决盘的磁盘组发生磁盘丢失时,启动CRS的步骤 (文档 ID 2055530.1)
- 鸡兔同笼代码