Magento Themes and Magento Extensions

Magento – Easy Form Validation in magento

Share
Posted on December 4th, 2012 | Posted by admin

Magento has some Default classes for validating form elements in frontend. We can make use of those existing
class names for our custom forms and reuse the client side validation code of  Magento.
Let’s see a couple of examples from magento source code

1. Adding the required class to any field label will give the asterisk to be appear in red color indicating it is
the mandatory field

  1. <label for=“name” class=“required”><em>*</em></label>

2. If you want to make a field mandatory just add required-entry class in the input tag as shown below

  1. <input name=“name” id=“name” class=“input-text required-entry” type=“text”>

3. If you want to validate the field value entered by the user there is a seperate class available.

Debug your layout in Magento

Share
Posted on November 18th, 2012 | Posted by admin

Debug your layout in Magento

Your layout files and templates are not showing up on front? You can see what’s going on with your layouts using Mage::log() method in your controller. The code below would log loaded layout handles and compiled layout update string into var/log/layout.log file.

Here is how to enable the debug mode in your index.php file.

Displaying Currency code after the price value in Magento

Share
Posted on September 6th, 2012 | Posted by admin

I had a time to research on Magento is currency format and its display on Magento webshop. I then came across a block where I could change the format of currency display, in this case I am talking about moving the currency symbol to the right of the price value. In other words I found a way to show $10.00 as 10.00$. Notice the $ (Dollar) sign moving at the right of the price value.
Here’s a description of how this can be achievable. The basic idea is to rewriteMage_Core_Model_Locale class’s currency function and add additional code. First you must write a rewrite code in your module’s config.xml.

Page 2 of 2«12