All this afte rupgrading from 1.4.1
I get a quite specific error message:
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/19-1-2' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID'' in /home/in-due/domains/sb2.in-due.de/public_html/hochzeitsshop/lib/Zend/Db/Statement/Pdo.php:234
problem is, that I don't know how to find the entry, that is making trouble. neither in the backend (catalog|URL Rewrite Management) nor in the db itself (table core_url_rewrite) is an entry
product/19-1-2
any help is appreciated,
PAT ERLER
#perler, here is a MySQL query to detect duplicate SKUs. Remember, if you prefixed your tables, change catalog_product_entity accordingly!
SELECT
DISTINCT(`sku`) as `sku`,
COUNT(`sku`) as `skuCount`,
entity_id
FROM
catalog_product_entity
GROUP BY
`sku`
HAVING
`skuCount` > 1;
The duplicate entry is for a key made up from 3 fields, id_path, is_system and store_id, in theory you should be able to use URL Rewrite Management, search for an id_path of product/19 and this is your 'troublesome' field. Deleting that value may solve the issue (but I'd recommend making a backup first, and trying it in a dev environment first).
If you are still in development and haven't used any custom rewrites you could just empty the core_url_rewrite table and re-index to regenerate all the fields. If it is a live site this would be a little more troublesome, it would mean losing a bit of SEO juice if you have renamed products, since you would lose the rewrite.
Ok, the problem was a duplicate SKU. You shouldn't be able to enter one, but what happened (in magento 1.4.0.1) was, that the client entered a very long SKU which got shortened when saving the product. the shortened part was then identically to another SKU.
so, if yourself have this problem, check you database for duplicate SKUs (can someone post an SQL Query to do this?)
Related
When i installed an extension named ajax pro on magento 1.702. when i add a product to cart,it shows
Fatal error: Call to a member function setFinalPrice() on a non-object in ..app\code\core\Mage\Sales\Model\Quote\Item\Abstract.php on line 73.
although i delete all this extension's files and folders. when i add a product to cart. the error still exist? how to correct it. thank you. i have clear all the cache.
I got this error after programmatically creating a quote with a different store id to the default store id.
Fix was to run this sql (after backing up all sales_flat_quote tables, of course):
DELETE FROM sales_flat_quote_item;
Note that TRUNCATE sales_flat_quote_item won't work due to referential integrity, and that the above command will remove the linked records from some of the other sales_flat_quote tables as well.
In reply to the comment - if you don't have access to the database then ask your hosting provider to give it to you (most give you some sort of access - eg phpmyadmin) you can run it as a code snippet, I guess:
<?php
// Save this in Magento root directory.
require_once( dirname(__FILE__) . ' /app/Mage.php');
umask(0);
Mage::app()->setCurrentStore(0);
$resource = Mage::getSingleton('core/resource');
$dbw = $resource->getConnection('core_write');
$query = "DELETE FROM sales_flat_quote_item;";
$dbw->query($query);
It's not a good idea to run that on a live production system - existing customers will lose all the items in their carts - though if your site is broken and you've nothing left to lose, maybe give it a go!
To backup the database without access to it, https://www.phpmyadmin.net/ or a similar tool will help there. You can also run the above query directly using that.
Delete session files from var/session thats it.
If it is throwing for all the customers then you can delete sales_flat_quote_item table. If this happens only for particular customer then do the following thing. In this case, all the quotes wont be deleted.
Get the customer id from sales_flat_quote_address(column name: customer_id) table. Here you can get the specific quote id(column name in table is quote_id) which is causing the problem.
Example: SELECT quote_id FROM sales_flat_quote_address where customer_id=23423
Now, go to sales_flat_quote_item then delete the particular records which is causing the problem.
Example: DELETE FROM sales_flat_quote_item WHERE quote_id=43535
I'm having a problem in updating a product data.
The strange thing is that this problem is evidently connected to websites to which this product is assigned to. For some reason if the product is assigned to website A, I can't update the product's data - the "save" action is not executed.
But for website B, I can modify all the product's data. But if I try to assign a product to website A, I have the same problem and saving is not done. I compared the data for many websites and I can't spot anything that could be the cause for this.
I'm using Magento CE 1.4.2.0. Upgrade to the latest version is in progress, but I would still like to know what caused this.
The type of catalogrule_product_prices primary key is int(10). So when all keys were used up, the last valid key is 4294967295, see Numeric Datatypes. Try to change it to BIGINT and everything should work again.
I also noticed that I can't apply the catalog rules anymore - I got the error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4294967295' for key 'PRIMARY'
Luckily we had a backup copy of the system and there everything worked ok. As I compared the code I couldn't spot any difference that could be the cause of this problem, so I took a look in data base. As soon as I copied the data tables used for catalog rules (catalogrule, catalogrule_product, catalogrule_group_website, catalogrule_product_price) from the working backup copy and place it into the broken one, everything started working ok - the product saving and applying of the catalog rules. I still don't know how this happened and will have to do a data table comparison and maybe get my answer there.
Would anyone be kind enough to explain how to change a SKU in an existing order? We import orders from a 3rd party and the SKUs have spaces in them, which need to be removed. I looked at sales_flat_order_item but not sure how to change. Any help will be very appreciated!
One possible way to remove blanks in SKUs of order items would be s/t like this:
$iIncrementId = '911';
$oOrder = Mage::getModel('sales/order')->load($iIncrementId, 'increment_id');
foreach ($oOrder->getAllVisibleItems() as $oItem) {
$oItem
->setSku(str_replace(' ', '', $oItem->getSku()))
->save();
}
I'm guessing you mean to change the Order number, because SKUs are related to products, not orders.
There's no UI way to change the Order number (there are several extensions but I strongly recommend not using ANY of them) but you can change it yourself if you have access to the database. The table sales_flat_order has an increment_id field where the order numbers are stored. This field is a varchar(50) meaning it supports alphanumeric values.
Magento keeps a UNIQUE index on the field so will not be able to keep duplicates.... unless you are running a Magento version prior to 1.4.x (actually, make that 1.4.0.22). If that's the case, be careful not to duplicate any increment_ids and whenever possible, stick to numerical values to prevent this bug http://www.magentocommerce.com/bug-tracking/issue?issue=13625
If you don't have access to the DB, you can always create an upgrade script that does the job, but add some logic to avoid duplicates or the installation script will blow in your face and the website will not work until you fix it
Using Magento 1.6
I had to make some bulk changes to my catlog and so did a full product export, made the changes then imported the ammended file.
Afterwards there were a few index that needed updating, all of them except the "Product Attributes" index correctly.
When I try to re index that one I get the error "There was a problem with reindexing process."
There are no new errors created in var/report and so I have no idea what the problem is.
csv -> http://lazytrek.com/magento_export.csv
edit - As per OSdave's suggestion I got the following error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '84-142-1-58' for key 'PRIMARY'
After struggling for hours I finally found a solution. In fact, It's a very simple solution:
Backup your database
Open phpMyAdmin and truncate (empty) the table catalog_product_flat_1
That's it. After that I was able to index all data and, until now, everything else works perfectly. This worked for me. I hope it works for you too.
PS: using Magento 1.6.0.0
OK I fixed this myself
In the SQL error the first number (in my case 84) indicates the product id, something did not import properly with that ID, I went into the product, saved it manually and hey presto I could re-index.
Hope that helps someone :-)
Remove the lock files in var/locks and try again.
I'd advise you reindex in SSH if you have a large data set
php shell/indexer.php -reindexall
Source :: https://magento.stackexchange.com/questions/24729/there-was-a-problem-with-reindexing-process
I also had this issue and was getting the following in my exception log:
Integrity constraint violation: 1062 Duplicate entry '706-168-2-60' for key 'PRIMARY''
Eventually I discovered (as posted above) that this was a problem with product ID 706 (the first digits before '-' are the product ID.
Simply opening this product within the Magento admin and saving it fixed the issue with this product, however, in my case I also had a problem with product 707, 708, 709, etc, etc...
What I then discovered is the second set of digits identify the attribute ID. I figured out which attribute this was by opening any attribute and replacing it's ID in the URL with the one in the exception log.
I then searched for a series of products (in my case 700 to 800), selected them all and used "Actions" "Update attributes" in the top right of the Catalog - Manage Products page.
I amended this attribute for all of them (which was fine for me) and the indexer worked.
If you can't set this attribute to be the same for all your products I'd suggest a bulk import to reset just this.
Last night, I was having the same problem. After following the steps outlined by OSdave to get the more precise error message, I saw my error was the same as yours.
But it wasn't just with 1 product there were several hundred products causing errors (each one saved brought up a new one). And it wasn't all with the same attribute (I'd updated multiple attributes across a database of over 4,000 products in my last import).
Since everything seemed to actually be in the database correctly (since re-saving seemed to be fixing it and giving the proper data to the final saved product), I had an idea.
Why not export all 4k products, and then re-import the same file without modification and see if that clears it.
It worked!
tl;dr: If you're having this problem with multiple products needing to be re-saved, export your whole inventory (or the relevant section if you can segment in a useful way), and re-import the same file with no modifications.
I'm using Magento v 1.9.0.1
Thanks OSdave,
It's same error for me, I changed this
in Mage_Index_Adminhtml_ProcessController edit line 138, from Mage::helper('index')->__('Cannot initialize the indexer process.') to $e->getMessage():
then tried re-index, it's shows the below error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '8308-2018-1-2788' for key 'PRIMARY', query was: INSERT INTO catalog_product_index_eav_idx (entity_id,attribute_id,store_id,value
then, I remove the product with ID '8308' and recreated and after tried to re-index, it working fine.
But don't the exact root cause of issue. I hope it's help to someone!
Double check the catalog_product_entity,catalog_product_entity_datetime,catalog_product_decimal,catalog_product_int, catalog_product_text,catalog_product_varchar table columns have with respective UNIQUE KEY's.
EDIT:
It appears that under some circumstances (which I have yet to determine) the reserved_id field is not being reset/cleared for some customers. Therefore, when a very small percentage of customers log in after performing a successful transaction their quote_id is being assigned the value of that in the sales_flat_quote table.
Therefore when they try to place the order we are seeing integrity constraint violation errors in the logs - such as:
"SQLSTATE[23000]: Integrity constraint violation 1062 Duplicate entry "
This is beginning to look like a core bug but Its completely un-reproducible at the moment.
Magento version 1.5.0.1
Have you tried the database repair tool? It can be found at http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool. It seems like yo need to repair your database.