Jump to content

Error al duplicar productos


RicRey

Recommended Posts

hola chicos, me muestra el siguiente error al duplicar archivos espero me puedan hechar una mano

 

[PrestaShopDatabaseException]

 

Duplicate entry '554-2' for key 'PRIMARY'

 

INSERT INTO `os_product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES (554, 2, 0.12)

 

at line 607 in file classes/db/Db.php

 

601. WebserviceRequest::getInstance()->setError(500, '

 '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);

602. }

603. else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))

604. {

605. if ($sql)

606. throw new PrestaShopDatabaseException($this->getMsgError().'<br><br><pre>'.$sql.'</pre>');

607. throw new PrestaShopDatabaseException($this->getMsgError());

608. }

609. }

610.

611. /**

  • [b]DbCore->displayError[/b] - [][line 307 - classes/db/Db.php][/url] - [1 Arguments]
     
    301. if ($sql instanceof DbQuery)
    302. $sql = $sql->build();
    303.
    304. $this->result = $this->_query($sql);
    305. if (_PS_DEBUG_SQL_)
    306. $this->displayError($sql);
    307. return $this->result;
    308. }
    309.
    310. /**
    311. * Execute an INSERT query
  • [b]DbCore->query[/b] - [1 Arguments][/url]
     
    441. public function execute($sql, $use_cache = true)
    442. {
    443. if ($sql instanceof DbQuery)
    444. $sql = $sql->build();
    445.
    446. $this->result = $this->query($sql);
    447. if ($use_cache && $this->is_cache_enabled)
    448. Cache::getInstance()->deleteQuery($sql);
    449. return (bool)$this->result;
    450. }
    451.
  • [b]DbCore->execute[/b] -[1 Arguments][/url]
     
    220. foreach ($res as $row)
    221. {
    222. $query = 'INSERT INTO `'._DB_PREFIX_.'product_group_reduction_cache` (`id_product`, `id_group`, `reduction`) VALUES ';
    223. $query .= '('.(int)$id_product.', '.(int)$row['id_group'].', '.(float)$row['reduction'].')';
    224. }
    225. return Db::getInstance()->execute($query);
    226. }
    227.
    228. public static function deleteCategory($id_category)
    229. {
    230. $query = 'DELETE FROM `'._DB_PREFIX_.'group_reduction` WHERE `id_category` = '.(int)$id_category;
  • [b]GroupReductionCore::duplicateReduction[/b] - [2 Arguments][/url]
     
    573. $product->indexed = 0;
    574. $product->active = 0;
    575. if ($product->add()
    576. && Category::duplicateProductCategories($id_product_old, $product->id)
    577. && ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
    578. && GroupReduction::duplicateReduction($id_product_old, $product->id)
    579. && Product::duplicateAccessories($id_product_old, $product->id)
    580. && Product::duplicateFeatures($id_product_old, $product->id)
    581. && Product::duplicateSpecificPrices($id_product_old, $product->id)
    582. && Pack::duplicate($id_product_old, $product->id)
    583. && Product::duplicateCustomizationFields($id_product_old, $product->id)
  • [b]AdminProductsControllerCore->processDuplicate[/b] - - [size=3][0 Argument][/size]
     
    [size=3]533. {
    534. // Hook before action
    535. Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
    536. Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
    537. // Call process
    538. $return = $this->{'process'.Tools::toCamelCase($this->action)}();
    539. // Hook After Action
    540. Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
    541. Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
    542.
    543. return $return;[/size]
  • [b]AdminControllerCore->postProcess[/b] -[0 Argument][/size]
     
    [size=3]1245. * @return void
    1246. */
    1247. public function postProcess()
    1248. {
    1249. if (!$this->redirect_after)
    1250. parent::postProcess();
    1251.
    1252. if ($this->display == 'edit' || $this->display == 'add')
    1253. {
    1254. $this->addjQueryPlugin(array(
    1255. 'autocomplete',[/size]
  • [b]AdminProductsControllerCore->postProcess[/b] - [line 158 - classes/controller/Controller.php][/url] - [size=3][0 Argument][/size]
     
    [size=3]152. // setMedia MUST be called before postProcess
    153. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
    154. $this->setMedia();
    155.
    156. // postProcess handles ajaxProcess
    157. $this->postProcess();
    158.
    159. if (!empty($this->redirect_after))
    160. $this->redirect();
    161.
    162. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))[/size]
  • [b]ControllerCore->run[/b] - - [size=3][0 Argument][/size]
     
    [size=3]343. // Execute hook dispatcher
    344. if (isset($params_hook_action_dispatcher))
    345. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    346.
    347. // Running controller
    348. $controller->run();
    349. }
    350. catch (PrestaShopException $e)
    351. {
    352. $e->displayMessage();
    353. }[/size]
  • [b]DispatcherCore->dispatch[/b] - - [size=3][0 Argument][/size]
     
    [size=3]44. $_POST['controller'] = strtolower($_POST['tab']);
    45. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
    46. $_REQUEST['controller'] = strtolower($_REQUEST['tab']);
    47.
    48. // Prepare and trigger admin dispatcher
    49. Dispatcher::getInstance()->dispatch();[/size]

Edited by RicRey (see edit history)
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...