Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wigman/5023c5e92e009728578c to your computer and use it in GitHub Desktop.
Save wigman/5023c5e92e009728578c to your computer and use it in GitHub Desktop.
//Mass generate multi-dimensional shipping rates through elgentos.nl/tablerates
function insertValues(countries,weight,price){
var countryArr = countries.split(",");
for(i=0;i<countryArr.length;i++) {
var target = $("input[name^='price_"+countryArr[i]+"']");
if(target.filter(function() { return $(this).val() == ""; }).length == 0){
li = target.parents('li').closest('li');
li.find('a.addRow').click();
}
$("input[name^='price_"+countryArr[i]+"']").filter(function() { return $(this).val() == ""; }).val(price);
$("input[name^='from_"+countryArr[i]+"']").filter(function() { return $(this).val() == ""; }).val(weight);
}
}
//NL
insertValues("NLD","0","2.4390");
insertValues("NLD","999","4.0909");
//BE-DE
insertValues("BEL,DEU","0","4.0909");
insertValues("BEL,DEU","999","6.1983");
//ZONE1
insertValues("AUT,DNK,ESP,FRA,GBR,ITA,LUX,SWE","0","9.0909");
insertValues("AUT,DNK,ESP,FRA,GBR,ITA,LUX,SWE","999","11.9835");
//ZONE2
insertValues("BGR,CZE,EST,FIN,HUN,IRL,LTU,LVA,POL,PRT,ROU,SVK,SVN","0","9.0909");
insertValues("BGR,CZE,EST,FIN,HUN,IRL,LTU,LVA,POL,PRT,ROU,SVK,SVN","999","15.2893");
//ZONE3 INCL BTW
insertValues("CYP,GRC,HRV,MLT","0","9.0909");
insertValues("CYP,GRC,HRV,MLT","999","16.1157");
//ZONE3 EX BTW
insertValues("ALB,AND,BIH,BLR,CHE,FRO,GIB,GRL,ISL,MDA,MKD,MNE,NOR,SMR,SRB,TUR,UKR,VAT","0","11.0000");
insertValues("ALB,AND,BIH,BLR,CHE,FRO,GIB,GRL,ISL,MDA,MKD,MNE,NOR,SMR,SRB,TUR,UKR,VAT","999","19.5000");
//WORLD
insertValues("ABW,AFG,AGO,AIA,ALA,ANT,ARE,ARG,ARM,ASM,ATA,ATF,ATG,AUS,AZE,BDI,BEN,BFA,BGD,BHR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