Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento: Rebuilding Index after self-written product import/update throws exception
    primarykey
    data
    text
    <p>we have a module to import products into magento. The module was written by a Magento programmer. It uses the Magento API and is written in PHP. It reads a CSV-like file (the actual delimiter used is '#'), translates a line into a product, then writes back the product to Magento. So far, so good.</p> <p>I've duplicated and changed the module a few times. The last change was to update products, not import whole products. The module worked for about 950 of these products, then threw an exception:</p> <pre><code>magento:/srv/www/vhosts/www.mysite.com/shell # php import_colors.php ../var/import/colors.csv.out.csv PHP Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '12804-176-1-563' for key 'PRIMARY'' in /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Statement/Pdo.php:234 Stack trace: #0 /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo-&gt;_execute(Array) #1 /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement-&gt;execute(Array) #2 /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('INSERT INTO `ca...', Array) #3 /srv/www/vhosts/www.mysite.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract-&gt;query('INSERT INTO `ca...', Array) #4 /srv/www/vhosts/www.mysite.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(1537): Varien_Db_Adapter_Pdo_Mysql-&gt;query('INSERT INTO `ca...', Array) #5 /srv/www/vhosts/www.mysite.com/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav in /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Statement/Pdo.php on line 234 Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '12804-176-1-563' for key 'PRIMARY'' in /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Statement/Pdo.php:234 Stack trace: #0 /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo-&gt;_execute(Array) #1 /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement-&gt;execute(Array) #2 /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('INSERT INTO `ca...', Array) #3 /srv/www/vhosts/www.mysite.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(333): Zend_Db_Adapter_Pdo_Abstract-&gt;query('INSERT INTO `ca...', Array) #4 /srv/www/vhosts/www.mysite.com/lib/Varien/Db/Adapter/Pdo/Mysql.php(1537): Varien_Db_Adapter_Pdo_Mysql-&gt;query('INSERT INTO `ca...', Array) #5 /srv/www/vhosts/www.mysite.com/app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Product/Indexer/Eav in /srv/www/vhosts/www.mysite.com/lib/Zend/Db/Statement/Pdo.php on line 234 </code></pre> <p>I thought nothing of it. The customer was happily changing the last 50 or so products on his own, and the error message was forgotten.</p> <p>However, today the customer called that his product attribute index would not build, the index in the backoffice remained on orange "Processing". So I've investigated and found out that the index can be built by using shell/indexer.php. So I've tried and, and lo and behold, the exact same error message I almost forgot.</p> <p>I've dumped the database and tried to find out which table actually contained the data listed in the error message (12804-176-1-563), but I had no luck. It seems that these 4 dates are nowhere to be found in this order.</p> <p>Now, there are two options on how to proceed. One would be to find out which table actually contains the problem, so that it might be fixed using Magento itself. The other way might be to clear the corresponding index table and rebuild the index from scratch. I'm not certain digging around in a database schema I do not fully understand is a good idea.</p> <p>Can anybody help me identify the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload