SQLSTATE[42S02]: Base table or view not found: 1146 Table XXXXXX
安装Galathemes.com theme插件。 首页无法打开,提示SQLSTATE[42S02]: Base table or view not found: 1146 Table “sales_flat_order_item” doesn’t exist”错误
发现MYSQL添加了数据表前缀
需要修改“app/code/local/EM/Bestsellerproducts/Block/” List.php中
将
SELECT DISTINCT SUM( order_items.qty_ordered ) AS `ordered_qty` , `order_items`.`name` AS `order_items_name` , `order_items`.`product_id` AS `entity_id` , `e`.`entity_type_id` , `e`.`attribute_set_id` , `e`.`type_id` , `e`.`sku` , `e`.`has_options` , `e`.`required_options` , `e`.`created_at` , `e`.`updated_at` FROM `前缀_sales_flat_order_item` AS `order_items` INNER JOIN `前缀_sales_flat_order` AS `order` ON `order`.entity_id = order_items.order_id AND `order`.state <> 'canceled' LEFT JOIN `前缀_catalog_product_entity` AS `e` ON e.entity_id = order_items.product_id INNER JOIN `前缀_catalog_product_website` AS `product_website` ON product_website.product_id = e.entity_id AND product_website.website_id = '1' INNER JOIN `前缀_catalog_category_product_index` AS `cat_index` ON cat_index.product_id = e.entity_id AND cat_index.store_id =1 AND cat_index.category_id IN ( ".$strCategories." ) WHERE ( parent_item_id IS NULL ) GROUP BY `order_items`.`product_id` HAVING ( SUM( order_items.qty_ordered ) >0 ) ORDER BY `ordered_qty` DESC LIMIT 0 ,".$this->getLimitCount()."
2处修改。
END
———————以下更新2015年2月10日—————–
如果缺少
Error – SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘example_magento.core_directory_storage’ doesn’t exist.
After upgrading to Magento 1.5, you may get the following error when trying to upload an image using the built-in WYSIWYG interface:
SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘example_magento.core_directory_storage’ doesn’t exist.
To fix this you need to create the table.
1) Backup your database
2) Using phpMyAdmin or other SQL Manager, run the following SQL update commands:
SET FOREIGN_KEY_CHECKS = 0; CREATE TABLE IF NOT EXISTS `core_directory_storage` ( `directory_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '', `path` varchar(255) NOT NULL DEFAULT '', `upload_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `parent_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`directory_id`), UNIQUE KEY `IDX_DIRECTORY_PATH` (`name`, `path`), KEY `parent_id` (`parent_id`), CONSTRAINT `FK_DIRECTORY_PARENT_ID` FOREIGN KEY (`parent_id`) REFERENCES `core_directory_storage` (`directory_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Directory storage'; SET FOREIGN_KEY_CHECKS = 1;
Magento产品列表按照日期排序
[magento patch]/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
改为