Jump to content

PrestaShop Exception


Recommended Posts

Bonjour,

Je développe un site sous prestashop 1.5.3 et quand je duplique des produits, on me redirige sur une page d'erreur : PrestaShop Exception alors que tout fonctionnait bien avant.
La cause de l'erreur est : Property Combinaison->quantity is not valid at the line 837 in file classes/ObjectModel.php.
Quand je reviens sur la liste des produits, le produit a bien été dupliqué mais il ne garde que les informations du produit et non les déclinaisons, les images et toutes les autres rubriques.
Le fichier ObjectModel.php n'a jamais été modifié.
J’espère que vous pourriez m'aider car le site est à mettre en ligne en fin de semaine.
Je vous envoie les erreurs donnés:

[PrestaShopException]

Property Combination->quantity is not valid
at line 837 in file classes/ObjectModel.php

831.
832.             $message = $this->validateField($field, $this->$field);
833.             if ($message !== true)
834.             {
835.                 if ($die)
836.                     throw new PrestaShopException($message);
837.                 return $error_return ? $message : false;
838.             }
839.         }
840.
841.         return true;
  • ObjectModelCore->validateFields - [line 264 - classes/ObjectModel.php] - [0 Argument]
    258.      *
    259.      * @return array All object fields
    260.      */
    261.     public function getFields()
    262.     {
    263.         $this->validateFields();
    264.         $fields = $this->formatFields(self::FORMAT_COMMON);
    265.
    266.         // For retro compatibility
    267.         if (Shop::isTableAssociated($this->def['table']))
    268.             $fields = array_merge($fields, $this->getFieldsShop());
  • ObjectModelCore->getFields - [line 464 - classes/ObjectModel.php] - [0 Argument]
    458.         // Database insertion
    459.         if (isset($this->id) && !Tools::getValue('forceIDs'))
    460.             unset($this->id);
    461.         if (Shop::checkIdShopDefault($this->def['table']))
    462.             $this->id_shop_default = min($id_shop_list);
    463.         if (!$result = ObjectModel::$db->insert($this->def['table'], $this->getFields(), $null_values))
    464.             return false;
    465.
    466.         // Get object id in database
    467.         $this->id = ObjectModel::$db->Insert_ID();
    468.
  • ObjectModelCore->add - [line 113 - classes/Combination.php] - [2 Arguments]
    107.         return true;
    108.     }
    109.     
    110.     public function add($autodate = true, $null_values = false)
    111.     {
    112.         if (!parent::add($autodate, $null_values))
    113.             return false;
    114.
    115.         $product = new Product((int)$this->id_product);
    116.         if ($product->getType() == Product::PTYPE_VIRTUAL)
    117.             StockAvailable::setProductOutOfStock((int)$this->id_product, 1, null, (int)$this->id);
  • CombinationCore->add - [line 3313 - classes/Product.php] - [0 Argument]
    3307.             $row['id_product'] = $id_product_new;
    3308.             unset($row['id_product_attribute']);
    3309.             $combination = new Combination();
    3310.             foreach ($row as $k => $v)
    3311.                 $combination->$k = $v;
    3312.             $return &= $combination->add();
    3313.
    3314.             $id_product_attribute_new = (int)$combination->id;
    3315.             if ($result_images = Product::_getAttributeImageAssociations($id_product_attribute_old))
    3316.             {
    3317.                 $combination_images['old'][$id_product_attribute_old] = $result_images;
  • ProductCore::duplicateAttributes - [line 487 - controllers/admin/AdminProductsController.php] - [2 Arguments]
    481.             unset($product->id_product);
    482.             $product->indexed = 0;
    483.             $product->active = 0;
    484.             if ($product->add()
    485.             && Category::duplicateProductCategories($id_product_old, $product->id)
    486.             && ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
    487.             && GroupReduction::duplicateReduction($id_product_old, $product->id)
    488.             && Product::duplicateAccessories($id_product_old, $product->id)
    489.             && Product::duplicateFeatures($id_product_old, $product->id)
    490.             && Product::duplicateSpecificPrices($id_product_old, $product->id)
    491.             && Pack::duplicate($id_product_old, $product->id)
  • AdminProductsControllerCore->processDuplicate - [line 541 - classes/controller/AdminController.php] - [0 Argument]
    535.             {
    536.                 // Hook before action
    537.                 Hook::exec('actionAdmin'.ucfirst($this->action).'Before', array('controller' => $this));
    538.                 Hook::exec('action'.get_class($this).ucfirst($this->action).'Before', array('controller' => $this));
    539.                 // Call process
    540.                 $return = $this->{'process'.Tools::toCamelCase($this->action)}();
    541.                 // Hook After Action
    542.                 Hook::exec('actionAdmin'.ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
    543.                 Hook::exec('action'.get_class($this).ucfirst($this->action).'After', array('controller' => $this, 'return' => $return));
    544.
    545.                 return $return;
  • AdminControllerCore->postProcess - [line 1171 - controllers/admin/AdminProductsController.php] - [0 Argument]
    1165.      * @return void
    1166.      */
    1167.     public function postProcess()
    1168.     {
    1169.         if (!$this->redirect_after)
    1170.             parent::postProcess();
    1171.
    1172.         if ($this->display == 'edit' || $this->display == 'add')
    1173.         {
    1174.             $this->addjQueryPlugin(array(
    1175.                 'autocomplete',
  • AdminProductsControllerCore->postProcess - [line 158 - classes/controller/Controller.php] - [0 Argument]
    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)))
  • ControllerCore->run - [line 348 - classes/Dispatcher.php] - [0 Argument]
    342.             // Execute hook dispatcher
    343.             if (isset($params_hook_action_dispatcher))
    344.                 Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    345.
    346.             // Running controller
    347.             $controller->run();
    348.         }
    349.         catch (PrestaShopException $e)
    350.         {
    351.             $e->displayMessage();
    352.         }
  • DispatcherCore->dispatch - [line 50 - backoffice/index.php] - [0 Argument]
    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();

Merci,


Charlotte.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...