Handle additional fields

From NETIM
Jump to: navigation, search

Contents

Fleche.gif Introduction

Some extensions needs additional informations to be registered. We're gonna show you how you can configure BoxBilling to be able to sell those extensions.


Fleche.gif How to proceed

1. First you need to look on our page if the extension you want to be able to sell needs additional informations.

Liste des extensions ayant besoin d'informations additionnelles (en anglais)

2. Two possibilities:

- The extension that you want to sell is not on this page, congratulations you do not need any custom configuration.

- The extension that you want to sell is on the page, you're gonna need to look up the page of the extension.

3. On the extension page, look up for the section Semantic rule for the API and sub-section Contacts. Here you'll find all the informations you'll need later on.

4. Once you found those informations, you'll need to edit the file mod_servicedomain_order_form.phtml (located in your_boxbilling_install/bb-modules/ServicesDomain/html_client/). You'll have to insert three snippets of code to finish the configuration.

Snippet 1

Insert this code

    <div id="additionalFields"></div>

as shown in the picture below.

BB additional fields1 en.gif

Snippet 2

Insert this code

    $('#additionalFields').html(handleAdditionalFields(tld));

as shown in the picture below.

BB additional fields2 en.gif

Snippet 3

This step is the most tricky, because you will have to enter some input yourself to satisfy your needs.

Below is an example to ease you through this step.

Example for .sk and .aero

Insert this code

        function handleAdditionalFields(tld)
	{
		returnValue = '';
		if(tld == '.sk')
		{
			returnValue += "<label>Statut</label>" +
							"<select id='bodyForm' name='bodyForm'>" +
								"<option value='ORG'>Organisation</option>" +
								"<option value='IND'>Personne physique</option>" +
							"</select>";
			returnValue += "<label>Numéro d'entreprise (si applicable)</label><input type='text' id='companyNumber' name='companyNumber'/>";
		}
		else if(tld == '.aero')
		{
			returnValue += "<label>AERO_AUTHID</label><input type='text' id='AERO_AUTHID' name='AERO_AUTHID' required=required/>";
			returnValue += "<label>AERO_AUTHKEY</label><input type='text' id='AERO_AUTHKEY' name='AERO_AUTHKEY' required=required/>";
		}
		return returnValue;
	}

as shown in the picture below.

BB additional fields3 en.gif

Adapts to your needs

To adapt this example to your need, here is how to proceed:

1. We take it for granted that you already have inserted the 3snippets above, and now you would like to sell a new extension, for example UA

2. In the section Semantic rules for the API', then Contacts you see that to register a domain of this particular extension, the owner need to specify:

- trademark name (tmName)

- trademark number (tmNumber)

- trademark type (tmType)

3. We only need to change the code to take these requirements into account.

First we add additional close to the if-statement to manage the UA extension

                // Manage UA
                else if(tld == '.ua')
                {
                        // TODO
                }

Then inside this block we need to explicitely tell what we want to build in the interface

                // Manage UA
                else if(tld == '.ua')
                {
                        //trademark name
                        returnValue += "<label>Nom de trademark</label><input type='text' id='tmName' name='tmName'/>
                        //trademark number
                        returnValue += "<label>Numéro de trademark</label><input type='text' id='tmNumber' name='tmNumber'/>
                        //trademark type
                        returnValue += "<label>Type de trademark</label><input type='text' id='tmType' name='tmType'/>
                }

The full code for .aero, .sk and .ua looks like

        function handleAdditionalFields(tld)
	{
		returnValue = '';
		if(tld == '.sk')
		{
			returnValue += "<label>Statut</label>" +
							"<select>" +
								"<option value='ORG'>Organisation</option>" +
								"<option value='IND'>Personne physique</option>" +
							"</select>";
			returnValue += "<label>Numéro d'entreprise (si applicable)</label><input type='text' id='companyNumber' name='companyNumber'/>";
		}
		else if(tld == '.aero')
		{
			returnValue += "<label>AERO_AUTHID</label><input type='text' id='AERO_AUTHID' name='AERO_AUTHID' required=required/>";
			returnValue += "<label>AERO_AUTHKEY</label><input type='text' id='AERO_AUTHKEY' name='AERO_AUTHKEY' required=required/>";
		}
                // Manage UA
                else if(tld == '.ua')
                {
                        //trademark name
                        returnValue += "<label>Trademark name</label><input type='text' id='tmName' name='tmName'/>
                        //trademark number
                        returnValue += "<label>Trademark number</label><input type='text' id='tmNumber' name='tmNumber'/>
                        //trademark type
                        returnValue += "<label>Trademark type</label><input type='text' id='tmType' name='tmType'/>
                }
		return returnValue;
	}

Fleche.gif Important informations to keep in mind

1. Between the <label> and </label> tags, you put text that will be visible to the clients.

In our example we did write Trademark name, or company number.

2. In the <input tag, the text you put after id= and name= MUST be the name of the field as describe on the Netim wiki for the extension. In our previous example, we had to write respectively tmName, tmNumber and tmType to make it work properly.

3. The <select> tag follow the same rule that the <input tag, see above.

Personal tools
Namespaces

Variants
Actions
Your account
Domain names
Contact Us
Web Hosting
SSL Certificate
Email Hosting
Website Builder
Resellers
Affiliates
Miscellaneous