Jump to content

Lista de estados em dropdown no WHMCS 4.5.2


Recommended Posts

Atualizando um tópico ja criado aqui no fórum sobre a lista de estados no WHMCS, segue procedimentos abaixo, lembrando que fazendo essa alteração, automaticamente, quando escolhe o pais Brazil, aparecerá em todos os formulários do WHMCS (registro e alteração de dados), não sendo preciso a alteração da estrutura do template.

Edite o arquivo includes/jscript/statesdropdown.js

Localize var states = new Array();

Logo abaixo, insira:

states['BR'] = ["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"];
Para aqueles que não encontraram o arquivo.
var states = new Array();

states['AU'] = ["Australian Capital Territory","New South Wales","Northern Territory","Queensland","South Australia","Tasmania","Victoria","Western Australia","end"];

states['CA'] = ["Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory","end"];

states['FR'] = ["Alsace","Aquitaine","Auvergne","Basse-Normandie","Bourgogne","Bretagne","Centre","Champagne-Ardenne","Corse","Franche-Comte","Haute-Normandie","Ile-de-France","Languedoc-Roussillon","Limousin","Lorraine","Midi-Pyrenees","Nord-Pas-de-Calais","Pays de la Loire","Picardie","Poitou-Charentes","Provence-Alpes-Cote d'Azur","Rhone-Alpes","end"];

states['DE'] = ["Baden-Wuerttemberg","Bayern","Berlin","Brandenburg","Bremen","Hamburg","Hessen","Mecklenburg-Vorpommern","Niedersachsen","Nordrhein-Westfalen","Rheinland-Pfalz","Saarland","Sachsen","Sachsen-Anhalt","Schleswig-Holstein","Thueringen","end"];

states['ES'] = ["ARABA","ALBACETE","ALICANTE","ALMERIA","AVILA","BADAJOZ","ILLES BALEARS","BARCELONA","BURGOS","CACERES","CADIZ","CASTELLON","CIUDAD REAL","CORDOBA","CORUÑA, A","CUENCA","GIRONA","GRANADA","GUADALAJARA","GIPUZKOA","HUELVA","HUESCA","JAEN","LEON","LLEIDA","RIOJA, LA","LUGO","MADRID","MALAGA","MURCIA","NAVARRA","OURENSE","ASTURIAS","PALENCIA","PALMAS, LAS","PONTEVEDRA","SALAMANCA","SANTA CRUZ DE TENERIFE","CANTABRIA","SEGOVIA","SEVILLA","SORIA","TARRAGONA","TERUEL","TOLEDO","VALENCIA","VALLADOLID","BIZKAIA","ZAMORA","ZARAGOZA","CEUTA","MELILLA","end"];

states['IT'] = ["AG", "AL", "AN", "AO", "AR", "AP", "AT", "AV", "BA", "BL", "BN", "BG", "BI", "BO", "BZ", "BS", "BR", "CA", "CL", "CB", "CI", "CE", "CT", "CZ", "CH", "CO", "CS", "CR", "KR", "CN", "EN", "FE", "FI", "FG", "FC", "FR", "GE", "GO", "GR", "IM", "IS", "SP", "AQ", "LT", "LE", "LC", "LI", "LO", "LU", "MB", "MC", "MN", "MS", "MT", "ME", "MI", "MO", "NA", "NO", "NU", "OT", "OR", "PD", "PA", "PR", "PV", "PG", "PU", "PE", "PC", "PI", "PT", "PN", "PZ", "PO", "RG", "RA", "RC", "RE", "RI", "RN", "RM", "RO", "SA", "VS", "SS", "SV", "SI", "SR", "SO", "TA", "TE", "TR", "TO", "OG", "TP", "TN", "TV", "TS", "UD", "VA", "VE", "VB", "VC", "VR", "VV", "VI", "VT","end"];

states['NL'] = ["Drenthe","Flevoland","Friesland","Gelderland","Groningen","Limburg","Noord-Brabant","Noord-Holland","Overijssel","Utrecht","Zeeland","Zuid-Holland","end"];

states['NZ'] = ["Akaroa","Amuri","Ashburton","Bay of Islands","Bruce","Buller","Chatham Islands","Cheviot","Clifton","Clutha","Cook","Dannevirke","Egmont","Eketahuna","Ellesmere","Eltham","Eyre","Featherston","Franklin","Golden Bay","Great Barrier Island","Grey","Hauraki Plains","Hawera","Hawke's Bay","Heathcote","Hikurangi","Hobson","Hokianga","Horowhenua","Hurunui","Hutt","Inangahua","Inglewood","Kaikoura","Kairanga","Kiwitea","Lake","Mackenzie","Malvern","Manaia","Manawatu","Mangonui","Maniototo","Marlborough","Masterton","Matamata","Mount Herbert","Ohinemuri","Opotiki","Oroua","Otamatea","Otorohanga","Oxford","Pahiatua","Paparua","Patea","Piako","Pohangina","Raglan","Rangiora","Rangitikei","Rodney","Rotorua","Runanga","Saint Kilda","Silverpeaks","Southland","Stewart Island","Stratford","Strathallan","Taranaki","Taumarunui","Taupo","Tauranga","Thames-Coromandel","Tuapeka","Vincent","Waiapu","Waiheke","Waihemo","Waikato","Waikohu","Waimairi","Waimarino","Waimate","Waimate West","Waimea","Waipa","Waipawa","Waipukurau","Wairarapa South","Wairewa","Wairoa","Waitaki","Waitomo","Waitotara","Wallace","Wanganui","Waverley","Westland","Whakatane","Whangarei","Whangaroa","Woodville","end"];

states['GB'] = ["Aberdeenshire","Angus","Argyll and Bute","Barking and Dagenham","Barnet","Barnsley","Bath and North East Somerset","Bedfordshire","Bexley","Birmingham","Blackburn with Darwen","Blackpool","Blaenau Gwent","Bolton","Bournemouth","Bracknell Forest","Bradford","Brent","Bridgend","Brighton and Hove","Bromley","Buckinghamshire","Bury","Caerphilly","Calderdale","Cambridgeshire","Camden","Cardiff","Carmarthenshire","Ceredigion","Cheshire","City of Bristol","City of Edinburgh","City of Kingston upon Hull","City of London","Clackmannanshire","Conwy","Cornwall","Coventry","Croydon","Cumbria","Darlington","Denbighshire","Derby","Derbyshire","Devon","Doncaster","Dorset","Dudley","Dumfries and Galloway","Dundee City","Durham","Ealing","East Ayrshire","East Dunbartonshire","East Lothian","East Renfrewshire","East Riding of Yorkshire","East Sussex","Eilean Siar (Western Isles)","Enfield","Essex","Falkirk","Fife","Flintshire","Gateshead","Glasgow City","Gloucestershire","Greenwich","Gwynedd","Hackney","Halton","Hammersmith and Fulham","Hampshire","Haringey","Harrow","Hartlepool","Havering","Herefordshire","Hertfordshire","Highland","Hillingdon","Hounslow","Inverclyde","Isle of Anglesey","Isle of Wight","Islington","Kensington and Chelsea","Kent","Kingston upon Thames","Kirklees","Knowsley","Lambeth","Lancashire","Leeds","Leicester","Leicestershire","Lewisham","Lincolnshire","Liverpool","Luton","Manchester","Medway","Merthyr Tydfil","Merton","Middlesbrough","Midlothian","Milton Keynes","Monmouthshire","Moray","Neath Port Talbot","Newcastle upon Tyne","Newham","Newport","Norfolk","North Ayrshire","North East Lincolnshire","North Lanarkshire","North Lincolnshire","North Somerset","North Tyneside","North Yorkshire","Northamptonshire","Northumberland","Nottingham","Nottinghamshire","Oldham","Orkney Islands","Oxfordshire","Pembrokeshire","Perth and Kinross","Peterborough","Plymouth","Poole","Portsmouth","Powys","Reading","Redbridge","Redcar and Cleveland","Renfrewshire","Rhondda Cynon Taff","Richmond upon Thames","Rochdale","Rotherham","Rutland","Salford","Sandwell","Sefton","Sheffield","Shetland Islands","Shropshire","Slough","Solihull","Somerset","South Ayrshire","South Gloucestershire","South Lanarkshire","South Tyneside","Southampton","Southend-on-Sea","Southwark","St. Helens","Staffordshire","Stirling","Stockport","Stockton-on-Tees","Stoke-on-Trent","Suffolk","Sunderland","Surrey","Sutton","Swansea","Swindon","Tameside","Telford and Wrekin","The Scottish Borders","The Vale of Glamorgan","Thurrock","Torbay","Torfaen","Tower Hamlets","Trafford","Wakefield","Walsall","Waltham Forest","Wandsworth","Warrington","Warwickshire","West Berkshire","West Dunbartonshire","West Lothian","West Sussex","Westminster","Wigan","Wiltshire","Windsor and Maidenhead","Wirral","Wokingham","Wolverhampton","Worcestershire","Wrexham","York","Co. Antrim","Co. Armagh","Co. Down","Co. Fermanagh","Co. Londonderry","Co. Tyrone","end"];

states['US'] = ["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming","end"];

states['BR'] = ["AC","AL","AP","AM","BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB","PR","PE","PI","RJ","RN","RS","RO","RR","SC","SP","SE","TO"];


jQuery(document).ready(function(){


    jQuery("input[name=state]").attr("id","stateinput");


    jQuery("select[name=country]").change(function() {

        statechange();

    });


    statechange();


});


function statechange() {

    var state = jQuery("#stateinput").val();

    var country = jQuery("select[name=country]").val();

    if (states[country]) {

        jQuery("#stateinput").hide();

        jQuery("#stateinput").removeAttr("name");

        jQuery("#stateselect").remove();

        var stateops = '';

        for (key in states[country]) {

            stateval = states[country][key];

            if (stateval=="end") break;

            stateops += '<option';

            if (stateval==state) stateops += ' selected="selected"'

            stateops += '>'+stateval+'</option>';

        }

        jQuery("#stateinput").parent().append('<select name="state" id="stateselect"><option value="">Selecione...</option>'+stateops+'</select>');

    } else {

        jQuery("#stateselect").remove();

        jQuery("#stateinput").show();

        jQuery("#stateinput").attr("name","state");

    }

}[/code]

[color=#FF0000]Obs.: Somente para versão 4.5.2 do WHMCS[/color]

Pronto, todos os formulários terão os estados.

Espero ter ajudado

Edited by mcliano
Link to comment
Share on other sites

Editei o post inicial com o código do arquivo que vocês não encontraram. Lembrando que é só para a versão 4.5.2 do WHMCS original

Testei e funcionou, queria achar agora onde traduzir o choose que fica aparecendo quando não escolhe nenhum estado.

Obrigado pela dica

AtarWeb.com.br • Hospedagem de Site + SSL Grátis
█ Revenda de Hospedagem CPanel e DirectAdmin SSD + SSL Grátis
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Do you agree with our terms?