我有一个闪存模块,用于计算产品的测量值,一旦计算出来,就可以将按钮添加到购物车中看到此错误:
[PrestaShopDatabaseException]
为'PRIMARY'重复输入'739-6261-21011-0'
UPDATE `ps_cart_product`
SET `id_address_delivery` = (
SELECT `id_address_delivery` FROM `ps_cart`
WHERE `id_cart` = 739 AND `id_shop` = 1
)
WHERE `id_cart` = 739
文件类/ db / Db.php
中的第765行
760. WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
761. }
762. elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
763. {
764. if ($sql)
765. throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
766.
767. throw new PrestaShopDatabaseException($this->getMsgError());
768. }
769. }
770.
DbCore-&gt; displayError - [line 418 - classes / db / Db.php] - [1 Arguments]
413. if ($this->connect())
414. $this->result = $this->_query($sql);
415. }
416.
417. if (_PS_DEBUG_SQL_)
418. $this->displayError($sql);
419.
420. return $this->result;
421. }
422.
423. /**
DbCore-&gt;查询 - [第578行 - classes / db / Db.php] - [1参数]
573. public function execute($sql, $use_cache = true)
574. {
575. if ($sql instanceof DbQuery)
576. $sql = $sql->build();
577.
578. $this->result = $this->query($sql);
579. if ($use_cache && $this->is_cache_enabled)
580. Cache::getInstance()->deleteQuery($sql);
581.
582. return (bool)$this->result;
583. }
DbCore-&gt;执行 - [第3774行 - classes / Cart.php] - [1参数]
3769. '.(Configuration::get('PS_ALLOW_MULTISHIPPING') ? ' AND `id_shop` = '.(int)$this->id_shop : '');
3770.
3771. $cache_id = 'Cart::setNoMultishipping'.(int)$this->id.'-'.(int)$this->id_shop.((isset($this->id_address_delivery) && $this->id_address_delivery) ? '-'.(int)$this->id_address_delivery : '');
3772. if (!Cache::isStored($cache_id))
3773. {
3774. if ($result = (bool)Db::getInstance()->execute($sql))
3775. $emptyCache = true;
3776. Cache::store($cache_id, $result);
3777. }
3778.
3779. if (Customization::isFeatureActive())
CartCore-&gt; setNoMultishipping - [第446行 - 覆盖/ controllers / front / OrderOpcController.php]
441. }
442. }
443. }
444.
445. // As the cart is no multishipping, set each delivery address lines with the main delivery address
446. $this->context->cart->setNoMultishipping();
447.
448. $is_old_browser = false;
449. preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
450. if (count($matches) < 2) {
451. preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
OrderOpcController-&gt; initContent - [第180行 - classes / controller / Controller.php]
175.
176. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
177. $this->initHeader();
178.
179. if ($this->viewAccess())
180. $this->initContent();
181. else
182. $this->errors[] = Tools::displayError('Access denied.');
183.
184. if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className)))
185. $this->initFooter();
ControllerCore-&gt; run - [第373行 - classes / Dispatcher.php]
368. // Execute hook dispatcher
369. if (isset($params_hook_action_dispatcher))
370. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
371.
372. // Running controller
373. $controller->run();
374. }
375. catch (PrestaShopException $e)
376. {
377. $e->displayMessage();
378. }
DispatcherCore-&gt; dispatch - [第28行 - index.php]
23. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24. * International Registered Trademark & Property of PrestaShop SA
25. */
26.
27. require(dirname(__FILE__).'/config/config.inc.php');
28. Dispatcher::getInstance()->dispatch();
如果支付分为5个步骤prestashop,如果它有效,但One Page Checkout模块不起作用,则会出现此错误。
答案 0 :(得分:0)
我看到你在Prestashop官方论坛上接受了回复,我将在此发布
key n ps_cart_product表包含4个元素: - id_cart - id_product - id_address_delivery - id_product_attribute
在您的查询中更新关键元素(id_address_delivery) 从你的SQL更新我看到id_address_delivery等于:21011 这个id购物车和产品的条目已经存在!
但是你可以解释一下这对你有什么帮助吗?