Acer Posted November 30, 2020 Posted November 30, 2020 Hi I've encountered a bug where Customised Product Feature Values are not being saved in Admin. Presaved features work, but it's impractical to create a value every single time first. This occurs on three of my sites, one on TB edge and the other two on 1.1.0. Using different browsers doesn't appear to be making a difference. Has anyone encountered this one before and is there maybe a code fix I can implement?
AndyC Posted November 30, 2020 Posted November 30, 2020 Are you using the TB built in customisation or a module and are there costs involved I have a module that does just this sometimes
Acer Posted November 30, 2020 Author Posted November 30, 2020 43 minutes ago, AndyC said: Are you using the TB built in customisation or a module and are there costs involved I have a module that does just this sometimes It's the built-in TB product features one. Calling in the air-support, or Orbital Ion Cannon, if you will... 😉 @datakick @Traumflug
datakick Posted December 1, 2020 Posted December 1, 2020 @Theo please show some screenshots, I don't really understand what the problem is
Acer Posted December 1, 2020 Author Posted December 1, 2020 36 minutes ago, datakick said: @Theo please show some screenshots, I don't really understand what the problem is On a product features tab, enter a customised value: After save, value remains blank, like it did not save:
Acer Posted December 1, 2020 Author Posted December 1, 2020 (edited) 6 hours ago, datakick said: Works fine for me I've checked the logs and it appears to be filling up with this error when I try to add a custom product feature value: [Tue Dec 01 12:47:23.753602 2020] [php7:warn] [pid 18120:tid 1916] [client ::1:52514] PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 55 in C:\\xamppnew\\htdocs\\development\\testsite\\classes\\Dispatcher.php on line 936, referer: http://localhost/development/testsite/admin3419jgisg/index.php?controller=AdminProducts&id_product=119&updateproduct&conf=4&key_tab=Features&token=ddb9b6bb5c007d48060cae23004fd3ec This is line 936 in my Dispatcher.php if (preg_match($route['regexp'], $uri, $m)) { This is the code I have in the Override/classes/Dispatcher.php file <?php class Dispatcher extends DispatcherCore { /* * module: sturls * date: 2020-07-09 07:23:13 * version: 1.0.0 */ protected function __construct() { if (Module::isEnabled('sturls')) { $module_inst = Module::getInstanceByName('sturls'); $this->default_routes = array_merge($module_inst->hookModuleRoutes([]), $this->default_routes); } parent::__construct(); } /* * module: sturls * date: 2020-07-09 07:23:13 * version: 1.0.0 */ protected function loadRoutes($id_shop = null) { if ($id_shop === null) { $id_shop = (int)Context::getContext()->shop->id; } parent::loadRoutes($id_shop); if (Module::isEnabled('sturls')) { $module = Module::getInstanceByName('sturls'); $language_ids = Language::getIDs(true, $id_shop); foreach($language_ids as $id_lang) { foreach($module->lang_field as $k => $v) { $route_lang = Configuration::get($module->_prefix_st.strtoupper($k), $id_lang); if ($v != $route_lang) { foreach($this->default_routes as $route_id => $route) { if (strpos($route['rule'], $v.'/') !== false || $route['rule'] == $v) { if ($route['rule'] == $v) { $rule = str_replace($v, $route_lang, $route['rule']); } else { $rule = str_replace($v.'/', $route_lang.'/', $route['rule']); } $this->addRoute( $route_id, $rule, $route['controller'], $id_lang, $route['keywords'], isset($route['params']) ? $route['params'] : array(), $id_shop ); } } } } } } } } Initially I thought that it could be the "multiple values for a feature" module that I'm using, but I've since disabled that and I'm still getting this error... Any ideas? Edited December 1, 2020 by Theo
yaniv14 Posted December 4, 2020 Posted December 4, 2020 (edited) Make sure your override is really not being used. rename or remove the file override/classes/dispatcher.php completely from the override folder, and delete file cache/class_index.php and then check again. Edited December 4, 2020 by yaniv14
Acer Posted December 4, 2020 Author Posted December 4, 2020 Thanks for this. Seems like this dispatcher override is being used... On a Local version of the site, after trying a few things (and bombing the site), I eventually restored the Modules folder from an old (recent enough) backup. An lo and behold, it could save custom values for a feature again 😕 Wtf... Unfortunately I can't try this shit on Live though as it's technically a different branch and its backups have this bug. Probably going to be one of those weird unsolved mysteries... Not ideal... However, does this not assist in giving a clue perhaps: ?I've checked the logs and it appears to be filling up with this error when I try to add a custom product feature value: [Tue Dec 01 12:47:23.753602 2020] [php7:warn] [pid 18120:tid 1916] [client ::1:52514] PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 55 in C:\\xamppnew\\htdocs\\development\\testsite\\classes\\Dispatcher.php on line 936, referer: http://localhost/development/testsite/admin3419jgisg/index.php?controller=AdminProducts&id_product=119&updateproduct&conf=4&key_tab=Features&token=ddb9b6bb5c007d48060cae23004fd3ec This is line 936 in my Dispatcher.php if (preg_match($route['regexp'], $uri, $m)) { Either way, I appreciate the assistance @yaniv14
yaniv14 Posted December 5, 2020 Posted December 5, 2020 The error probably caused because of regex expression that your php version unable to interpret. If you are on php version 7.3 or above, try to downgrade to php 7.2 just to see if the error resolved.
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