Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in magento when I try to delete a product

When I try to delete a product in Magento I get the next error and I don't know where is the problem.

SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range

like image 306
Lorena Avatar asked May 21 '14 15:05

Lorena


People also ask

How do I remove all products from Magento 2?

To remove product from all categories in bulk in Magento 2: 1. Go to Catalog > Products and check the products you want to remove all categories for.

How do I bulk delete items in Magento?

The fastest way to do it is to run this query directly. DELETE FROM `catalog_product_entity` WHERE `sku` IN ('SKU1', 'SKU2', ...., 'SKU1000');


1 Answers

I managed to make it work editing the file app/code/core/Mage/Sales/Model/Resource/Quote.php at row 221:

'items_count' => new Zend_Db_Expr("CASE WHEN q.items_count>0 THEN " . $adapter->quoteIdentifier('q.items_count') . ' - 1 ELSE 0 END')

basically I added the case when statement to prevent it subtracting 1 when the value already is 0

like image 127
vvigilante Avatar answered Sep 18 '22 01:09

vvigilante