Redirect to Mobile theme in Magento using add exception
If you look at the System > Configuration > General > Design -> Package and Theme sections, you’ll see that Magento provides “Add Exception” buttons most of the configuration parameters available. There is also a cryptic caption saying: “Match expressions in the same order as displayed in the configuration.”
But what does it mean? And what can we do with this?
Well, if you’re adventurous and hike into the code behind the exception options you will realize that Magento takes a regular expression string in “Matched Expression” and will compare it with the browser user agent, applying the “Value” set as the one to use instead of what is set for the default if it finds a match.
In other words, if the regular expression matches with the browser user agent apply the design exception set.
In yet more words, you can use this to check what browser customers are using to access your store and set a different package / template / skin / layout / theme accordingly. So, if you want to serve up a different theme for mobile browsers, this is where the exceptions come in handy.
Let’s look at how to set this up so Magento serves the iPhone theme for mobile device customers:
Here is the full contents of the “Matched Expression”:
iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini
So what the example in the screenshot is saying is: “If the user agent is one of the listed ones, serve up the iphone design that ships with Magento, otherwise just use the default”.
Depending on where you add your exception, you can create a different layout or skin or complete theme for your audience who use different devices to get to your site.
For example, you could have a cutting edge design as your default theme but offer an alternative, cut-down version for the odd IE6 user.
For the most part, however, you will use this feature to serve a mobile optimized version of your design.
Finally, what does that cryptic caption then mean? Well, it just means that if you have several exception rules, they will be matched and applied in the order they are listed.
Update: If it is not working properly you can redirect using another way check here.
Please support us, Like us on Facebook.
Subscribe to:
Post Comments (Atom)
Hi,
ReplyDeleteI followed all the step of aw mobile theme in our project but it's not working.
Please help me out asap.
Rgards,
Deepika
I don't know how you are going.
Deletebut if want to see that theme is working or not you need to use this url
http://example.com/?___store=mobile
try this way and still not work let me know.
Thanks for sharing the nice and informative post. I have clear my all doubt after reading the post.for more knowledge- web design orlando
ReplyDeleteThanks for sharing the nice and informative post. I have clear my all doubt after reading the post.for more knowledge- Engineering colleges in vadodara
ReplyDeletethank you for very nice article
ReplyDeletesend sms from pc
My expectation after reading the article are fulfilled.Thanks for sharing such a wonderful post.for more knowledge- link seo in india
ReplyDelete