2016-01-04 54 views
2

我已經計算了產品的測量閃光模塊,計算一次給按鈕添加到購物車看到這個錯誤:的Prestashop數據庫異常

[PrestaShopDatabaseException]

Duplicate entry '739-6261-21011-0' for key 'PRIMARY'

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 

At line 765 in file classes/db/Db.php

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->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->query - [line 578 - classes/db/Db.php] - [1 Arguments]

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->execute - [line 3774 - classes/Cart.php] - [1 Arguments]

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->setNoMultishipping - [line 446 - override/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->initContent - [line 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->run - [line 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->dispatch - [line 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(); 

使用prestashop進行五步付款(如果它工作正常,但One Page Checkout模塊不起作用並出現此錯誤)。

+0

女巫版的Prestashop是它嗎? –

回答

0

我看見你接受了的Prestashop官方論壇的迴應,我將它張貼在這裏

key n ps_cart_product table contains 4 elements: - id_cart - id_product - id_address_delivery - id_product_attribute

in your query you update the key element (id_address_delivery) from your sql update i see that id_address_delivery is equal to: 21011 and entry for this id cart and product already exist!

但你能解釋一下這幫助你的?