2015-12-12 4 views
0

Я модернизированную версию Magento от 1.4.2 до 1.8, и у меня есть ошибка SQL, когда я что-то добавить в корзину:MySQL ошибка после обновления Magento

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

SQL запрос, который вызывает эту ошибку:

SELECT `main_table`.* 
FROM `salesrule` AS `main_table` 
WHERE (is_active=1) 
AND (find_in_set(1, website_ids)) 
AND (find_in_set(0, customer_group_ids)) 
AND (main_table.coupon_type = 1) 
AND (from_date is null or from_date<='2015-12-12') 
AND (to_date is null or to_date>='2015-12-12') 
ORDER BY `sort_order` ASC 

Я знаю, что я должен подготовить некоторые sql-запросы для его ремонта, но я не очень хорош в sql. У кого-то есть решение? Благодарю.

определение salesrule:

CREATE TABLE `salesrule` (
`rule_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Rule Id', 
`name` varchar(255) DEFAULT NULL COMMENT 'Name', 
`description` text COMMENT 'Description', 
`from_date` date DEFAULT NULL, 
`to_date` date DEFAULT NULL, 
`uses_per_customer` int(11) NOT NULL DEFAULT '0' COMMENT 'Uses Per Customer', 
`is_active` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Is Active', 
`conditions_serialized` mediumtext COMMENT 'Conditions Serialized', 
`actions_serialized` mediumtext COMMENT 'Actions Serialized', 
`stop_rules_processing` smallint(6) NOT NULL DEFAULT '1' COMMENT 'Stop Rules Processing', 
`is_advanced` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'Is Advanced', 
`product_ids` text COMMENT 'Product Ids', 
`sort_order` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Sort Order', 
`simple_action` varchar(32) DEFAULT NULL COMMENT 'Simple Action', 
`discount_amount` decimal(12,4) NOT NULL DEFAULT '0.0000' COMMENT 'Discount Amount', 
`discount_qty` decimal(12,4) DEFAULT NULL COMMENT 'Discount Qty', 
`discount_step` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Discount Step', 
`simple_free_shipping` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Simple Free Shipping', 
`apply_to_shipping` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Apply To Shipping', 
`times_used` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Times Used', 
`is_rss` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Is Rss', 
`coupon_type` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'Coupon Type', 
`use_auto_generation` smallint(6) NOT NULL DEFAULT '0' COMMENT 'Use Auto Generation', 
`uses_per_coupon` int(11) NOT NULL DEFAULT '0' COMMENT 'Uses Per Coupon', 
PRIMARY KEY (`rule_id`), 
KEY `IDX_SALESRULE_IS_ACTIVE_SORT_ORDER_TO_DATE_FROM_DATE` (`is_active`,`sort_order`,`to_date`,`from_date`) 
) ENGINE=InnoDB AUTO_INCREMENT=209 DEFAULT CHARSET=utf8 COMMENT='Salesrule' 
+0

опубликуйте определение таблицы для main_table ('show create table main_table') – amdixon

+0

ну,' website_ids' не находится в этой таблице. возможно, вы имеете в виду «product_ids», но его невозможно узнать без дополнительного контекста. customer_group_ids не существует ни – amdixon

ответ

0

Кажется, вопрос повторного индексирования. Попробуйте выполнить следующие шаги, чтобы Переиндексирование:

  1. Magento панели администратора
  2. Система
  3. Management Index
  4. Выбрать все
  5. Submit (Переиндексирование данных)

I Надеюсь, что это поможет вам.

Смежные вопросы