Jump to content

[v1.6.1.5] [SOLVED] Do not show part of footer if mobile


Nandos

Recommended Posts

Hi guys!

Recently i added some custom parts (images and a script so far) to the footer, adding a new div and blablabla... What i want now is to not show some custom code if the site is opened in mobile version. How i can do that?

That's the current code into footer.tpl file (default 1.6.1.5 theme)

{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2016 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{if !isset($content_only) || !$content_only}
					</div><!-- #center_column -->
					{if isset($right_column_size) && !empty($right_column_size)}
						<div id="right_column" class="col-xs-12 col-sm-{$right_column_size|intval} column">{$HOOK_RIGHT_COLUMN}</div>
					{/if}
					</div><!-- .row -->
				</div><!-- #columns -->
			</div><!-- .columns-container -->
			{if isset($HOOK_FOOTER)}
				<!-- Footer -->
				<div class="footer-container">
					<footer id="footer"  class="container">
						<div class="row">{$HOOK_FOOTER}</div>
					</footer>
				</div><!-- #footer -->
			{/if}
		</div><!-- #page -->
{/if}
{include file="$tpl_dir./global.tpl"}

<!--Start of Tawk.to Script-->
---my tawk script code---
<!--End of Tawk.to Script-->

<div class="container">
	---my custom code---	
</div>

	</body>
</html>

Basically, i want to hide the last div class container i added at the end if the site is opened as mobile. That would be awesome!

Thanks in advance, your help is always useful  B)

Edited by Nandos (see edit history)
Link to comment
Share on other sites

I suggest that you change <div class="container"> to <div class="container mobile-hidden"> and then add CSS code like the following to global.css:

@media (max-width: 479px) {
    .mobile-hidden { display: none }
}

This should make it so the div is only displayed if the website width is 480px or above. You can adjust that value if needed.

Link to comment
Share on other sites

I found the following on line 430 of classes/FrontController.php on my PrestaShop v1.6.1.6 test site:

            'mobile_device'       => $this->context->getMobileDevice(),

You could try using the following to check whether you're on a mobile device:

{if $mobile_device}mobile{else}desktop{/if}
  • Like 1
Link to comment
Share on other sites

 

I found the following on line 430 of classes/FrontController.php on my PrestaShop v1.6.1.6 test site:

            'mobile_device'       => $this->context->getMobileDevice(),

You could try using the following to check whether you're on a mobile device:

{if $mobile_device}mobile{else}desktop{/if}

 

I will try for sure, thanks a lot guys!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...