RufusM Posted February 4, 2019 Share Posted February 4, 2019 Hi everyone. The module Products in the same category is not displaying correctly on my website. Only shows the first product and after that only the image. I did a quick search and someone already has a issue and reported as a bug but i tried to make the necessary file changes to correct the issue but with no success. Link to bug report: https://github.com/PrestaShop/ps_categoryproducts/issues/5 If i disable the cache it works just fine, but i need cache enabled. Any tip are appreciated. Thanks in advance. Alex Link to comment Share on other sites More sharing options...
Shawn40 Posted August 29, 2019 Share Posted August 29, 2019 Same problem here. Anyone knows how to fix it? Thank you Link to comment Share on other sites More sharing options...
Monovolador Posted September 2, 2019 Share Posted September 2, 2019 Same problem with last version of prestashop. On github can't reproduce the error ... https://github.com/PrestaShop/PrestaShop/issues/14967 Does this module work for someone? Link to comment Share on other sites More sharing options...
direwald Posted September 2, 2019 Share Posted September 2, 2019 (edited) Quick and dirty fix could be to disable caching for this specific module. Don't think you can do that from BO, you'd have to do some code changes. I remember doing it somewhere, I'll try to remember the exact steps and update this post. EDIT: So I found I was modifying a different module and it was on PS 1.6, but I checked the ps_categoryproducts module and it might be similar. Seems to me that the caching is checked in the function renderWidget in ps_categoryproducts.php public function renderWidget($hookName = null, array $configuration = array()) { $params = $this->getInformationFromConfiguration($configuration); if ($params) { if ((int)Configuration::get('CATEGORYPRODUCTS_DISPLAY_PRODUCTS') > 0) { // Need variables only if this template isn't cached if (!$this->isCached($this->templateFile, $params['cache_id'])) { if (!empty($params['id_category'])) { $category = new Category($params['id_category']); } if (empty($category) || !Validate::isLoadedObject($category) || !$category->active) { return false; } $variables = $this->getWidgetVariables($hookName, $configuration); if (empty($variables)) { return false; } $this->smarty->assign($variables); } return $this->fetch( $this->templateFile, $params['cache_id'] ); } } return false; } If you change this part return $this->fetch( $this->templateFile, $params['cache_id'] ); To this (if I understand it correctly, this should return invalid cache_id and thus force it load the template as if cache was disabled) return $this->fetch( $this->templateFile, 'cache_id' ); It might work. But I wouldn't bet my life on it, I have no way of testing this. Maybe someone with more experience can help out with this. Edited September 2, 2019 by direwald (see edit history) Link to comment Share on other sites More sharing options...
Shawn40 Posted September 2, 2019 Share Posted September 2, 2019 hace 2 minutos, direwald dijo: Quick and dirty fix could be to disable caching for this specific module. Don't think you can do that from BO, you'd have to do some code changes. I remember doing it somewhere, I'll try to remember the exact steps and update this post. Yeah! It sounds a bit dirty but it could work. It would be great if you can remember those steps and post them. Thanks mate! 😜 Link to comment Share on other sites More sharing options...
direwald Posted September 2, 2019 Share Posted September 2, 2019 Updated my previous post but I'm not sure if it's gonna work. Might be a start for someone more knowledgable though. Link to comment Share on other sites More sharing options...
Shawn40 Posted September 2, 2019 Share Posted September 2, 2019 hace 7 minutos, direwald dijo: Updated my previous post but I'm not sure if it's gonna work. Might be a start for someone more knowledgable though. I have tried but it doesn't work for me. Anyway thank you very much for your input. Let's see if someone can help us Link to comment Share on other sites More sharing options...
direwald Posted September 2, 2019 Share Posted September 2, 2019 I'd imagine you could also change this if condition // Need variables only if this template isn't cached if (!$this->isCached($this->templateFile, $params['cache_id'])) { . . . . . to be always true (or just remove the if altogether) so the following code always happens, as that seems to handle caching as well. Link to comment Share on other sites More sharing options...
ilisiaraul Posted June 17, 2020 Share Posted June 17, 2020 Anybody know how to display newest products first? 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