oI在发布通知之前已升级到OpenCart 2.0 ...我已经解决了大部分问题,但是,当我尝试向购物车添加内容时,错误日志反映了以下内容:
2014-10-23 12:46:00 - PHP Notice: Error: Column 'customer_group_id' in where clause is ambiguous<br />Error No: 1052<br /> Error in: <b>/home/www/letteritgirl.net/catalog/model/catalog/product.php</b> line <b>495</b><br />
SELECT `pd`.* FROM `oc1_product_recurring` `pp` JOIN `oc1_recurring_description` `pd` ON `pd`.`language_id` = 1 AND `pd`.`recurring_id` = `pp`.`recurring_id` JOIN `oc1_recurring` `p` ON `p`.`recurring_id` = `pd`.`recurring_id` WHERE `product_id` = 999969 AND `status` = 1 AND `customer_group_id` = 1 ORDER BY `sort_order` ASC in home/www/letteritgirl.net/system/library/db/mysql.php on line 53
2014-10-23 12:46:00 - PHP Notice: Trying to get property of non-object in /home/www/letteritgirl.net/catalog/model/catalog/product.php on line 495
消息一直在加载,好像它被卡在循环中一样,并且没有任何内容添加到购物车中。
第495行如下:
$product_option_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "product_option` po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN `" . DB_PREFIX . "option_description` od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "'");
我无法解决此问题。 任何帮助将不胜感激。
答案 0 :(得分:0)
在我拥有的任何版本中,您粘贴的内容不是第495行。第495行是这个,它也与日志中的查询匹配:
return $this->db->query("SELECT `pd`.* FROM `" . DB_PREFIX . "product_recurring` `pp` JOIN `" . DB_PREFIX . "recurring_description` `pd` ON `pd`.`language_id` = " . (int)$this->config->get('config_language_id') . " AND `pd`.`recurring_id` = `pp`.`recurring_id` JOIN `" . DB_PREFIX . "recurring` `p` ON `p`.`recurring_id` = `pd`.`recurring_id` WHERE `product_id` = " . (int)$product_id . " AND `status` = 1 AND `customer_group_id` = " . (int)$this->config->get('config_customer_group_id') . " ORDER BY `sort_order` ASC")->rows;
错误表明两个或多个表都有一个“customer_group_id”字段,但事实并非如此,我检查了2.0.0.0b4中的数据库和当前的“稳定”版本。这表明你有一个更老的版本与不同的表。你真的不应该使用它,会有很多你甚至不会注意到的错误,直到为时已晚!但要修复错误,只需更改
即可AND `customer_group_id` =
要
AND `pp`.`customer_group_id` =
在我粘贴的线上。