korsakov14 Posted March 13, 2019 Share Posted March 13, 2019 (edited) Hello, I have a problem on my site with de PS version 1.7.5.1 When I increase or decrease the quantity of my product in product page, I recive this errror in logs: Cita *ERROR* v1.7.5.1 2019/03/13 - 16:47:31: Invalid parameter $idAttributes with value: "" at line 6246 in file classes/Product.php The specific code where it fails is the following: Cita public static function getIdProductAttributeByIdAttributes($idProduct, $idAttributes, $findBest = false) { $idProduct = (int) $idProduct; if (!is_array($idAttributes) && is_numeric($idAttributes)) { $idAttributes = array((int) $idAttributes); } if (!is_array($idAttributes) || empty($idAttributes)) { throw new PrestaShopException( sprintf( 'Invalid parameter $idAttributes with value: "%s"', print_r($idAttributes, true) ) ); } These error only occurs in product without attributes. When add attributes works. And I debug mode also works. 😓 Does anyone know any clue as to why this error can be caused? You can test it in https://www.turronartesano.com/es/turrones-de-jijona/turron-jijona-blando-300g Thanks in advance, regards. Edited March 14, 2019 by korsakov14 (see edit history) Link to comment Share on other sites More sharing options...
korsakov14 Posted March 14, 2019 Author Share Posted March 14, 2019 Solved!! it is a bug of the Pretty Urls plugin version 2.2.2 in PS 1.7.5.1. Fixed after replacing the ProductController of the folder /overrides provided by plugin support. (Attached file). I can already increase the quantity of my products without problems 🤗 ProductController.php.txt Link to comment Share on other sites More sharing options...
Vplus Posted March 29, 2019 Share Posted March 29, 2019 its the same content of the file installed. Are you sure its the correct file you added? Link to comment Share on other sites More sharing options...
Vplus Posted March 29, 2019 Share Posted March 29, 2019 On 3/14/2019 at 1:23 PM, korsakov14 said: Solved!! it is a bug of the Pretty Urls plugin version 2.2.2 in PS 1.7.5.1. Fixed after replacing the ProductController of the folder /overrides provided by plugin support. (Attached file). I can already increase the quantity of my products without problems 🤗 ProductController.php.txt its the file as the server. nothing change 1 Link to comment Share on other sites More sharing options...
korsakov14 Posted March 29, 2019 Author Share Posted March 29, 2019 Sorry, you're right. This is the right one: <?php /** * FMM PrettyURLs * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * * @category FMM Modules * @package PrettyURLs * @author FMM Modules * @copyright Copyright 2016 © Fmemodules All right reserved * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ class ProductController extends ProductControllerCore { public function init() { $link_rewrite = Tools::safeOutput(urldecode(Tools::getValue('product_rewrite'))); $prod_pattern = '/.*?\/([0-9]+)\-([_a-zA-Z0-9-\pL]*)\.html/'; preg_match($prod_pattern, $_SERVER['REQUEST_URI'], $url_array); if (isset($url_array[2]) && $url_array[2] != '') $link_rewrite = $url_array[2]; if ($link_rewrite) { $id_lang = $this->context->language->id; $id_shop = $this->context->shop->id; $sql = 'SELECT id_product FROM '._DB_PREFIX_.'product_lang WHERE link_rewrite = \''.pSQL($link_rewrite).'\' AND id_lang = '.(int)$id_lang.' AND id_shop = '.(int)$id_shop; $id_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_product > 0) { $_POST['id_product'] = $id_product; $_GET['product_rewrite'] = ''; } else { $prod_pattern_sec = '/.*?\/([0-9]+)\-([_a-zA-Z0-9-\pL]*\-[0-9\pL]*)\.html/'; preg_match($prod_pattern_sec, $_SERVER['REQUEST_URI'], $url_array_sec); if (isset($url_array_sec[2]) && $url_array_sec[2] != '') { $segments = explode('-', $url_array_sec[2]); array_pop($segments); $link_rewrite = implode('-', $segments); } $sql = 'SELECT id_product FROM '._DB_PREFIX_.'product_lang WHERE link_rewrite = \''.pSQL($link_rewrite).'\' AND id_lang = '.(int)$id_lang.' AND id_shop = '.(int)$id_shop; $id_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_product > 0) { $_POST['id_product'] = $id_product; $_GET['product_rewrite'] = ''; } } } parent::init(); } } Link to comment Share on other sites More sharing options...
hitabnet Posted July 11, 2019 Share Posted July 11, 2019 Hello, I have the same problem and i am using same module. Can you please describe more clearly on which file you edited? Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now