这个Magento查询有什么问题?

编程入门 行业动态 更新时间:2024-10-25 10:21:43
本文介绍了这个Magento查询有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

将Magento从1.7升级到1.8(并安装了第3个扩展名)后,我无法再保存产品.每当我保存产品时,都会出现此错误:

After upgrade Magento from 1.7 to 1.8 (with some 3rd extensions isntalled), I cannot save product any more. Whenever, I save product, I get this error:

SQL错误:SQLSTATE [21S01]:插入值列表与列列表不匹配:1136列计数与行1上的值计数不匹配

SQL ERROR: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

通过调试技术,我可以找到错误查询:

By debugging technique, I can find the error query:

SQL查询:

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(1382202000), INTERVAL -1 DAY) AS rule_date UNION SELECT FROM_UNIXTIME(1382202000) AS rule_date UNION SELECT DATE_ADD(FROM_UNIXTIME(1382202000), 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`;

您能指出我为什么该查询有该错误吗?谢谢!

Can you point me out why this query is having that error? Thanks!

更新:原因是"TBT奖励"模块在catalogrule_product_price表中添加了名为"rules_hash"的列.

UPDATE : Reason is TBT Rewards module added a column named "rules_hash" in catalogrule_product_price table.

推荐答案

跟随@Dale Holborow还替换以下app \ code \ community \ TBT \ Rewards \ Model \ Observer \ Catalog \ Product \ Flat \ Update \ Product中的代码. php

Follow @Dale Holborow also replace below code in app\code\community\TBT\Rewards\Model\Observer\Catalog\Product\Flat\Update\Product.php

if ($product) { $target_product_id = $product->getEntityId (); if (! $target_product_id) $target_product_id = null; //if no product id //available, reset our assumption because this must be some other //unrecognized request. }

替换为

if ( $product ) { if ($product instanceof Mage_Catalog_Model_Product) { $target_product_id = $product->getEntityId(); } elseif(is_numeric($product)) { $target_product_id = $product; } if ( ! $target_product_id ) $target_product_id = null; }

更多推荐

这个Magento查询有什么问题?

本文发布于:2023-10-28 08:36:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1536118.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么   Magento

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!