Jump to content

[PrestaShopException] Property Product->link_rewrite is empty


Fred4

Recommended Posts

Hello everyone,

I can't access my backoffice anymore and whenever I try, this is what I get:

 

[PrestaShopException]

Property Product->link_rewrite is empty
at line 887 in file classes/ObjectModel.php

 

 

Don't know what to think. Worked all day long and got this suddendly. The only thing I changed during the day was the max_input vars from 1000 to 10000 on my server (inside php.ini). After the error I changed it back again to 1000, of course, but with no good results.

Another action I done yesterday was changing some files that a module developer gave to me to get rid of an issue (an auction module)... The strange fact is that everything worked perfectly for many hours after those changes.

 

Any idea?

 

This is the full error:

 

[PrestaShopException]

Property Product->link_rewrite is empty
at line 887 in file classes/ObjectModel.php

881.
882. $message = $this->validateField($field, $value, $id_lang);
883. if ($message !== true)
884. {
885. if ($die)
886. throw new PrestaShopException($message);
887. return $error_return ? $message : false;
888. }
889. }
890. }
891.
ObjectModelCore->validateFieldsLang - [line 301 - classes/ObjectModel.php]
295. {
296. // Retrocompatibility
297. if (method_exists($this, 'getTranslationsFieldsChild'))
298. return $this->getTranslationsFieldsChild();
299.
300. $this->validateFieldsLang();
301. $is_lang_multishop = $this->isLangMultishop();
302.
303. $fields = array();
304. if ($this->id_lang === null)
305. foreach (Language::getLanguages(false) as $language)
ObjectModelCore->getFieldsLang - [line 489 - classes/ObjectModel.php]
483. return false;
484.
485. // Database insertion for multilingual fields related to the object
486. if (!empty($this->def['multilang']))
487. {
488. $fields = $this->getFieldsLang();
489. if ($fields && is_array($fields))
490. {
491. $shops = Shop::getCompleteListOfShopsID();
492. $asso = Shop::getAssoTable($this->def['table'].'_lang');
493. foreach ($fields as $field)
ObjectModelCore->add - [line 510 - classes/Product.php] - [2 Arguments]
504. return $fields;
505. }
506.
507. public function add($autodate = true, $null_values = false)
508. {
509. if (!parent::add($autodate, $null_values))
510. return false;
511.
512. if ($this->getType() == Product::PTYPE_VIRTUAL)
513. {
514. StockAvailable::setProductOutOfStock((int)$this->id, 1);
Argument [0]
1
Argument [1]

ProductCore->add - [line 388 - modules/auction/models/auction.php]
382. $winner_product->visibility = 'none';
383. $winner_product->available_for_order = 1;
384. $this->addPrefixToProductName($winner_product);
385.
386. /* creates product for winner */
387. if (!$winner_product->add()) {
388. return false;
389. }
390.
391. $this->cloneCarriers($product, $winner_product);
392.
SimpleAuctionAuction->addWinner - [line 264 - modules/auction/models/auction.php]
258. /* finishes auction */
259. public function finish()
260. {
261. $this->finished = 1;
262.
263. if (!$this->addWinner()) {
264. return false;
265. }
266.
267. if (!$this->updateDataInDb()) {
268. return false;
SimpleAuctionAuction->finish - [line 710 - modules/auction/models/auction.php]
704.
705. if ($this->use_end_time) {
706. $current_date_timestamp = strtotime(date('Y-m-d H:i:s'));
707. $end_time_timestamp = strtotime($this->end_time);
708. if ($end_time_timestamp <= $current_date_timestamp) {
709. $result = $this->finish();
710.
711. AuctionLog::log(
712. $this,
713. AuctionLog::ACTION_FINISH_AUCTION,
714. $this->module_instance->l('Finish auction', 'auction'),
SimpleAuctionAuction->checkIfEnded - [line 65 - modules/auction/models/auction.php]
59. }
60.
61. $this->product = new Product($this->id_product, false, (int)Configuration::get('PS_LANG_DEFAULT'));
62. $this->state = $this->getAuctionState();
63. $this->current_price = $this->getCurrentPrice();
64. $this->checkIfEnded();
65. } else {
66. $this->date_add = date('Y-m-d H:i:s');
67. }
68. }
69.
SimpleAuctionAuction->__construct - [line 957 - modules/auction/models/auction.php] - [1 Arguments]
951. AND `finished` = "0"
952. AND `id_shop` = "'.(int)Context::getContext()->shop->id.'"
953. ');
954.
955. foreach ($auctions as $auction) {
956. new SimpleAuctionAuction($auction['id']);
957. } // constructor does all the job
958. }
959. }
Argument [0]
141
SimpleAuctionAuction::endFinishedAuctions - [line 1114 - modules/auction/auction.php]
1108. }
1109.
1110. /* Displays notes at backoffice index page */
1111. public function hookDisplayBackOfficeTop()
1112. {
1113. SimpleAuctionAuction::endFinishedAuctions();
1114. $latest_winner_viewed = (int)Configuration::get('auction_LATEST_WINNER_VIEWED', 0);
1115. $auctions = Db::getInstance()->executeS('
1116. SELECT
1117. w.`id`,
1118. w.`price`,
Auction->hookDisplayBackOfficeTop - [line 507 - classes/Hook.php] - [1 Arguments]
501. if ($use_push && isset($moduleInstance->push_filename) && file_exists($moduleInstance->push_filename))
502. Tools::waitUntilFileIsModified($moduleInstance->push_filename, $moduleInstance->push_time_limit);
503.
504. // Call hook method
505. if ($hook_callable)
506. $display = $moduleInstance->{'hook'.$hook_name}($hook_args);
507. elseif ($hook_retro_callable)
508. $display = $moduleInstance->{'hook'.$retro_hook_name}($hook_args);
509. // Live edit
510. if (!$array_return && $array['live_edit'] && Tools::isSubmit('live_edit') && Tools::getValue('ad') && Tools::getValue('liveToken') == Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
511. {
Argument [0]

HookCore::exec - [line 2360 - classes/controller/AdminController.php] - [2 Arguments]
2354.
2355. if ($this->display_header)
2356. $this->context->smarty->assign('displayBackOfficeHeader', Hook::exec('displayBackOfficeHeader', array()));
2357.
2358. $this->context->smarty->assign(array(
2359. 'displayBackOfficeTop' => Hook::exec('displayBackOfficeTop', array()),
2360. 'submit_form_ajax' => (int)Tools::getValue('submitFormAjax')
2361. ));
2362.
2363. $this->initProcess();
2364. $this->initBreadcrumbs();
Argument [0]
displayBackOfficeTop
Argument [1]
Array
(
)

AdminControllerCore->init - [line 163 - classes/controller/Controller.php]
157. /**
158. * Start controller process (this method shouldn't be overriden !)
159. */
160. public function run()
161. {
162. $this->init();
163. if ($this->checkAccess())
164. {
165. // setMedia MUST be called before postProcess
166. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
167. $this->setMedia();
ControllerCore->run - [line 373 - classes/Dispatcher.php]
367. // Execute hook dispatcher
368. if (isset($params_hook_action_dispatcher))
369. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
370.
371. // Running controller
372. $controller->run();
373. }
374. catch (PrestaShopException $e)
375. {
376. $e->displayMessage();
377. }
DispatcherCore->dispatch - [line 54 - admin/index.php]
48. $_POST['controller'] = strtolower($_POST['tab']);
49. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))
50. $_REQUEST['controller'] = strtolower($_REQUEST['tab']);
51.
52. // Prepare and trigger admin dispatcher
53. Dispatcher::getInstance()->dispatch();

 

 

Thanks for any help.

 

Fred

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

According to stacktrace the problem is directly caused by auction module. It tries to close an auction, and creates new product during this procedure. This in turn raises the exception. The reason this problem manifested hours after the last update is probably caused by the auction end date - it was not necessary to close an auction before

 

Talk to the module developer

Edited by DataKick (see edit history)
  • Like 1
Link to comment
Share on other sites

According to stacktrace the problem is directly caused by auction module. It tries to close an auction, and creates new product during this procedure. This in turn raises the exception. The reason this problem manifested hours after the last update is probably caused by the auction end date - it was not necessary to close an auction before

 

Talk to the module developer

 

 

Thank you very much for your answer, I'll get in touch with the module developers about this and let you know how it went.

Link to comment
Share on other sites

Hello,

 

removing the module folder from the server did work.

 

Now, If I don't want to use this module anymore is there a way to get rid of the remaining files since I cant' proceed with a standard uninstallation from the BO (if I put back the folder, also the old one, the system crashes again...)?

 

Thanks for helping me.

Link to comment
Share on other sites

Hello,

 

unfortunately it's hard to say if I don't have module source code.

 

I guess you could try to remove module's hook from db. That way it will not be called during back office initialisation, and you should be able to uninstall it correctly.

 

To remove the hook entry from db, log into your mysql admin and execute following SQL:

DELETE FROM ps_hook_module  
WHERE id_hook = (SELECT id_hook FROM ps_hook WHERE name='displayBackOfficeHeader')
  AND id_module = (SELECT id_module FROM ps_module WHERE name='auction')

hopefully it helps

  • Like 1
Link to comment
Share on other sites

Many thanks for your answer!

 

The query didn't produce any result, so may we suppose that database is already clean?

 

Is there any specific file which I may looking for, inside the module folder, that can help me to track eventual files I must delete?

Link to comment
Share on other sites

Many thanks for your answer!

 

The query didn't produce any result, so may we suppose that database is already clean?

 

Is there any specific file which I may looking for, inside the module folder, that can help me to track eventual files I must delete?

 

generally speaking, deletion of the module directory should be sufficient. However removing the files won't remove entries from database, and that in turn might cause plenty headaches later.

 

I could help you get rid of this module. I would need ftp access to your server, though. Send me a PM if you are interested 

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...