Jump to content

Geolocation only for mobile devices


Eutanasio

Recommended Posts

Hi,

I have a problem, the ISP in my country mostly gives IPs to mobile devices that are apparently not recognized by the Geolocation function and then get the redirection page, which happens quiet often and once it happens, the cache on that phone wont let them ever see again our website unless they use incognito mode.
I think a good solution would be allowing mobile devices skip the Geolocation restriction, but not sure how to do so in PS 1.6.
Thanks for helping!

Link to comment
Share on other sites

I suggest overriding the FrontController::geolocationManagement($default_country) function and returning false if the customer is using a mobile device. For example, create override/classes/controller/FrontController.php with the following:

<?php

class FrontController extends FrontControllerCore
{
    protected geolocationManagement($default_country)
    {
        if ($this->context->getMobileDevice()) {
            return false;
        } else {
            return parent::geolocationManagement($default_country);
        }
    }
}

Remember to go to Advanced Parameters > Performance and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override.

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...