在magento升级1.7到1.9.1.0之后保存产品的问题

时间:2015-04-29 07:59:38

标签: php magento magento-1.7 magento-1.9.1

我最近将我的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`

Bellow是错误的屏幕截图。 enter image description here

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

1 个答案:

答案 0 :(得分:1)

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

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表的结构。例如,TBT奖励模块添加'rules_hash'列,在升级后消失并且您有错误。如果在升级之前有数据库转储 - 请检查某些自定义列的表结构,并将此列添加到新升级的表中。