magento 将 1.7 升级到 1.9.1.0 后保存产品出现问题

Issue in save product after magento upgrade 1.7 to 1.9.1.0

我最近将我的 magento 1.7 升级到 1.9.1.0,一切正常,但在管理部分的产品保存中出现问题。

如果我从管理部分添加或编辑产品,它会显示以下错误。

 SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1, 
query was: INSERT INTO `catalogrule_product_price` SELECT NULL AS `rule_product_price_id`, `dates`.`rule_date`, `t`.`customer_group_id`, `t`.`product_id`, MIN(rule_price) AS `rule_price`, 1 AS `website_id`, `t`.`latest_start_date`, `t`.`earliest_end_date` FROM (SELECT `cppt`.`customer_group_id`, `cppt`.`product_id`, CASE WHEN IFNULL((@group_id), 'N/A') != cppt.grouped_id THEN @price := CASE `cppt`.`action_operator` WHEN 'to_percent' THEN cppt.price * cppt.action_amount/100 WHEN 'by_percent' THEN cppt.price * (1 - cppt.action_amount/100) WHEN 'to_fixed' THEN IF((cppt.action_amount < cppt.price), cppt.action_amount, cppt.price) WHEN 'by_fixed' THEN IF((0 > cppt.price - cppt.action_amount), 0, cppt.price - cppt.action_amount) END WHEN IFNULL((@group_id), 'N/A') = cppt.grouped_id AND IFNULL((@action_stop), 0) = 0 THEN @price := CASE `cppt`.`action_operator` WHEN 'to_percent' THEN @price * cppt.action_amount/100 WHEN 'by_percent' THEN @price * (1 - cppt.action_amount/100) WHEN 'to_fixed' THEN IF((cppt.action_amount < @price), cppt.action_amount, @price) WHEN 'by_fixed' THEN IF((0 > @price - cppt.action_amount), 0, @price - cppt.action_amount) END ELSE @price := @price END AS `rule_price`, `cppt`.`from_date` AS `latest_start_date`, `cppt`.`to_date` AS `earliest_end_date`, CASE WHEN IFNULL((@group_id), 'N/A') != cppt.grouped_id THEN @action_stop := cppt.action_stop WHEN IFNULL((@group_id), 'N/A') = cppt.grouped_id THEN @action_stop := IFNULL((@action_stop), 0) + cppt.action_stop END, @group_id := cppt.grouped_id, `cppt`.`from_time`, `cppt`.`to_time` FROM `catalogrule_product_price_tmp` AS `cppt` ORDER BY `cppt`.`grouped_id` ASC, `cppt`.`sort_order` ASC, `cppt`.`rule_product_id` ASC) AS `t` INNER JOIN (SELECT DATE_ADD(FROM_UNIXTIME(1430290800), INTERVAL -1 DAY) AS rule_date UNION SELECT FROM_UNIXTIME(1430290800) AS rule_date UNION SELECT DATE_ADD(FROM_UNIXTIME(1430290800), INTERVAL 1 DAY) AS rule_date) AS `dates` ON 1=1 WHERE (UNIX_TIMESTAMP(dates.rule_date) >= from_time) AND (IF((to_time = 0), 1, UNIX_TIMESTAMP(dates.rule_date) <= to_time)) GROUP BY `customer_group_id`, `product_id`, `dates`.`rule_date`

以下为错误截图。

如果您对此问题有任何解决方案或建议,请帮助我解决此问题。

table 中遗漏了一些列。检查 catalogrule_product_price table 的结构。还要检查你有什么 catalogrule_product_price_tmp table。如果没有,创建它:

CREATE temporary TABLE `catalogrule_product_price_tmp` 
  ( 
     `grouped_id`        VARCHAR(80) NULL comment 'Grouped ID', 
     `product_id`        INT UNSIGNED NULL comment 'Product ID', 
     `customer_group_id` SMALLINT UNSIGNED NULL comment 'Customer Group ID', 
     `from_date`         DATE NULL comment 'From Date', 
     `to_date`           DATE NULL comment 'To Date', 
     `action_amount`     DECIMAL(12, 4) NULL comment 'Action Amount', 
     `action_operator`   VARCHAR(10) NULL comment 'Action Operator', 
     `action_stop`       SMALLINT NULL comment 'Action Stop', 
     `sort_order`        INT UNSIGNED NULL comment 'Sort Order', 
     `price`             DECIMAL(12, 4) NULL comment 'Product Price', 
     `rule_product_id`   INT UNSIGNED NULL comment 'Rule Product ID', 
     `from_time`         INT UNSIGNED NULL DEFAULT '0' comment 'From Time', 
     `to_time`           INT UNSIGNED NULL DEFAULT '0' comment 'To Time', 
     INDEX `idx_mmcatalogrule_product_price_tmp_grouped_id` (`grouped_id`) 
  ) 

再检查一次:可能您有一些更改 catalogrule_product_price table 结构的第 3 方模块。例如 TBT 奖励模块添加 'rules_hash' 列,升级后消失了,你有一个错误。如果您在升级前有数据库转储 - 检查 table 某些自定义列的结构并将此列添加到新升级的 table.