Jump to content

Package Adding Script


flangefrog

Recommended Posts

This is a JavaScript you can customise for your own use if you're adding a few similar packages like domains. Run it by pasting in the dev tools console or make it into a bookmarklet.

//Set module
$("#module_id").val(8).change();

//Set group
$("#available option[value=2]").appendTo("#assigned");

//Get domain name
var domain = prompt("Enter the domain:", ".com");

//Set package name
$("#name").val(domain);

//Get price
var price = prompt("Enter the price:", "99.99");
price = parseFloat(price) * 10 + 10;

//Set price
$(".price_row").last().find("input.term").val("1");
$(".price_row").last().find("select.period").val("year");
$(".price_row").last().find("input[name='pricing[price][]']").val(price.toFixed(2));

//Add extra terms
for(x = 2; x <= 10; x++) {
	$("a.price_row_add").click()
	$(".price_row").last().find("input.term").val(x);
	$(".price_row").last().find("select.period").val("year");
	$(".price_row").last().find("input[name='pricing[price][]']").val((price * x).toFixed(2));
}

//Set tax
$("#taxable").prop('checked', true);

//Wait for 500ms as module options loaded via ajax
setTimeout(function(){
	//Set domain
	$("input[value='" + domain + "']").prop('checked', true);

	//Set nameservers
	$("#logicboxes_ns1").val("ns1.orangehost.co.nz");
	$("#logicboxes_ns2").val("ns2.orangehost.co.nz");
	$("#logicboxes_ns3").val("ns3.orangehost.co.nz");
	$("#logicboxes_ns4").val("ns4.orangehost.co.nz");

	//Save
	$("a.submit").click();
}, 500);
Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...