Sunday 15 November 2015

Steps To Add Google Translate Widget (Multi-lingual) (PHP WEB SITE)

1. Login in to your Gmail account.
2. Than click on open the following link "https://translate.google.com/manager/website/add";
3. Add your domain url to following "Website URL" => "What is the URL of your website?" input box.
4. Select the Google Translate widget (Plugin Settings) for your website.
5. Click the "Get Code" button.
6. Copy the generated js code (Paste this code onto your website) and place in your header file where you want to display this widget on web site.
7. save your file.

8. Refresh your page.. if you have followed all the above steps correctly than you are able to see the google translate widget.

Thanks Cheers... :)

Tuesday 7 April 2015

Build Custom Subscription Module with CSV/XML/XLS export feature for Magento Admin section


Are you looking custom subscription module  with CSV/XML/XLS export feature for Magento Admin section ?

Than You are at right place. You can check/get the complete working code from below url.



https://drive.google.com/file/d/0B6LN6vLU_Ao6UzJBbnVzWXp0b1E/view?usp=sharing

Tested with Magento version-1.9.1.0

Cheers...

Monday 6 April 2015

Default Available Magento Validation Classes with description

'validate-no-html-tags'         => 'HTML tags are not allowed'
'validate-select'               => 'Please select an option.'
'required-entry'                => 'This is a required field.'
'validate-number'               => 'Please enter a valid number in this field.'
'validate-number-range'         => 'The value is not within the specified range.'
'validate-digits'               => 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.'
'validate-digits-range'         => 'The value is not within the specified range.'
'validate-alpha'                => 'Please use letters only (a-z or A-Z) in this field.'
'validate-code'                 => 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'
'validate-alphanum'             => 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.'
'validate-alphanum-with-spaces' => 'Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.'
'validate-street'               => 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.'
'validate-phoneStrict'          => 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.'
'validate-phoneLax'             => 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.'
'validate-fax'                  => 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.'
'validate-date'                 => 'Please enter a valid date.'
'validate-date-range'           => 'The From Date value should be less than or equal to the To Date value.'
'validate-email'                => 'Please enter a valid email address. For example johndoe@domain.com.'
'validate-emailSender'          => 'Please use only visible characters and spaces.'
'validate-password'             => 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.'
'validate-admin-password'       => 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.'
'validate-both-passwords'       => 'Please make sure your passwords match.'
'validate-url'                  => 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)'
'validate-clean-url'            => 'Please enter a valid URL. For example http://www.example.com or www.example.com'
'validate-identifier'           => 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".'
'validate-xml-identifier'       => 'Please enter a valid XML-identifier. For example something_1, block5, id-4.'
'validate-ssn'                  => 'Please enter a valid social security number. For example 123-45-6789.'
'validate-zip'                  => 'Please enter a valid zip code. For example 90602 or 90602-1234.'
'validate-zip-international'    => 'Please enter a valid zip code.'
'validate-date-au'              => 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.'
'validate-currency-dollar'      => 'Please enter a valid $ amount. For example $100.00.'
'validate-one-required'         => 'Please select one of the above options.'
'validate-one-required-by-name' => 'Please select one of the options.'
'validate-not-negative-number'  => 'Please enter a number 0 or greater in this field.'
'validate-zero-or-greater'      => 'Please enter a number 0 or greater in this field.'
'validate-greater-than-zero'    => 'Please enter a number greater than 0 in this field.'
'validate-state'                => 'Please select State/Province.'
'validate-new-password'         => 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.'
'validate-cc-number'            => 'Please enter a valid credit card number.'
'validate-cc-type'              => 'Credit card number does not match credit card type.'
'validate-cc-type-select'       => 'Card type does not match credit card number.'
'validate-cc-exp'               => 'Incorrect credit card expiration date.'
'validate-cc-cvn'               => 'Please enter a valid credit card verification number.'
'validate-ajax'                 => ''
'validate-data'                 => 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.'
'validate-css-length'           => 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.'
'validate-length'               => 'Text length does not satisfy specified text range.'
'validate-percents'             => 'Please enter a number lower than 100.'
'validate-cc-ukss'              => 'Please enter issue number or start date for switch/solo card type.'

Validate your input, In Magento style



Check this
Validation.add('IsEmpty', '', function(v) {
    return  (v == '' || (v == null) || (v.length == 0) || /^\s+$/.test(v)); // || /^\s+$/.test(v));
});

Validation.addAllThese([
    ['validate-select', 'Please select an option.', function(v) {
                return ((v != "none") && (v != null) && (v.length != 0));
            }],
    ['required-entry', 'This is a required field.', function(v) {
                return !Validation.get('IsEmpty').test(v);
            }],
    ['validate-number', 'Please enter a valid number in this field.', function(v) {
                return Validation.get('IsEmpty').test(v) || (!isNaN(parseNumber(v)) && !/^\s+$/.test(parseNumber(v)));
            }],
    ['validate-digits', 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.', function(v) {
                return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
            }],
    ['validate-digits-range', 'The value is not within the specified range.', function(v, elm) {
                var result = Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
                var reRange = new RegExp(/^digits-range-[0-9]+-[0-9]+$/);
                $w(elm.className).each(function(name, index) {
                    if (name.match(reRange) && result) {
                        var min = parseInt(name.split('-')[2], 10);
                        var max = parseInt(name.split('-')[3], 10);
                        var val = parseInt(v, 10);
                        result = (v >= min) && (v <= max);
                    }
                });
                return result;
            }],
    ['validate-alpha', 'Please use letters only (a-z or A-Z) in this field.', function (v) {
                return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v)
            }],
    ['validate-code', 'Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
                return Validation.get('IsEmpty').test(v) ||  /^[a-z]+[a-z0-9_]+$/.test(v)
            }],
    ['validate-alphanum', 'Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
                return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z0-9]+$/.test(v) /*!/\W/.test(v)*/
            }],
    ['validate-street', 'Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.', function(v) {
                return Validation.get('IsEmpty').test(v) ||  /^[ \w]{3,}([A-Za-z]\.)?([ \w]*\#\d+)?(\r\n| )[ \w]{3,}/.test(v)
            }],
    ['validate-phoneStrict', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
                return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
            }],
    ['validate-phoneLax', 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.', function(v) {
                return Validation.get('IsEmpty').test(v) || /^((\d[-. ]?)?((\(\d{3}\))|\d{3}))?[-. ]?\d{3}[-. ]?\d{4}$/.test(v);
            }],
    ['validate-fax', 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.', function(v) {
                return Validation.get('IsEmpty').test(v) || /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)\d{4}$/.test(v);
            }],
    ['validate-date', 'Please enter a valid date.', function(v) {
                var test = new Date(v);
                return Validation.get('IsEmpty').test(v) || !isNaN(test);
            }],
    ['validate-email', 'Please enter a valid email address. For example johndoe@domain.com.', function (v) {
                //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
                //return Validation.get('IsEmpty').test(v) || /^[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9][\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9\.]{1,30}[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9]@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i.test(v)
                return Validation.get('IsEmpty').test(v) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v)
            }],
    ['validate-emailSender', 'Please use only visible characters and spaces.', function (v) {
                return Validation.get('IsEmpty').test(v) ||  /^[\S ]+$/.test(v)
                    }],
    ['validate-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
                var pass=v.strip(); /*strip leading and trailing spaces*/
                return !(pass.length>0 && pass.length < 6);
            }],
    ['validate-admin-password', 'Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.', function(v) {
                var pass=v.strip();
                if (0 == pass.length) {
                    return true;
                }
                if (!(/[a-z]/i.test(v)) || !(/[0-9]/.test(v))) {
                    return false;
                }
                return !(pass.length < 7);
            }],
    ['validate-cpassword', 'Please make sure your passwords match.', function(v) {
                var conf = $('confirmation') ? $('confirmation') : $$('.validate-cpassword')[0];
                var pass = false;
                if ($('password')) {
                    pass = $('password');
                }
                var passwordElements = $$('.validate-password');
                for (var i = 0; i < passwordElements.size(); i++) {
                    var passwordElement = passwordElements[i];
                    if (passwordElement.up('form').id == conf.up('form').id) {
                        pass = passwordElement;
                    }
                }
                if ($$('.validate-admin-password').size()) {
                    pass = $$('.validate-admin-password')[0];
                }
                return (pass.value == conf.value);
            }],
    ['validate-url', 'Please enter a valid URL. Protocol is required (http://, https:// or ftp://)', function (v) {
                v = (v || '').replace(/^\s+/, '').replace(/\s+$/, '');
                return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?$/i.test(v)
            }],
    ['validate-clean-url', 'Please enter a valid URL. For example http://www.example.com or www.example.com', function (v) {
                return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v) || /^(www)((\.[A-Z0-9][A-Z0-9_-]*)+.(com|org|net|dk|at|us|tv|info|uk|co.uk|biz|se)$)(:(\d+))?\/?/i.test(v)
            }],
    ['validate-identifier', 'Please enter a valid URL Key. For example "example-page", "example-page.html" or "anotherlevel/example-page".', function (v) {
                return Validation.get('IsEmpty').test(v) || /^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/.test(v)
            }],
    ['validate-xml-identifier', 'Please enter a valid XML-identifier. For example something_1, block5, id-4.', function (v) {
                return Validation.get('IsEmpty').test(v) || /^[A-Z][A-Z0-9_\/-]*$/i.test(v)
            }],
    ['validate-ssn', 'Please enter a valid social security number. For example 123-45-6789.', function(v) {
            return Validation.get('IsEmpty').test(v) || /^\d{3}-?\d{2}-?\d{4}$/.test(v);
            }],
    ['validate-zip', 'Please enter a valid zip code. For example 90602 or 90602-1234.', function(v) {
            return Validation.get('IsEmpty').test(v) || /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(v);
            }],
    ['validate-zip-international', 'Please enter a valid zip code.', function(v) {
            //return Validation.get('IsEmpty').test(v) || /(^[A-z0-9]{2,10}([\s]{0,1}|[\-]{0,1})[A-z0-9]{2,10}$)/.test(v);
            return true;
            }],
    ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
                if(Validation.get('IsEmpty').test(v)) return true;
                var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
                if(!regex.test(v)) return false;
                var d = new Date(v.replace(regex, '$2/$1/$3'));
                return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
                            (parseInt(RegExp.$1, 10) == d.getDate()) &&
                            (parseInt(RegExp.$3, 10) == d.getFullYear() );
            }],
    ['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00.', function(v) {
                // [$]1[##][,###]+[.##]
                // [$]1###+[.##]
                // [$]0.##
                // [$].##
                return Validation.get('IsEmpty').test(v) ||  /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
            }],
    ['validate-one-required', 'Please select one of the above options.', function (v,elm) {
                var p = elm.parentNode;
                var options = p.getElementsByTagName('INPUT');
                return $A(options).any(function(elm) {
                    return $F(elm);
                });
            }],
    ['validate-one-required-by-name', 'Please select one of the options.', function (v,elm) {
                var inputs = $$('input[name="' + elm.name.replace(/([\\"])/g, '\\$1') + '"]');

                var error = 1;
                for(var i=0;i<inputs.length;i++) {
                    if((inputs[i].type == 'checkbox' || inputs[i].type == 'radio') && inputs[i].checked == true) {
                        error = 0;
                    }

                    if(Validation.isOnChange && (inputs[i].type == 'checkbox' || inputs[i].type == 'radio')) {
                        Validation.reset(inputs[i]);
                    }
                }

                if( error == 0 ) {
                    return true;
                } else {
                    return false;
                }
            }],
    ['validate-not-negative-number', 'Please enter a valid number in this field.', function(v) {
                v = parseNumber(v);
                return (!isNaN(v) && v>=0);
            }],
    ['validate-state', 'Please select State/Province.', function(v) {
                return (v!=0 || v == '');
            }],

    ['validate-new-password', 'Please enter 6 or more characters. Leading or trailing spaces will be ignored.', function(v) {
                if (!Validation.get('validate-password').test(v)) return false;
                if (Validation.get('IsEmpty').test(v) && v != '') return false;
                return true;
            }],
    ['validate-greater-than-zero', 'Please enter a number greater than 0 in this field.', function(v) {
                if(v.length)
                    return parseFloat(v) > 0;
                else
                    return true;
            }],
    ['validate-zero-or-greater', 'Please enter a number 0 or greater in this field.', function(v) {
                if(v.length)
                    return parseFloat(v) >= 0;
                else
                    return true;
            }],
    ['validate-cc-number', 'Please enter a valid credit card number.', function(v, elm) {
                // remove non-numerics
                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
                if (ccTypeContainer && typeof Validation.creditCartTypes.get(ccTypeContainer.value) != 'undefined'
                        && Validation.creditCartTypes.get(ccTypeContainer.value)[2] == false) {
                    if (!Validation.get('IsEmpty').test(v) && Validation.get('validate-digits').test(v)) {
                        return true;
                    } else {
                        return false;
                    }
                }
                return validateCreditCard(v);
            }],
    ['validate-cc-type', 'Credit card number does not match credit card type.', function(v, elm) {
                // remove credit card number delimiters such as "-" and space
                elm.value = removeDelimiters(elm.value);
                v         = removeDelimiters(v);

                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_number')) + '_cc_type');
                if (!ccTypeContainer) {
                    return true;
                }
                var ccType = ccTypeContainer.value;

                if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
                    return false;
                }

                // Other card type or switch or solo card
                if (Validation.creditCartTypes.get(ccType)[0]==false) {
                    return true;
                }

                // Matched credit card type
                var ccMatchedType = '';

                Validation.creditCartTypes.each(function (pair) {
                    if (pair.value[0] && v.match(pair.value[0])) {
                        ccMatchedType = pair.key;
                        throw $break;
                    }
                });

                if(ccMatchedType != ccType) {
                    return false;
                }

                if (ccTypeContainer.hasClassName('validation-failed') && Validation.isOnChange) {
                    Validation.validate(ccTypeContainer);
                }

                return true;
            }],
     ['validate-cc-type-select', 'Card type does not match credit card number.', function(v, elm) {
                var ccNumberContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_type')) + '_cc_number');
                if (Validation.isOnChange && Validation.get('IsEmpty').test(ccNumberContainer.value)) {
                    return true;
                }
                if (Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer)) {
                    Validation.validate(ccNumberContainer);
                }
                return Validation.get('validate-cc-type').test(ccNumberContainer.value, ccNumberContainer);
            }],
     ['validate-cc-exp', 'Incorrect credit card expiration date.', function(v, elm) {
                var ccExpMonth   = v;
                var ccExpYear    = $(elm.id.substr(0,elm.id.indexOf('_expiration')) + '_expiration_yr').value;
                var currentTime  = new Date();
                var currentMonth = currentTime.getMonth() + 1;
                var currentYear  = currentTime.getFullYear();
                if (ccExpMonth < currentMonth && ccExpYear == currentYear) {
                    return false;
                }
                return true;
            }],
     ['validate-cc-cvn', 'Please enter a valid credit card verification number.', function(v, elm) {
                var ccTypeContainer = $(elm.id.substr(0,elm.id.indexOf('_cc_cid')) + '_cc_type');
                if (!ccTypeContainer) {
                    return true;
                }
                var ccType = ccTypeContainer.value;

                if (typeof Validation.creditCartTypes.get(ccType) == 'undefined') {
                    return false;
                }

                var re = Validation.creditCartTypes.get(ccType)[1];

                if (v.match(re)) {
                    return true;
                }

                return false;
            }],
     ['validate-ajax', '', function(v, elm) { return true; }],
     ['validate-data', 'Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.', function (v) {
                if(v != '' && v) {
                    return /^[A-Za-z]+[A-Za-z0-9_]+$/.test(v);
                }
                return true;
            }],
     ['validate-css-length', 'Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.', function (v) {
                if (v != '' && v) {
                    return /^[0-9\.]+(px|pt|em|ex|%)?$/.test(v) && (!(/\..*\./.test(v))) && !(/\.$/.test(v));
                }
                return true;
            }],
     ['validate-length', 'Text length does not satisfy specified text range.', function (v, elm) {
                var reMax = new RegExp(/^maximum-length-[0-9]+$/);
                var reMin = new RegExp(/^minimum-length-[0-9]+$/);
                var result = true;
                $w(elm.className).each(function(name, index) {
                    if (name.match(reMax) && result) {
                       var length = name.split('-')[2];
                       result = (v.length <= length);
                    }
                    if (name.match(reMin) && result && !Validation.get('IsEmpty').test(v)) {
                        var length = name.split('-')[2];
                        result = (v.length >= length);
                    }
                });
                return result;
            }],
     ['validate-percents', 'Please enter a number lower than 100.', {max:100}],
     ['required-file', 'Please select a file', function(v, elm) {
         var result = !Validation.get('IsEmpty').test(v);
         if (result === false) {
             ovId = elm.id + '_value';
             if ($(ovId)) {
                 result = !Validation.get('IsEmpty').test($(ovId).value);
             }
         }
         return result;
     }],
     ['validate-cc-ukss', 'Please enter issue number or start date for switch/solo card type.', function(v,elm) {
         var endposition;

         if (elm.id.match(/(.)+_cc_issue$/)) {
             endposition = elm.id.indexOf('_cc_issue');
         } else if (elm.id.match(/(.)+_start_month$/)) {
             endposition = elm.id.indexOf('_start_month');
         } else {
             endposition = elm.id.indexOf('_start_year');
         }

         var prefix = elm.id.substr(0,endposition);

         var ccTypeContainer = $(prefix + '_cc_type');

         if (!ccTypeContainer) {
               return true;
         }
         var ccType = ccTypeContainer.value;

         if(['SS','SM','SO'].indexOf(ccType) == -1){
             return true;
         }

         $(prefix + '_cc_issue').advaiceContainer
           = $(prefix + '_start_month').advaiceContainer
           = $(prefix + '_start_year').advaiceContainer
           = $(prefix + '_cc_type_ss_div').down('ul li.adv-container');

         var ccIssue   =  $(prefix + '_cc_issue').value;
         var ccSMonth  =  $(prefix + '_start_month').value;
         var ccSYear   =  $(prefix + '_start_year').value;

         var ccStartDatePresent = (ccSMonth && ccSYear) ? true : false;

         if (!ccStartDatePresent && !ccIssue){
             return false;
         }
         return true;
     }]
]);

For More detail Check this "http://inchoo.net/magento/programming-magento/validate-your-input-magento-style/"

Friday 20 March 2015

Showing a CSS Based Loading Animation While Your Site Loads

Here is the example.


<!DOCTYPE html>
<html class="loading">
 <head>
  <meta charset="utf-8">
  <title>Loading Example</title>
  <style>
   html {
    -webkit-transition: background-color 1s;
    transition: background-color 1s;
   }
   html, body { min-height: 100%; }
   html.loading {
    background: #333 url('http://code.jquery.com/mobile/1.3.1/images/ajax-loader.gif') no-repeat 50% 50%;
    -webkit-transition: background-color 0;
    transition: background-color 0;
   }
   body {
    -webkit-transition: opacity 1s ease-in;
    transition: opacity 1s ease-in;
   }
   html.loading body {
    opacity: 0;
    -webkit-transition: opacity 0;
    transition: opacity 0;
   }
   button {
    background: #00A3FF;
    color: white;
    padding: 0.2em 0.5em;
    font-size: 1.5em;
   }
  </style>
  <script>
   var html = document.getElementsByTagName('html')[0];
   var removeLoading = function() {
    // In a production application you would remove the loading class when your
    // application is initialized and ready to go.  Here we just artificially wait
    // 3 seconds before removing the class.
    setTimeout(function() {
     html.className = html.className.replace(/loading/, '');
    }, 3000);
   };
   removeLoading();
  </script>
 </head>
 <body>
  <!-- AVERT YER EYES.  This button is a hack to demo this.  Do not use onclick attributes. -->
  <button onclick="html.className = 'loading'; removeLoading();">Reload</button>

  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. </p>

  <p>Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. </p>
 </body>
</html>

For any query contact me or see the ref.site http://tjvantoll.com/2013/04/24/showing-a-css-based-loading-animation-while-your-site-loads/
Thanks "TJ VanToll" for this nice and simple code.

Tuesday 24 February 2015

Open multiple window on page load with JavaScript

<script type="text/javascript">
function performCalc(url) {
var randomnumber = Math.floor((Math.random()*100)+1);
window.open(url,"_blank",'PopUp'+randomnumber+',scrollbars=1,menubar=0,resizable=1,width=100,height=100');
}

for (i = 0; i < 5; i++) {
var url ='www.'+i+'.com';
performCalc(url);
}          
</script>

Thursday 12 February 2015

Magento – Get Logged In Customer’s Full Name, First Name, Last Name and Email Address

// Check if any customer is logged in or not
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
 
    // Load the customer's data
    $customer = Mage::getSingleton('customer/session')->getCustomer();
 
    $customer->getPrefix();
    $customer->getName(); // Full Name
    $customer->getFirstname(); // First Name
    $customer->getMiddlename(); // Middle Name
    $customer->getLastname(); // Last Name
    $customer->getSuffix();
 
    // All other customer data
    $customer->getWebsiteId(); // ID
    $customer->getEntityId(); // ID
    $customer->getEntityTypeId(); // ID
    $customer->getAttributeSetId(); // ID
    $customer->getEmail();
    $customer->getGroupId(); // ID
    $customer->getStoreId(); // ID
    $customer->getCreatedAt(); // yyyy-mm-ddThh:mm:ss+01:00
    $customer->getUpdatedAt(); // yyyy-mm-dd hh:mm:ss
    $customer->getIsActive(); // 1
    $customer->getDisableAutoGroupChange();
    $customer->getTaxvat();
    $customer->getPasswordHash();
    $customer->getCreatedIn(); // Admin
    $customer->getGender(); // ID
    $customer->getDefaultBilling(); // ID
    $customer->getDefaultShipping(); // ID
    $customer->getDob(); // yyyy-mm-dd hh:mm:ss
    $customer->getTaxClassId(); // ID
}

Friday 30 January 2015

Chain select drop down And Table Row

Chain select drop down And Table Row


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> Chain select drop down And Table Row Added By Sanjay Singh Rao</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
$("#selectadult").val(0);
$( "#chkavl" ).click(function() {
var adcout=$("#selectadult").val();
var cdcout=$("#selectchild").val();
if($(".appendRow").length > 0){
$('#myTable tr.appendRow').remove();
}
var tblHtml = '';
var k=1;
if(adcout > 0){
for(i=0;i<adcout;i++){
tblHtml += '<tr class="appendRow"><td width="5%" height="30">&nbsp;'+ k +'</td><td width="5%" height="30">Adult</td>';
tblHtml += '<td width="15%" height="30"><input type="text" name="adultName[]" value="" id="adultName'+ k +'"></td>';
tblHtml += '<td width="15%" height="30"><input type="text" name="adultAge[]" value="" id="adultAge'+ k +'"></td>';
tblHtml += '<td width="15%" height="30"><select name="adultGender[]"><option value="Male">Male</option><option value="Female">Female</option></select></td>';
tblHtml += '<td width="15%" height="30"><input type="text" name="adultIdProof[]" value="" id="adultIdProof'+ k +'"></td>';
 k++;
}
}
if(cdcout > 0){
for(i=0;i<cdcout;i++){
tblHtml += '<tr class="appendRow"><td width="5%" height="30">&nbsp;'+ k +'</td><td width="5%" height="30">Child</td>';
tblHtml += '<td width="15%" height="30"><input type="text" name="childName[]" value="" id="childName'+ k +'"></td>';
tblHtml += '<td width="15%" height="30"><input type="text" name="childAge[]" value="" id="childAge'+ k +'"></td>';
tblHtml += '<td width="15%" height="30"><select name="childGender[]"><option value="Male">Male</option><option value="Female">Female</option></select></td>';
tblHtml += '<td width="15%" height="30"><input type="text" name="childIdProof[]" value="" id="childIdProof'+ k +'"></td>';
 k++;
}
}
if(tblHtml.length > 0){
$('#myTable').append(tblHtml);
}
});

});
</script>
<script language="javascript" type="text/javascript">

function setOptions(chosen) {
var selbox = document.myform.opttwo;

selbox.options.length = 0;
if (chosen == " ") {
  selbox.options[selbox.options.length] = new Option('Please Select Child','0');

}
if (chosen == "1") {
  selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
  selbox.options[selbox.options.length] = new Option('2','2');
selbox.options[selbox.options.length] = new Option('3','3');
  selbox.options[selbox.options.length] = new Option('4','4');
  selbox.options[selbox.options.length] = new Option('5','5');
selbox.options[selbox.options.length] = new Option('6','6');
  selbox.options[selbox.options.length] = new Option('7','7');

}
if (chosen == "2") {
   selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
  selbox.options[selbox.options.length] = new Option('2','2');
selbox.options[selbox.options.length] = new Option('3','3');
  selbox.options[selbox.options.length] = new Option('4','4');
  selbox.options[selbox.options.length] = new Option('5','5');
selbox.options[selbox.options.length] = new Option('6','6');
}
if (chosen == "3") {
   selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
  selbox.options[selbox.options.length] = new Option('2','2');
selbox.options[selbox.options.length] = new Option('3','3');
  selbox.options[selbox.options.length] = new Option('4','4');
  selbox.options[selbox.options.length] = new Option('5','5');

}
if (chosen == "4") {
   selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
  selbox.options[selbox.options.length] = new Option('2','2');
selbox.options[selbox.options.length] = new Option('3','3');
  selbox.options[selbox.options.length] = new Option('4','4');

}
if (chosen == "5") {
   selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
  selbox.options[selbox.options.length] = new Option('2','2');
selbox.options[selbox.options.length] = new Option('3','3');
  
}
if (chosen == "6") {
   selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
  selbox.options[selbox.options.length] = new Option('2','2');
}
if (chosen == "7") {
   selbox.options[selbox.options.length] = new Option('Please Select Child','0');
  selbox.options[selbox.options.length] = new Option('1','1');
}
}
</script>
<style type="text/css">
.select{
font-family:tahoma;
font-size:11px;
color:#000000;
font-weight:normal;
width:215px;
}
</style>
</head>

<body>

<div class="container"><!-- middle div starts here-->
<div><input type="button" id="chkavl" name="chkavl" value="Check Availability" /></div>
<div class="middle">
    <div class="right-outer"><div class="center">
      <div class="content"><form name="myform"><div align="center">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
  <tbody><tr>
    <td width="33%">
<select id="selectadult" name="optone" class="select" size="1" onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value);">
<option value="0">Please Select Adult</option>
          <option value="1">1</option>
          <option value="2">2 </option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
          <option value="6">6</option>
<option value="7">7</option>
          <option value="8">8</option>
</select>
</td>
    <td width="33%">
<select name="opttwo" size="1" class="select" id="selectchild">
<option value="0" selected="selected">Please Select Child</option>
</select></td>
    <td width="33%"></td>
  </tr>
  
</tbody></table>

<table width="100%" border="1" cellspacing="5" cellpadding="5" id="myTable">
 <tbody><tr>
<td width="5%" height="30">&nbsp;#</td>
<td width="5%" height="30">&nbsp;Type</td>
        <td width="35%" height="30">&nbsp;Name</td>
 <td width="15%" height="30">&nbsp;Age</td>
        <td width="15%" height="30">&nbsp;Gender</td>
   <td width="30%" height="30">&nbsp;ID Proof Number<span>*</span></td>
        </tr>
</tbody></table>
</div>

<div id="chkAvailability"></div>
</form> 

</div>
</div>
    </div>
</div>
</div>
</body></html>

Work with cmd (Command Line) For database import, Yii Setup, Composer check,

Work with cmd (Command Line)  For database import, Yii Setup, Composer check Belwo images and commands









Check the Composer Install or not With Detail Information

To check the composer is install or not in your windows system. By run the below command line code.


In the image the a1b-sr is the name of the user created in your windows system.

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...