我已将magento版本从1.4.2升级到1.8,当我向购物车添加内容时出现SQL错误:
SQLSTATE [42S22]:未找到列:1054未知列' website_ids'在' where子句'
导致此错误的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'