Jump to content

Recommended Posts

I was just wondering if there is anything 'built in" to cubecart which detects if user-agent is a mobile (ie. tablet, phone, etc.. ). I can do that my self but that would be pointless if its already present.

Many Thanks, Chris Coleman.

Share this post


Link to post
Share on other sites

Yes I guess, but media queries can give the size but not the platform.

There is a 'handheld' media type but thats rarely usefull because the mobile user-agents rarely use it.

If for example I wished to change text size on parts of the page but only on handhelds it is difficult using media queries..

Chris.   

 

 

 

Share this post


Link to post
Share on other sites
6 minutes ago, ChrisColeman said:

Yes I guess, but media queries can give the size but not the platform.

There is a 'handheld' media type but thats rarely usefull because the mobile user-agents rarely use it.

If for example I wished to change text size on parts of the page but only on handhelds it is difficult using media queries..

Chris.   

 

 

 

That's exactly what media queries are for. The CSS logic can be along the lines of "if screen size is less than X pixels make font size y pixels".

Maybe I misunderstood you.

 

Share this post


Link to post
Share on other sites
On 13/12/2017 at 11:20 PM, Al Brookbanks said:

That's exactly what media queries are for. The CSS logic can be along the lines of "if screen size is less than X pixels make font size y pixels".

Maybe I misunderstood you.

 

Ok well perhaps that was not a good example, what if I wanted to display a different navigation on handheld devices, nothing to do with the width of the platform just a different 'look & feel' ?

Chris.

Share this post


Link to post
Share on other sites

CubeCart does have the code to detect mobile device's "user agent strings". The regex may not be up to date, but can be easily changed.

If CubeCart detects a mobile device, it then checks to see if the current skin (according to a setting in the skin's config.xml file) is 'responsive'. If it is, CubeCart will not switch to using an alternate skin. If 'responsive' is false or not found, CubeCart then asks if there is a "mobile" skin that has been selected. If so, CubeCart uses that skin.

In admin, you will need to have installed a skin that is not responsive. You will also need to have installed a "mobile" skin. The skins "Kurouto" and "Mobile" are available in the Marketplace.

In CubeCart's admin, Store Settings, Layout tab, select Kurouto as the 'Default front-end skin'. Save. Back at this page, the 'Default front-end mobile skin' selector should now be usable. Choose Mobile. Be sure that 'Disable mobile skin' is not checked. Save.

Test by accessing your store with a browser whose user agent string states it is a mobile device.

Edited by bsmither

Share this post


Link to post
Share on other sites

Yes I think that might just do it ...

Oh by the way can i use $_SESSION variables to store variables or does CubeCart have a different methodology?

Many Thanks, Chris.

Share this post


Link to post
Share on other sites

$_SESSION is wrapped in a Session class. There are various methods to manage session contents.

Do not hesitate to ask for details.

Share this post


Link to post
Share on other sites

Ok a simple follow up ..

       Maybe I have a set of variables for a mobile platform, which I need to send to each HTML page. I would like to be able to pass the $_SESSION data between pages (server side) and normally (?) I would use $_SESSION to do that.

Maybe I'll use SMARTY to extract the data and send to the page -  infact definately I would use SMARTY so I need to be able to get/set the $_SESSION variable within the plugins/hooks system with which I am familiar.

  How would I hande the $_SESSION array  in CubeCart, I'm guessing that its not so complicated but rather than diving into the CubeCart code and then maybe coming up with the wrong answer would appretiate some 'inside info'.

Thank You - No Rush - I'm taking a breather until the New Year.

Chris.

 

Share this post


Link to post
Share on other sites

The essential methods you would use are has(), get(), and set().

When you are ready, send me a PM and we will take this as deep as you need.

Share this post


Link to post
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

×