Viewing 21 to 30 of 41 items
Archive | Front-end RSS feed for this section

CSS – Understanding the viewport meta tag

Understanding the viewport meta tag, CSS @viewport and making an automatic link to your app. The use of meta tags is not actually a W3C specification. Despite that, due to the ubiquity of iOS devices and WebKit in general, they have become a de-facto standard. Let’s wrap our hands around them… In short, they offer  Full Article…

0

Javascript – Back to previous page

Sometimes, you will want to back to previous page, but you don’t want to use the back button of the browser. You can create a button in your website to do that. You can do this with javascript <a href=”javascript: history.go(-1)”>Go Back to previous page</a>

0

Checking if your data is digit

You can use Javascript to detect the content of the input box is digit or not. Here is the code you can use: if ( (yourcontent+””).match(/^\d+$/) ) { //it’s all digits }  

0

Validate your input, Magento style in front-end

I’m sure most of you will agree that Magento’s front-end validation for form input fields is a nice feature. All it takes is for you to add some CSS classes to the input fields and then upon form submission validation is triggered that outputs, by default, red colored messages that point the possible validation failures  Full Article…

0

Trigger a button click with JavaScript on the Enter key in a text box

Figured this out: <input type=”text” id=”txtSearch” onkeypress=”return searchKeyPress(event);” /> <input type=”button” id=”btnSearch” Value=”Search” onclick=”doSomething();” /> <script> function searchKeyPress(e) { // look for window.event in case event isn’t passed in e = e || window.event; if (e.keyCode == 13) { document.getElementById(‘btnSearch’).click(); return false; } return true; } </script>

0

Hiding empty attribute on front-end

For some odd reason, the Magento developers decided that an empty attribute should NOT be empty, but rather “No” or “N/A”, depending on its type. This is not just annoying, but in some cases can display wrong information which means confused visitors and potentially lost sales. Fortunately, there is a quick fix that will solve  Full Article…

0

Getting selected simple product id in configurable product on client side.

If you need to get id of selected simple product in configurable product on client side you can do it in many different ways. Here is simple function how to achieve that with no code modification, new templates or even modules. Just one Javascript file and layout update. Product.Config.prototype.getIdOfSelectedProduct = function() { var existingProducts =  Full Article…

0

How to remove all the different CSS and JS in skin or js folder by XML

How to remove all the different CSS and JS in skin or js folder? —————————— Here is what you need to do: <reference name=”head”> <!– For a JS in the js folder –> <action method=”removeItem”><type>js</type><name>functions.js</name></action> <!– For a JS in the skin folder –> <action method=”removeItem”><type>skin_js</type><name>functions.js</name></action> <!– For CSS in the skin folder –> <action  Full Article…

0

Setting the default Timezone for PHP to use

he default time-zone used and displayed by PHP is UTC (Coordinated Universal Time)… Hence why it might look several hours off from your *local* time. While sometimes it’s best to leave the internal time-zone of PHP set on UTC (as it is a international time standard) and then convert (in PHP code) the UTC date-time  Full Article…

0