MrWade Posted February 21 Share Posted February 21 Yes, I am using the Classic Core Theme version 8..1.7 I have about 24 products on featured and also on the main root. My question is it shows 24 on the main root display 8 on the main page. Every time I refresh the page it doesn't randomly changes products. How can I fix this? 1 Link to comment Share on other sites More sharing options...
Daresh Posted February 21 Share Posted February 21 It is like that because of caching. A workaround is to send all 24 products to the template, then shuffle them and cut to 8. It requires some changes to the TPL file. Link to comment Share on other sites More sharing options...
MrWade Posted February 21 Author Share Posted February 21 1 hour ago, Daresh said: It is like that because of caching. A workaround is to send all 24 products to the template, then shuffle them and cut to 8. It requires some changes to the TPL file. Where is the file and what is the code?? Link to comment Share on other sites More sharing options...
MrWade Posted February 22 Author Share Posted February 22 Is there anyone can help me in this area? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 22 Share Posted February 22 I hope you are using the default featured products module of the Pretashop. Have you enabled the "Randomly display featured products" in the featured module? 1 Link to comment Share on other sites More sharing options...
MrWade Posted February 22 Author Share Posted February 22 5 hours ago, Knowband Plugins said: I hope you are using the default featured products module of the Pretashop. Have you enabled the "Randomly display featured products" in the featured module? It's already like that. It's not randomly or shuffling the products. Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 22 Share Posted February 22 Ideally, it should not. In that case, there can be the following possibilities 1. Cache issue 2. The selected category does not have enough products 3. Home page use the other module instead of this feature module? Do you have the site URL to share ? Link to comment Share on other sites More sharing options...
MrWade Posted February 22 Author Share Posted February 22 27 minutes ago, Knowband Plugins said: Ideally, it should not. In that case, there can be the following possibilities 1. Cache issue 2. The selected category does not have enough products 3. Home page use the other module instead of this feature module? Do you have the site URL to share ? Yes, its: https://www.galaxyhomedecor.us Link to comment Share on other sites More sharing options...
Daresh Posted February 22 Share Posted February 22 Like I said before, it's cache. But not any issue but this module simply works this way. The randomization occurs when the module content gets generated, but before it's cached. So by default, you will never have a random effect on every page refresh with this module, just on every cache refresh. Link to comment Share on other sites More sharing options...
MrWade Posted February 22 Author Share Posted February 22 1 hour ago, Daresh said: Like I said before, it's cache. But not any issue but this module simply works this way. The randomization occurs when the module content gets generated, but before it's cached. So by default, you will never have a random effect on every page refresh with this module, just on every cache refresh. Well, the cache is enable in the back office. Then I clear the cache on my browsers. Still no change. Here is the setting in the back office for caching. Link to comment Share on other sites More sharing options...
MrWade Posted February 23 Author Share Posted February 23 Anyone! Link to comment Share on other sites More sharing options...
ps8modules Posted February 23 Share Posted February 23 Hi. Somehow I do not understand: Quote My question is that it shows 24 in the main root display 8 in the main page. Do you have two modules? Maybe editing the module and inserting the PHP function shuffle($products) will help Link to comment Share on other sites More sharing options...
MrWade Posted February 23 Author Share Posted February 23 (edited) 4 minutes ago, ps8modules said: Hi. Somehow I do not understand: Do you have two modules? Maybe editing the module and inserting the PHP function shuffle($products) will help Actually, I am using just one module and its the Featured Products for the main page. Edited February 23 by MrWade (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted February 23 Share Posted February 23 (edited) You need to check the database in the ps_configuration table what the value for 'HOME_FEATURED_RANDOMIZE' is. SELECT a.value FROM ps_configuration a WHERE a.name = 'HOME_FEATURED_RANDOMIZE'; The value should be 1. The module is probably not enabled at the moment. It is not visible on the main page. Or you can edit the module and insert the shuffle function: ./modules/ps_featuredproducts/ps_featuredproducts.php Edited February 23 by ps8modules (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted February 23 Share Posted February 23 Clearing browser cache nas nothing to do with it, I bet that after you clear PrestaShop cache, order of products changes. Link to comment Share on other sites More sharing options...
MrWade Posted February 23 Author Share Posted February 23 19 minutes ago, ps8modules said: You need to check the database in the ps_configuration table what the value for 'HOME_FEATURED_RANDOMIZE' is. SELECT a.value FROM ps_configuration a WHERE a.name = 'HOME_FEATURED_RANDOMIZE'; The value should be 1. The module is probably not enabled at the moment. It is not visible on the main page. Or you can edit the module and insert the shuffle function: ./modules/ps_featuredproducts/ps_featuredproducts.php Well adding that shuffle didn't work. It show one image with no image at all. So I had to remove the shuffle code. Link to comment Share on other sites More sharing options...
Daresh Posted February 23 Share Posted February 23 If you really need to have it random on each page load, you may try to disable cache use in the module: public function renderWidget($hookName = null, array $configuration = []) { //if (!$this->isCached($this->templateFile, $this->getCacheId('ps_featuredproducts'))) { $variables = $this->getWidgetVariables($hookName, $configuration); if (empty($variables)) { return false; } $this->smarty->assign($variables); //} return $this->fetch($this->templateFile); //return $this->fetch($this->templateFile, $this->getCacheId('ps_featuredproducts')); } 1 Link to comment Share on other sites More sharing options...
MrWade Posted February 23 Author Share Posted February 23 (edited) 5 hours ago, Daresh said: If you really need to have it random on each page load, you may try to disable cache use in the module: public function renderWidget($hookName = null, array $configuration = []) { //if (!$this->isCached($this->templateFile, $this->getCacheId('ps_featuredproducts'))) { $variables = $this->getWidgetVariables($hookName, $configuration); if (empty($variables)) { return false; } $this->smarty->assign($variables); //} return $this->fetch($this->templateFile); //return $this->fetch($this->templateFile, $this->getCacheId('ps_featuredproducts')); } Sorry, I just tried that. It didn't work. It removed the module from the main page. Edited February 23 by MrWade (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted February 23 Share Posted February 23 Did you replace the function with the one that I sent? What is the version of your module? Link to comment Share on other sites More sharing options...
ps8modules Posted February 23 Share Posted February 23 (edited) The problem will be elsewhere. As soon as he returned the code of the module, everything changed on the main page and after a while it stopped. So now the question is, does it happen to have some extra cache module installed, or does the web hosting have its own cache. It's easy to write that it doesn't work, but we can't see if you've edited the function correctly. We don't see how the module is set. Edited February 23 by ps8modules (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted February 23 Share Posted February 23 The store looks quite simple with the Classic theme used. And the "Featured products" module never displays random products on each page refresh if smarty cache is enabled. So I would still follow this path. Link to comment Share on other sites More sharing options...
MrWade Posted February 23 Author Share Posted February 23 2 minutes ago, Daresh said: The store looks quite simple with the Classic theme used. And the "Featured products" module never displays random products on each page refresh if smarty cache is enabled. So I would still follow this path. How can I make it work. Link to comment Share on other sites More sharing options...
Daresh Posted February 23 Share Posted February 23 You must have done something wrong with the code that I pasted. Please attach your ps_featuredproducts.php here Link to comment Share on other sites More sharing options...
MrWade Posted February 23 Author Share Posted February 23 (edited) 47 minutes ago, Daresh said: Did you replace the function with the one that I sent? What is the version of your module? My version is v2.1.5 and yes I did try your code and disable the cache I got a blank featured module. When I went back to the original code the module is back on the screen. Edited February 23 by MrWade (see edit history) Link to comment Share on other sites More sharing options...
MrWade Posted February 24 Author Share Posted February 24 19 hours ago, ps8modules said: You need to check the database in the ps_configuration table what the value for 'HOME_FEATURED_RANDOMIZE' is. SELECT a.value FROM ps_configuration a WHERE a.name = 'HOME_FEATURED_RANDOMIZE'; The value should be 1. The module is probably not enabled at the moment. It is not visible on the main page. Or you can edit the module and insert the shuffle function: ./modules/ps_featuredproducts/ps_featuredproducts.php I don't see the HOME_FEATURED_RANDOMIZE in the ps_configuration in MySQL. Link to comment Share on other sites More sharing options...
ps8modules Posted February 24 Share Posted February 24 https://www.prestashop.com/forums/topic/1095666-need-help-with-home-featured-products-randomly/?do=findComment&comment=3519630 When you turn on Randomize and save, does it stay on? Exactly as he advised you! Link to comment Share on other sites More sharing options...
MrWade Posted February 24 Author Share Posted February 24 2 minutes ago, ps8modules said: https://www.prestashop.com/forums/topic/1095666-need-help-with-home-featured-products-randomly/?do=findComment&comment=3519630 When you turn on Randomize and save, does it stay on? Exactly as he advised you! I already tried that. Products doesn't shuffle or randomly change each time I refresh the browser. Link to comment Share on other sites More sharing options...
ps8modules Posted February 24 Share Posted February 24 We are interested in whether the settings in the module are saved. If the setting is saved, the value must be written to ps_configuration. If it doesn't register, it can't display randomly. Link to comment Share on other sites More sharing options...
MrWade Posted February 24 Author Share Posted February 24 1 minute ago, ps8modules said: We are interested in whether the settings in the module are saved. If the setting is saved, the value must be written to ps_configuration. If it doesn't register, it can't display randomly. According to my end (Back office) its show that is saved in module itself. Link to comment Share on other sites More sharing options...
ps8modules Posted February 24 Share Posted February 24 If you don't do what we ask you to do here, we can't help. There is printScr (print screen) on the keyboard, when you give us a picture of the ps_homefeatured module settings. Link to comment Share on other sites More sharing options...
MrWade Posted February 24 Author Share Posted February 24 3 minutes ago, ps8modules said: If you don't do what we ask you to do here, we can't help. There is printScr (print screen) on the keyboard, when you give us a picture of the ps_homefeatured module settings. Link to comment Share on other sites More sharing options...
ps8modules Posted February 24 Share Posted February 24 Please go to the module settings page in the e-shop administration. Modules -> Module Manager -> Featured products (Configure) Link to comment Share on other sites More sharing options...
MrWade Posted February 24 Author Share Posted February 24 23 minutes ago, ps8modules said: Please go to the module settings page in the e-shop administration. Modules -> Module Manager -> Featured products (Configure) Here is my settings for the Featured Products Module. Link to comment Share on other sites More sharing options...
Daresh Posted February 24 Share Posted February 24 Does the order of products change after you go to Advanced -> Performance and clear PrestaShop cache? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 24 Share Posted February 24 Change the renderWidget Function & Use the below code. public function renderWidget($hookName = null, array $configuration = []) { //if (!$this->isCached($this->templateFile, $this->getCacheId('ps_featuredproducts'))) { $variables = $this->getWidgetVariables($hookName, $configuration); if (empty($variables)) { return false; } $this->smarty->assign($variables); //} return $this->fetch($this->templateFile); } Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 24 Share Posted February 24 19 hours ago, MrWade said: This solution should work. Link to comment Share on other sites More sharing options...
ps8modules Posted February 24 Share Posted February 24 I have already remotely connected and modified the free module. Now everything works 😉 1 Link to comment Share on other sites More sharing options...
MrWade Posted February 25 Author Share Posted February 25 Ok I got the module going thanks to ps8modules for helping me. Now, how can I make the home featured products image full width of the mobile version and the font bigger too? Link to comment Share on other sites More sharing options...
ps8modules Posted February 25 Share Posted February 25 (edited) https://help-center.prestashop.com/hc/en-us/articles/18898613995026-Customize-your-site-s-CSS ./themes/classic/assets/css/custom.css @media (max-width:499px) { .page-index .product, .page-search .product { width: 100% !important; min-width: 250px } .page-index .product-miniature .thumbnail-container, .page-search .product-miniature .thumbnail-container { width: 100% !important; } } Edited February 25 by ps8modules updated CSS (see edit history) Link to comment Share on other sites More sharing options...
MrWade Posted February 25 Author Share Posted February 25 8 hours ago, ps8modules said: https://help-center.prestashop.com/hc/en-us/articles/18898613995026-Customize-your-site-s-CSS ./themes/classic/assets/css/custom.css @media (max-width:499px) { .page-index .product-miniature .product, .page-search .product-miniature .product { width: 100%; min-width: 250px } .page-index .product-miniature .thumbnail-container, .page-search .product-miniature .thumbnail-container { width: 100% !important; } } custom.css 338 B · 0 downloads Ok, no change. Link to comment Share on other sites More sharing options...
ps8modules Posted February 25 Share Posted February 25 (edited) And again, we don't know if you uploaded everything correctly and to the right folder on FTP. And we don't know if you used the magic button in the performance settings "Clear cache". Edited February 25 by ps8modules (see edit history) Link to comment Share on other sites More sharing options...
MrWade Posted February 25 Author Share Posted February 25 6 minutes ago, ps8modules said: And again, we don't know if you uploaded everything correctly and to the right folder on FTP. And we don't know if you used the magic button in the performance settings "Clear cache". I did all that and yes it is in the right folder. Link to comment Share on other sites More sharing options...
ps8modules Posted February 25 Share Posted February 25 He didn't. If you did, the style is visible in the Inspector. Link to comment Share on other sites More sharing options...
MrWade Posted February 25 Author Share Posted February 25 2 minutes ago, ps8modules said: He didn't. If you did, the style is visible in the Inspector. That is what I put in the custom.css file and NO change. Link to comment Share on other sites More sharing options...
ps8modules Posted February 25 Share Posted February 25 Link to comment Share on other sites More sharing options...
Knowband Plugins Posted February 25 Share Posted February 25 @ps8modules, I think shared CSS is not correct. I can't see a matching tag related to the selector. .page-index .product-miniature .product 1 Link to comment Share on other sites More sharing options...
ps8modules Posted February 25 Share Posted February 25 (edited) @media (max-width:499px) { .page-index .product, .page-search .product { width: 100%; min-width: 250px; } .page-index .product-miniature .thumbnail-container, .page-search .product-miniature .thumbnail-container { width: 100% !important; } } The problem is that you are editing the styles directly in theme.css. You can tell by the fact that your css is decompressed. Edited February 25 by ps8modules (see edit history) Link to comment Share on other sites More sharing options...
MrWade Posted February 25 Author Share Posted February 25 5 minutes ago, ps8modules said: @media (max-width:499px) { .page-index .product, .page-search .product { width: 100%; min-width: 250px; } .page-index .product-miniature .thumbnail-container, .page-search .product-miniature .thumbnail-container { width: 100% !important; } } That did it, Thank you. 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