Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • First Name
  • Last Name

Dreeuwtje's Achievements


Newbie (1/14)



  1. Since i've reinstalled Prestashop 1.7 (a rebuild for a 1.6 site) i'm encountering lots of status 500 errors when modifying products. When loading the product page (product/form/id/...) there is 500 errors on some json pages, like index.php/attribute/get-all, /index.php/specific-price/list/, index.php/combination/product-combinations, (randomly, not always all of them) which causes the page not to function. When loading the json pages seperately the problem doesn't occur. The problem exists on all product pages. Subsequently, when saving a change, the 500 error occurs on the save url (POST) /admin/index.php/product/form/... url as well - about 60% of all requests. The 500 errors seems to be caused by a max_user_connnections mysql error: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1203] User (...) already has more than 'max_user_connections' active connections in (...)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:43 Stack trace: #0 (...)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct((...)) #1 (...)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(44): Doctrine\DBAL\Driver\PDOConnection->__construct(...) #2 (...)/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect(...) #3 (...)/vendor/twig/twig/lib/Twig/Loader/Chain.php on line 129 Thinking a raise of the allowed connections would fix the problem, i've contacted the hosting provider, but they reckon it is not a common (Prestashop) issue, and the limit they maintain should be sufficient. (I'm not sure what the limit is). Doing some research i found that it could be a over eager crawler/bot, so i've disallowed all in robots.txt - without any improvement. (And it also happens locally bt==. Also, i do not think it is caused by any third-party modules, since i've only installed a single payment module. Is anyone familiair with this problem? What could cause this issue and how could it be solved? Love to hear. Laura
  2. I took a minute to fix it myself diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 957d538..51285de 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php [spam-filter] -1656,14 +1656,33 [spam-filter] class AdminProductsControllerCore extends AdminController if ($this->tabAccess['edit'] === '0') { return die(Tools::jsonEncode(array('error' => $this->l('You do not have the right permission')))); } + + $res = true; + Image::deleteCover((int)Tools::getValue('id_product')); $img = new Image((int)Tools::getValue('id_image')); + $img->cover = 1; @unlink(_PS_TMP_IMG_DIR_.'product_'.(int)$img->id_product.'.jpg'); @unlink(_PS_TMP_IMG_DIR_.'product_mini_'.(int)$img->id_product.'_'.$this->context->shop->id.'.jpg'); - if ($img->update()) { + + $res &= Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'image` + SET `cover` = 1 + WHERE `id_product` = '.(int)Tools::getValue('id_product').' AND id_image = '.(int)Tools::getValue('id_image').';' + ); + $res &= Db::getInstance()->execute(' + UPDATE `'._DB_PREFIX_.'image_shop` image_shop + SET image_shop.`cover` = 1 + WHERE image_shop.id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).') AND image_shop.`id_product` = '.(int)Tools::getValue('id_product') .' AND id_image = '.(int)Tools::getValue('id_image').';' + ); + + $res &= $img->update(); + + if ($res) { $this->jsonConfirmation($this->_conf[26]); } else {
  3. Hi, I upgraded to the latest version ( and notice that it is no longer possible to change the cover images on a product when changing it for all shops at once. When changing the image for a single shop it works fine (the specific entry in the table shop_image is updated). But if no specific shop is selected (i want to have the same cover image for all shops), all entries in shop_image are set to NULL. In table 'image' the entry is correctly updated, but this does not seem to be used (in the backend nor on the frontend). Can we have a fix for that? Note: i'm not sure until which version it did work. Regards, Dreeuwtje
  • Create New...