X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Banner Module - Different image dimensions for mobile (https://forum.x-cart.com/showthread.php?t=74669)

xgarb 11-14-2016 12:55 PM

Banner Module - Different image dimensions for mobile
 
The banner module as far as I can see serves the same size images whatever the screen size.

This means a lot of waste bandwidth on small devices.

Foundation has a tool that requests content based on screen size: http://foundation.zurb.com/sites/docs/interchange.html

This is different from just using classes to show or hide content as the content isn't requested at all with Interchange.

Is there any plans to introduce something like this in the module?

qualiteam 11-14-2016 11:41 PM

Re: Banner Module - Different image dimensions for mobile
 
Do you mean this banner module?
https://market.x-cart.com/addons/banner-system.html

xgarb 11-15-2016 12:52 AM

Re: Banner Module - Different image dimensions for mobile
 
Yes.

Dmitry 01-19-2017 03:23 AM

Re: Banner Module - Different image dimensions for mobile
 
If there is no other idea then why not try to dev a simple module for loading a custom css file on home page only and load @media css for this container items...

Please let me know your feedback

qualiteam 01-28-2017 01:47 AM

Re: Banner Module - Different image dimensions for mobile
 
Thank you for your feedback!

I've notified the module developer and she has this improvement in her to-do list for the module.
However, it is in her future plans, not something that will be implemented in the near future.

xgarb 02-27-2017 11:49 AM

Re: Banner Module - Different image dimensions for mobile
 
I'm wondering if the mobile detection scripts could be used somehow.

maybe class AMobile_Detect in xcart/lib/

or something with

\XLite\Core\MobileDetect::getInstance()->isMobile()

to do something like

{% if this.getBannerBoxes() && !isMobilePhone() %}
<div class="bannerBox">
......
{% endif %}

?

xgarb 05-05-2017 02:27 AM

Re: Banner Module - Different image dimensions for mobile
 
I just discovered after some investigation that the IsVisible method for this module always returns true. Possible due to the negation of the isMobileDevice not giving the expected result.

Code:

    /**
    * Check if widget is visible
    *
    * @return boolean
    */
    protected function isVisible()
    { 
        if (!\XLite\Core\Database::getRepo("XLite\Model\Module")->findOneBy(array("name"=>"Mobile", "author"=>"XC", "enabled"=> true)) || !\XLite\Core\Request::isMobileDevice()) {
          $result = true;
        } else {
          $result = false;
        }
       
        return parent::isVisible() && $result;

    }


Dropping the negation and swapping the true and false like this works..
Code:

    protected function isVisible()
    { 
        if (\XLite\Core\Database::getRepo("XLite\Model\Module")->findOneBy(array("name"=>"Mobile", "author"=>"XC", "enabled"=> true)) || \XLite\Core\Request::isMobileDevice()) {
          $result = false;
        } else {
          $result = true;
        }
       
        return parent::isVisible() && $result;

    }


So now it doesn't show the banner on mobile which is what I wanted.


All times are GMT -8. The time now is 04:25 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.