botmez Posted December 21, 2013 Share Posted December 21, 2013 Hello I have a theme in my prestashop 1.5.6. installation: my website.mytheme I have a folder in this folder named mobile -> my website/mytheme/mobile I would like to hide some modules to customers when they access to my website with their mobile or tablet. How can I do ? thanks Link to comment Share on other sites More sharing options...
Ray UK Posted December 22, 2013 Share Posted December 22, 2013 I have done this with some of my modules and believe there should be an option to show/hide each module with using mobile device. This is my code for the testimonials block. (inside the main .tpl in the modules folder) {if FrontController::ismobile()==true} {else} <!-- Block testimonial module --> <div id="block_testimonials" class="block"> <h4><a href="{$this_path}testimonials.php">{l s='Testimonials' mod='blockTestimonial'}</a></h4> <div id="randomtestimonial"> <p class="testimonialSpeech" >"<a href="{$this_path}testimonials.php#{$randomTestimonialid}">{$randomTestimonialtxt|strip_tags|truncate:180:'...'}</a>"</p> </div> <div align="center" class="blocktestimonial"> <a class="button_large" href="{$this_path}addtestimonial.php">{l s='Add Your Testimonial' mod='blockTestimonial'}</a> </div> </div> <!-- /Block testimonial module --> {/if} basically, I added this before the code {if FrontController::ismobile()==true} {else} and at the end of all the code {/if} So it says, if the device is mobile, show nothing, else show the code I don't think it can be used on anything that uses the smart cache though. Because if you browse on a desktop the cache is created, then browse the same page on a mobile and the cache is used (instead of using the "don't show" code) So for instance, I had to use conditional css rules to hide my blocktopmenu Hope this helps Link to comment Share on other sites More sharing options...
Ray UK Posted December 22, 2013 Share Posted December 22, 2013 Ahhh, just noticed in the new upcoming 1.6, there is that option Happy days ! Link to comment Share on other sites More sharing options...
botmez Posted December 22, 2013 Author Share Posted December 22, 2013 but for all store running on 1.5 its the only way ? Thanks for the code !!! Link to comment Share on other sites More sharing options...
botmez Posted December 23, 2013 Author Share Posted December 23, 2013 Any other idea ! the problem with the real page visited and mobile page visited is true So for instance, I had to use conditional css rules to hide my blocktopmenu => how can I do ? Link to comment Share on other sites More sharing options...
botmez Posted January 11, 2014 Author Share Posted January 11, 2014 HELPPPP ! Link to comment Share on other sites More sharing options...
botmez Posted January 18, 2014 Author Share Posted January 18, 2014 000 Link to comment Share on other sites More sharing options...
botmez Posted January 23, 2014 Author Share Posted January 23, 2014 up !! Link to comment Share on other sites More sharing options...
botmez Posted January 23, 2014 Author Share Posted January 23, 2014 this tech nik doesn't work for mle {if FrontController::ismobile()==true} WHITE PAGE Link to comment Share on other sites More sharing options...
vekia Posted January 23, 2014 Share Posted January 23, 2014 it's because default FrontCOntroller hasn't got function isMobile(); Link to comment Share on other sites More sharing options...
pietror1993 Posted December 23, 2014 Share Posted December 23, 2014 so how can we get the function isMobile(); to the FrontController vekia? 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