damian5000 Posted September 30, 2013 Share Posted September 30, 2013 (edited) I found this http://www.prestashop.com/forums/topic/16221-tips-random-tag/, but it's from 2009.... The issue is that i need to allow 30 tags to get them all to show. Otherwise it's the same 10 every time and they never change.... Edited October 10, 2013 by damian5000 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 thread that you pasted is related to old prestashop version (1.2) you can use shuffle() function on array to dispaly tags randomly. in module back office configuration page you can define number of displayed tags Link to comment Share on other sites More sharing options...
damian5000 Posted September 30, 2013 Author Share Posted September 30, 2013 Can you show me what the actual 'shuffle' code would look like and where it would go. It's really strange this isn't default Presta behavior. Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 Tags are displayed from most to rarely used tag. in blocktags.php right after $tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR'))); code add simple code: shuffle($tags) example: function hookLeftColumn($params) { $tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR'))); shuffle($tags); 1 Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 hello i've noticed that you marked this thread as solved, you used my solution above ? Link to comment Share on other sites More sharing options...
damian5000 Posted September 30, 2013 Author Share Posted September 30, 2013 This works, but they remain the same size as they did when they were in order. Example, if '1 GB' is most used tag, it shows up as biggest, even though it's half way down the list when using shuffle function and it always shows up as biggest (i'm assuming until it's no longer the most used tag). Is there anyway to easily randomize sizes as well? Link to comment Share on other sites More sharing options...
vekia Posted September 30, 2013 Share Posted September 30, 2013 well it is possible but you will have to change php code once again. instead of: $tag['class'] = 'tag_level'.(int)(($tag['times'] - $min) * $coef + 1); use this: $tag['class'] = 'tag_level'.(int)((rand(1,10) - $min) * $coef + 1); 1 Link to comment Share on other sites More sharing options...
damian5000 Posted October 5, 2013 Author Share Posted October 5, 2013 well it is possible but you will have to change php code once again. instead of: $tag['class'] = 'tag_level'.(int)(($tag['times'] - $min) * $coef + 1); use this: $tag['class'] = 'tag_level'.(int)((rand(1,10) - $min) * $coef + 1); Hi Vekia, Finally got around to implementing this. Changing this code makes the tags all the same size now. Any ideas? Link to comment Share on other sites More sharing options...
vekia Posted October 6, 2013 Share Posted October 6, 2013 hello try to change (decrease / increase) values in: rand(1,10) Link to comment Share on other sites More sharing options...
damian5000 Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) hello try to change (decrease / increase) values in: rand(1,10) Yes, you're correct. The issue was that change isn't triggered until 18+. I can't believe I just spent an hour of trial and error figuring what triggers what size, but I'm OCD like that. So here it is for anyone who needs it. I'll use 1-22. This will mostly be small grey, then trigger about 25% of the tags to 'pop' (2nd pic). Actually I like the way the more random sizes (1st pic) looks, but it pushes the footer adsense too far down because of the bigger fonts, and I doubt it's any more effective. The 2nd pic is actually probably more effective. Too many random sizes (1st pic) becomes a jumble, even though it looks cooler. Thanks again Vekia. Edited October 10, 2013 by damian5000 (see edit history) Link to comment Share on other sites More sharing options...
Adam Akhirat Posted February 12, 2014 Share Posted February 12, 2014 hello.. thanks for all the solutions..it works like charm =D I wanna ask, i have about 450 tags, but i dont think i will display all 450 in 1 time,.. i set to 40 tags only(and setting to randomly), but, it just appear the same 40 tags only.. how if i wanna changes different tags randomly including all tags that i have while 40 tags appear in 1 time only? sorry my english.hope you all undertand what im trying to ask =D Link to comment Share on other sites More sharing options...
Adam Akhirat Posted February 16, 2014 Share Posted February 16, 2014 hello.. thanks for all the solutions..it works like charm =D I wanna ask, i have about 450 tags, but i dont think i will display all 450 in 1 time,.. i set to 40 tags only(and setting to randomly), but, it just appear the same 40 tags only.. how if i wanna changes different tags randomly including all tags that i have while 40 tags appear in 1 time only? sorry my english.hope you all undertand what im trying to ask =D help me please =D Link to comment Share on other sites More sharing options...
Recommended Posts