How to Turn Off Mobile Store on R2

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

How to Turn Off Mobile Store on R2

Post by itnovator » Thu Jan 30, 2014 11:19 pm

Where is the place to turn off mobile store on Admin Panel? I have tried "Configure->Store->Mobile Setting", there is no such a drop down menu to close the mobile store.

The reason to close the mobile store is that we have create fully responsive front pages, we do not need mobile user agent detection. Do you have any idea to turn of mobile store on AbleCommerce R2?

thanks,
David
Fun programming!

User avatar
ForumsAdmin
AbleCommerce Moderator
AbleCommerce Moderator
Posts: 399
Joined: Wed Mar 13, 2013 7:19 am

Re: How to Turn Off Mobile Store on R2

Post by ForumsAdmin » Fri Jan 31, 2014 4:15 am

In Configure->Store->Mobile Settings you have a setting

Mobile Browsing: [x] Enable Mobile Support

Uncheck this to disable mobile store.

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Fri Jan 31, 2014 7:27 am

Thanks for prompt reply, but really no such a check box for "Enable Mobile Support". Do I miss out something? Here is the screen capture:

Image

I have also double checked the source code used to upgrade R2 4808, there is no such a checkbox. Or am I missing out something somewhere?

thank you!
Fun programming!

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: How to Turn Off Mobile Store on R2

Post by Katie » Fri Jan 31, 2014 10:23 am

Does this help?

viewtopic.php?f=65&t=16903&p=73816&hili ... ore#p73816

You are on such an old version that the feature may not exist yet.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Fri Jan 31, 2014 12:32 pm

Thanks. I know it is so old that we actually just upgraded to R2 from R1.
Seems I was on the right track, I tried added "MobileStoreStatus" with value 1 to the ac_StoreSettings table. Did not work out. I also tried your solution to add a record "MobileStoreClosed" with value "True" to the table ac_StoreSettings, unfortunately, did not work either.

I think there should be a quick way on the source code level. I tried just modifying the function IsMobileStore() by always return "false" on "/Code/NavigationHelper.cs" file. Not working!

Code: Select all

        public static bool IsMobileStore()
        {
             // original
            //return AbleContext.Current.StoreMode == StoreMode.Mobile;
             // added
             return false;
        }
Can somebody with magic pointing out where I should change on the source code?
Deeply appreciated!
Fun programming!

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Fri Jan 31, 2014 1:45 pm

Okay, I checked through upgrade files and full version files of AbleCommerce. R2 does not have this function. R3 has it only on full installation but not on the upgrade files. Somebody may like to correct the upgrade files for downloading. This is just a note for somebody who may be wondering why not seeing it on the upgrade files.

Anyway, upgrading to R3 is not our option for now. It is urgent to launch new site first. Still seeking any help form capable hands.

P.S. I tried to define <location> in 51Degree library for this case, just making "~/Default.aspx" as initial page for all mobile devices. However, the trick did not work either.

.... Anyway from Ablecommerce? There should be a turn-around from Ablecommerce at source code level. Just a change a redirect...

thank you.
Fun programming!

User avatar
ForumsAdmin
AbleCommerce Moderator
AbleCommerce Moderator
Posts: 399
Joined: Wed Mar 13, 2013 7:19 am

Re: How to Turn Off Mobile Store on R2

Post by ForumsAdmin » Sat Feb 01, 2014 10:17 am

Unfortunately the code that performs the magic is in the backend DLL, the source of which is not available for you to modify.

The main HttpModule that performs all different kind of filtering on the requests that arrive is responsible for deciding whether a request is to be treated as a mobile store request or not. The HttpModule is the core of many other important manipulations to the incoming request. It can not be bypassed and it can not be modified by the end users.

The solution you may want to apply could be intercept all requests arriving at the mobile store and redirect them to the main store.
All mobile store pages inherit from Layouts/Mobile.master. You may want to add redirection code to this file.

User avatar
ForumsAdmin
AbleCommerce Moderator
AbleCommerce Moderator
Posts: 399
Joined: Wed Mar 13, 2013 7:19 am

Re: How to Turn Off Mobile Store on R2

Post by ForumsAdmin » Sat Feb 01, 2014 10:21 am

Not tested but you may try something like this in Mobile.master

Code: Select all

protected void Page_Init(object sender, EventArgs e)
{
   Response.Redirect("~/Default.aspx");
}

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Sat Feb 01, 2014 1:19 pm

Thanks for the reply and the test solusion provided. I will try it out and let u know the result. However, we did purchase the full software, we could custom built DLL. The version we have is for R6. I guess we could get R2 CommerceBuilder...

thx
Fun programming!

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Sat Feb 01, 2014 9:44 pm

Okay, just tested in different mobile devices. It only works on Samsung 7" Tablet, no one else. The error message is pretty clear on Chrome on mobile:

"The web page resulted in too many redirects..." obviously, because the infinite logic here... We did purchase the CommerceBuilder source license. How can I get the R2 Built 4808?

thanks,
Fun programming!

jguengerich
Commodore (COMO)
Commodore (COMO)
Posts: 436
Joined: Tue May 07, 2013 1:59 pm

Re: How to Turn Off Mobile Store on R2

Post by jguengerich » Mon Feb 03, 2014 7:23 am

Here is what I did in R5:
In the source code file CommerceBuilder\Services\MobileDetection.cs, there is an IsMobileDevice method. I changed it from this:

Code: Select all

        /// <summary>
        /// Determines if a device is recognized as mobile
        /// </summary>
        /// <param name="userAgent">The user agent string</param>
        /// <returns>True if the device is mobile</returns>
        internal static bool IsMobileDevice(string userAgent)
        {
                if (string.IsNullOrEmpty(userAgent))
                    return false;
                return _mobileAgents1.IsMatch(userAgent) || _mobileAgents2.IsMatch(userAgent.Substring(0, 4));
        }
to this:

Code: Select all

        /// <summary>
        /// Determines if a device is recognized as mobile
        /// </summary>
        /// <param name="userAgent">The user agent string</param>
        /// <returns>True if the device is mobile</returns>
        internal static bool IsMobileDevice(string userAgent)
        {
            // MY MODS if Mobile Store disabled, return false for everyone.  Original code is in else clause.
            CommerceBuilder.Stores.Store store = CommerceBuilder.Common.AbleContext.Current.Store;
            CommerceBuilder.Stores.StoreSettingsManager settings = store.Settings;
            if (settings.MobileStoreClosed)
            {
                return false;
            }
            else
            {
                // MY MODS original code is the next 2 lines.
                if (string.IsNullOrEmpty(userAgent))
                    return false;
                return _mobileAgents1.IsMatch(userAgent) || _mobileAgents2.IsMatch(userAgent.Substring(0, 4));
            }
        }
I did this because unchecking the "Enable Mobile Support" checkbox in the Admin interface was causing nothing to show up on mobile devices, and I wanted the "normal" web pages to show up.

If you can get the R2 source code, it may have this same method that you can change. You should be able to get the source code by going to AbleCommerce's web site and clicking the login link in the upper right corner. Once logged in, the link will change to a drop-down showing your user name. Click the drop-down and choose My Account, then click the Downloads tab.
Jay

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Mon Feb 03, 2014 7:31 am

Hi, Jay, I was looking at this file last night. You are right, this solution sounding well to me. I did have CommerceBuilder source, but it is the latest. I need to talk to them to get R2 build 4808 version. It does not allow downloading different versions of CommerceBuilder source on my account.

Really appreciated your reply. I will keep folks updated.
Fun programming!

itnovator
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Tue Jan 07, 2014 11:23 am

Re: How to Turn Off Mobile Store on R2

Post by itnovator » Mon Mar 03, 2014 7:49 am

Just for somebody who still looks for its solution. I contacted AbleCommerce, looked into CommerceBuilder source, they did not want to any information. I did not have time to spend to walk through everything, upgrading to R3 seems worth time saving. So there is no solution for the question I asked here.
Fun programming!

Post Reply