0

When we tried to delete products from backend, we got this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_id ' in 'where clause'

We tried reindexing, still it didn't work for us.

enter image description here

Recently we didt installed extensions.

Exception.log

exception 'Mage_Core_Exception' with message 'Invalid block type: ' in app/Mage.php:595
Stack trace:
#0 app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', '')
#3 app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', '')
#4 app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 app/code/core/Mage/Catalog/Helper/Product/View.php(73): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 app/code/core/Mage/Catalog/Helper/Product/View.php(144): Mage_Catalog_Helper_Product_View->initProductLayout(Object(OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Product), Object(Mage_Catalog_ProductController))
#9 app/code/core/Mage/Catalog/controllers/ProductController.php(132): Mage_Catalog_Helper_Product_View->prepareAndRender(38509, Object(Mage_Catalog_ProductController), Object(Varien_Object))
#10 app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Catalog_ProductController->viewAction()
#11 app/code/local/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#12 app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 index.php(89): Mage::run('', 'store')
#16 {main}
  • try delete from the database – Pradeep Sanku Jul 28 '16 at 9:44
  • @PradeepSanku but to do everytime from database is not possible for the situation we are in. – Baby in Magento Jul 28 '16 at 9:45
1

I think there is no field like product_id in catalog_product_entity table or any of eav tables which are related to products.

I suspect that there is some custom module working while you are trying to delete products.

Disable the custom modules one by one until you can identify which is causing the problem then you can consult them for further help, or provide more information about what your doing to help identify the problem.

Edit: As you told that after disabling all custom modules, still the problem is the same, therefore now please try to delete products programatically, like this:

<?php 
// Register a secure area
set_time_limit(0);
ini_set('memory_limit','512M');
require_once './app/Mage.php';
Mage :: app("default") -> setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

$productId = 1; //put your product id here
try{   
    Mage::getModel("catalog/product")->load( $productId )->delete(); 
    echo "deleted successfully";exit;
}catch(Exception $e){
    echo $e->getMessage();exit;
} 
?>

Update: If you are able to delete from custom code, then you have either core module modifications or some custom code (it may be some observer) is creating problem. You need to recheck by disabling all custom modules at once. If still problem persists, then you can take backup of core adminhtml catalog module and upload it from fresh copy of magento with same version.

  • please check catalog_product_entity table in question, i am trying disabling modules. – Baby in Magento Jul 28 '16 at 9:59
  • You can see that there is no product_id field in this table. – Mohit Kumar Arora Jul 28 '16 at 10:02
  • okay, now i am trying disabling custom modules. – Baby in Magento Jul 28 '16 at 10:02
  • i checked by disabling all modules in backend , except Mage_core modules, but still it didt worked. – Baby in Magento Jul 28 '16 at 13:57
  • as this not problem with any modules, now what to do ? – Baby in Magento Jul 29 '16 at 5:11
2

entity_id is the appropriate column name. product_id column does not exist.

  • so is we need to create product_id column ? – Baby in Magento Jul 29 '16 at 5:12
  • no. simply change product_id to entity_id in your query. don't modify the database, especially if you are not 100% sure what you are doing. – Shawn Abramson Jul 29 '16 at 5:14
  • can you please give me sql query that i can run in phpmyadmin – Baby in Magento Jul 29 '16 at 5:15
  • please give me the query you are running, I can fix it for you – Shawn Abramson Jul 29 '16 at 5:16
  • no, i have no idea about it. – Baby in Magento Jul 29 '16 at 5:16
1

I assume you are trying to delete the product using some custom code, you should try to replace product_id with entity_id if you are trying to delete products from the catalog_product_entity table.

  • please check catalog_product_entity table in question. even for Default attribute set products also i can not able to delete. – Baby in Magento Jul 28 '16 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.