Misc

From AWBS Wiki
Revision as of 20:12, October 11, 2010 by Samdrams (Talk | contribs)

Jump to: navigation, search

Alternate Order Wizard

After functions hook

Use our after function hook to run custom code after certain functions in the system. Afterfunction code can be run after;

  • customer log in
  • customer log out
  • customer creates a new account
  • hosting account provisioning
  • hosting account cancelled (cancel hosting job run in the job queue)
  • hosting account suspended
  • hosting account unsuspended
  • domain registration
  • invoice payment
  • dedicated server order is placed
  • customer edit profile (account contact information)

Please review includes/afunctions/afunctions.php file for details

Using alternate package display - layout 2

If you wish to use the alternate display for your packages;

Enter desired information displayed in the 'Layout 2 Package Display Text' for each hosting package. You can use html code in that text area field, just be careful not to use special characters or quotes in the code. Do not include full html page tags, only enter a table or div tags to start and end your code.

In your templates/common_files directory, rename hstable-reanme-me.php to hstable.php.

This will change the display to layout 2 for all hosting packages in the system. (Layout 1 uses hostingtable.php file)


For Dedicated Servers, do the same as above, except rename the templates/common_files/dstable_rename_me.php file to dstable.php

Displaying testimonials

Add quotes you have received from your customers that you want to post on your site.


The testimonies can be displayed using these variables on any page:


<?=$quotes[0][testimonial]?>
<?=$quotes[0][sig1]?>
<?=$quotes[0][sig2]?>
<?=$quotes[1][testimonial]?>
<?=$quotes[1][sig1]?>
<?=$quotes[1][sig2]?>


You can display as many as you like, just increment the $quotes number for each one. The above example will display 2 testimonials.


Also, set the number_of_quotes to a value of 2 in the Extended System Configuration. (2 to display 2 quotes at a time, adjust as per how many display code settings you put code in the template)

(As long as this number is greater than the number of quotes in the db, all will be returned into the array.)


The testimonials in your database will be randomly chosen to fill the displays.


Displaying the Shopping Cart Box

Variables used to create a 'shopping cart' box on your site:


You have <?=$curcart[items]?> items in your cart.
<a href="<?=$curcart[view]?>">View Cart</a>
<a href="<?=$curcart[checkout]?>">Checkout</a>

Changing the number of tlds displayed on the site home page

Edit the tlimit setting in the Extended System Configuration to set the number of tlds to show on your home page.


Custom Fields

In the AWBS Configuration area, click the Custom Field Management link. Click the Add Record link at the top.

Enter a name for the custom field.
Select the type of field you desire for this custom field.
Enter text to display by the field in the Text Display field.
Enter a default value. If field type is Pulldown, enter all options separated by a pipe (|)

Check the Response Required checkbox if you require this information from your customers.

Check the Visible When Ordering checkbox if you want this field visible when a customer is placing an order.

Check the Visible in Users Package if you want the customer to be able to view this information after their package has been ordered and filled.

Click the Save Record button.


This will now be an available custom field that can be used for any hosting package or dedicated server package. To assign a custom field to a package, edit the hosting or dedicated server package, scroll down to the 'Assign Custom Fields' section and click the Assign custom fields link. Check all fields you want to use for that package in the popup window that opens and click the Save Changes button.

Custom User Fields

There are 3 available custom fields you can setup to gather custom information during new account creation.


To enable the custom fields, edit the includes/languages/[each_language]/createacct.php and the editprofile.php files with a text editor.

Remove the remarks (//) from the beginning of the lines for the custom fields you wish to use.

Be sure to edit the createacct.php and editprofile.php files in all languages that you offer.

Look for this section:


//CREATEACCOUNT CUSTOM FIELDS;uncomment the below variables to enable adding custom fields to the customer's record during create account
//define(CUSTOM1, "custom 1 field");
//define(CUSTOM2, "custom 2 field");
//define(CUSTOM3, "custom 3 field");
//end custom fields


Example of setting up one extra field used for collecting a customer's VAT ID:


//CREATEACCOUNT CUSTOM FIELDS;uncomment the below variables to enable adding custom fields to the customer's record during create account
define(CUSTOM1, "Your VAT ID");
//define(CUSTOM2, "custom 2 field");
//define(CUSTOM3, "custom 3 field");
//end custom fields


To configure the field(s) as required, edit the same files (createacct.php and editprofile.php in each language directory).

Look for this:

//v1.2.4
//define(CUSTOM1NOTREQUIRED,	"1");
//define(CUSTOM2NOTREQUIRED,	"1");
//define(CUSTOM3NOTREQUIRED,	"1");

For the above VAT example, to make the VAT field required change to this:

//v1.2.4
define(CUSTOM1NOTREQUIRED,	"1");
//define(CUSTOM2NOTREQUIRED,	"1");
//define(CUSTOM3NOTREQUIRED,	"1");

To make it not required, change to this:

//v1.2.4
define(CUSTOM1NOTREQUIRED,	"0");
//define(CUSTOM2NOTREQUIRED,	"1");
//define(CUSTOM3NOTREQUIRED,	"1");

Creating Custom Variables

About

AWBS themes are customizable on many fronts. One extremely powerful customization method you can utilize is adding your custom data by placing variables and/or php scriptlets in your template files. Sometimes you may need to place the same script or value over and over again in many pages. You can do this using custom variables.

Custom variables are stored in a file called gparser_user.php, this file can be found in the includes folder in your AWBS root directory. If you installed AWBS to home/user/public_html/ on your server, gparser_user.php will be found in home/user/public_html/includes/gparser_user.php.sample - remove the sample from the file name to so it starts taking effect.

Once you renamed the file, you can start placing your variables and php scriptlets there.

Format

<?php
//Use the following format for additions:

//$template->set_var("template_variable", "your text"); 

?>

Variable Examples

  1. $template->set_var("my_company_name", "Advanced Webhost Billing System");
    This example will set a variable $my_company_name. To display it,
    <?php echo $my_company_name; ?>
    or
    <?=$my_company_name?>

Notes

  1. PHP Scripts, functions, classes, and globals are allowed.
  2. When using a custom function that returns results, make sure to parse the result in a variable
    $template ->set_var("custom_variable", $your_result);
  3. To run MySQL Queries, you need to include dbconfig.php:
    include(WORKDIR."/includes/dbconfig.php");


Overriding system generated hosting usernames and/or passwords

If you make this file it will be included:

/includes/mycartpwd.php

The variables you will need are:

$this_username
$this_password

These 2 variables hold the current system generated username and password that will be written to the DB and used.

Other avaliable variables are:

$row[cartsld] is the domain sld
$row[carttld] is the domain tld


You can manipulate them as you wish here (using php code), but be sure you write your changes back the same variable names. Also, be sure to respect hosting control panel rules (ex: if the username is too long or short the account creation will fail etc..).

Also, you should incorporate our username dupecheck into your routines.

$xcheck=check_username($this_username,$row[cartId]);

You would check that $xcheck is not greater than 0 and if so, re-generate the username.


Domain lookup box

Here is form code to use to add a domain lookup box anywhere you desire:

 <form method="post" action="http://[your_AWBS_url]/spincheck.php" target="_blank" id="formname" name="formname">
 <input type="hidden" name="action" value="check">
 <input name="cSSld" type=text class="formfield" id="idsld" size="22" maxlength="272">
 &nbsp;.&nbsp;
 <select name="ttld[]">
 <option value="com">com</option>
 <option value="net">net</option>
 <option value="org">org</option>
 </select><br />
 <input name="Submit" type="submit" value="Go">
 </form>
 

Be sure to substitute the post action value url to your AWBS url in the form line.
Add additional tld options as you desire for the tld drawdown box.
Edit the html as desired for your look.

Executing code upon addon package queue job run

Make a file matching your addon package name and place it here: includes/addons/addonname.php

Example: if your addon package name is 1234, then you would make a file named 1234.php, enter the code you want run when that
addon order is processed, and place that file in the includes/addon directory.

Then when the addon job is run in the queue, this code will be executed.


Note:
If the job is a success, you must set:  $regstatus = "Closed";
If the job is a fail you must set:  $regstatus = "Error";
If the job results in an error, you can stuff error information into the variable $queue_return.

Executing code upon Other package queue job run

Configure your other package in the other package setup area.

Select the desired selection for the Has Custom Queue field.
Write your custom code to be run at the time the other package is run in the queue.
Name the file as per your other package name and place it in the includes/customqueue directory.

example: your other package name is 'ssl'.
Name your custom script file: ssl.php
Place your file in the includes/customqueue dirctory.

Auto Login System

The auto login system can be used to have your clients already logged in at your AWBS site from a link at another site/system. This feature was added in AWBS version 2.7.6

To enable: Extended System Configuration >> disable_als set to a value of 0
Click the Submit Changes button.

Here is a sample of how to use the ALS;

<?php
// AWBS account username 
$user="username";
// AWBS account password
$pass="password";
//access key from AWBS system options page 
$maccesskey="2c416b1bb5e33a27eb8d3df7de7f8f46";

$p_s[user]=$user;
$p_s[pass]=urlencode($pass);
$p_s[maccesskey]=urlencode($maccesskey);
$p_s[udate]=strtotime("now");
$p_s_arr=serialize($p_s);
$sendstr=urlencode(base64_encode($p_s_arr));

echo "<a href=\"aLogIn.php?als=$sendstr\">Click to Login</a>";
exit;
?>

Displaying the payment images

To display the images for the pay types you accept anywhere on the site, use this code:

<?php echo payment_images();?>

Login Box

Use the below code on any website/webpage for your customers to login to their AWBS account.
(Be sure to replace "[your_AWBS_url]" with your AWBS full URL)

<form method="post" action="[your_AWBS_url]/aLogIn.php" id="loginForm" name="form2">
<input type="hidden" name="action" value="login" />
Username: <input type="text" maxlength="272" name="newuid" id="newuid" value="" /><br />
Password: <input type="password" maxlength="60" name="password1" id="password1" /><br />
<input type="submit" name="Submit" value="Login" />
</form>

Unique title, keywords and description based on site page

(v2.8.0 and newer)

By default, the page title, keywords and description are configured in the Website/Company Info page of the Configuration.

If you have pages you want to have unique title, keywords and/or description, you can define them in that page's language file.

For example;
You want your check.php page to have a different title, keywords and description
than the rest of the site.
Edit the includes/language/english/check.php language file. Add these lines (edit between the quotes as desired): define(META_TITLE, "Domain Names"); define(META_DESC, "The best prices on dot com domain names in the industry"); define(META_KEYWORDS, "domains, domain names, find your dot com, register");


Repeat the above for any page you want unique meta tags.

Removing package type pulldown

The package type pulldown box at the top of hosting.php can be removed by editing the templates/common_files:

  • hstable.php - For hosting package pages
  • dstable.php - For dedicated server pages

Move each file to your theme folder first before editing so changes are not lost during an update. (eg. - /templates/default )

In each file, look for the following lines of code and remove them:

$cats = build_otype_list($spt,$pt);
$hostingtable .= "<form action=\"hosting.php?pt=$pt\" method=\"post\" name=\"theForm\">
<table class=\"width-100 data alc\">
<tr><td class=\"boxtitle\" colspan=\"2\">".PKGCNFG."</td></tr>
<tr>
<td class=\"vlm ar bold width-25\" nowrap=\"nowrap\">".PKGCTGRS.": </td>
<td class=\"al vlt\"><select class=\"width-75\" name=\"quicklink\" onchange=\"showObject(); openURL();\">$cats</select></td>
</tr>
</table>
</form><br />";

Disabling Domain name ordering

1. Edit your menu to remove the Domain Services menu section.
The menu file is templates/common_files/group1menu.php file. (If you use portal mode, it will be group1cpmenu.php)
Copy the group1menu.php file to your theme directory (example: templates/default ) then edit it. Remove the following:

<li>
    <a href="#" class="<?=$page_domainSelected?> w-100 ac"><?=TMB3?></a>
    <ul>
        <li><a href="<?=$base?>/check.php" ><?=TMB3A?></a></li>
        <li><a href="<?=$base?>/transcheck.php" ><?=TMB3B?></a></li>
        <?php if ($use_forsale=="1" ){ ?><li><a href="<?=$base?>/forsale.php" ><?=TMB3C?></a></li><?php } ?>
        <li><a href="pricingfull.php"><?=TMB3D?></a></li>
        <?php if ($reseller_free_plan=="1" ){ ?><li><a href="<?=$base?>/resellers.php" ><?=TMB3E?></a></li><?php } ?>
        <li><a href="<?=$base?>/whois.php" ><?=TMB3F?></a></li>
    </ul>
 </li>

Now your menu will not reflect the 'Domain Services' menu column.

2. Edit the hosting signup process to remove options to order a domain name during the hosting order process.
In the templates/common_files directory rename hsignup-regoff.php to hsignup.php.

3. Edit the member area menu to remove the 'Domains' section.
Copy the templates/common_files/usermenu.php file to the templates/[configured_theme] directory. Edit the file and remove the following code;

  $umenu.="<div class=\"vmenuSep\"> </div>";
	$umenu.="<div id=\"UsersMenuPanel2\" class=\"CollapsiblePanel\">";
    $umenu.="<div class=\"CollapsiblePanelTab\" onclick=\"SprySaveState('UsersMenuPanel2');\">".UMMENU2."</div>";
	$umenu.="<div class=\"CollapsiblePanelContent\">";
	#end open sub-menu
	$umenu.="<ul>";
	$umenu.="<li><a href=\"$base/manage.php\">".MANAGEDOMAINS."</a></li>";
	$umenu.="<li><a href=\"$securebase/profilemgmt.php\">".DOMAINPROFILES."</a></li>";
	$umenu.="<li><a href=\"$base/transquery.php\">".UMTRANSTAT."</a></li>";
	if($use_forsale==1){
		$umenu.="<li><a href=\"$base/sellhome.php\">".MYDOMAINS4SALE."</a></li>";
	}
	$umenu.="</ul>";
	$umenu.="</div>";
	$umenu.="<script type=\"text/javascript\">var UMPS2 = SpryGetState(\"UsersMenuPanel2\"); var UsersMenuPanel2 = new Spry.Widget.CollapsiblePanel(\"UsersMenuPanel2\", {contentIsOpen:UMPS2});</script>";
	$umenu.="</div>";
 

4. Remove the 'Quickly manage a domain' section and other domain references from the member home page.
Copy the templates/common_files/welcome.php file to the templates/[configured_theme] directory.
Edit removing the following code;

<form action="welcome.php" method="post" name="theForm2" class="awform" onsubmit="submitonce(this); showObject(true,false);">
<?=$boxtop?>
<fieldset>
<legend><span class="boxlegend"><?=QUICKMANAGE?></span></legend>
<table class="width-100">
<tr>
<td class="al paddZero">
<input type="text" name="qdomain" id="fe-searchdomain" class="welcomeDomainSearch" value="Enter domain name to Quickly manage" onclick="if(this.value=='Enter domain name to Quickly manage')this.value='';" onblur="if(this.value=='')this.value='Enter domain name to Quickly manage';" />
<input type="hidden" name="qmanage" value="1" />
<input type="submit" name="submit" value="<?=QUICKMANAGECLICK?>" /></td>
  </tr>
  </table>
</fieldset>
<?=$boxbottom?>
  </form>
 

and this;

                                            <tr>
                                                <td class="data width-70 al"><?=MEMBERNUMDOMAINS?></td>
                                                <td class="data bold width-15 ac"><?=$numdomains?></td>
                                                <td class="data bold width-15 ac"><a href="<?=$base?>/manage.php"><?=VIEWEDIT?></a></td>
                                            </tr>
                                            <tr>
                                                <td class="data width-70 al"><?=MEMBER30DAYS?></td>
                                                <td class="data bold width-15 ac"><?=$numedomains['thirty']?></td>
                                                <td class="data bold width-15 ac"><a href="<?=$base?>/manage.php?search=1&list=30day"><?=VIEWEDIT?></a></td>
                                            </tr>
                                            <tr>
                                                <td class="data width-70 al"><?=MEMBEREXPIRED?></td>
                                                <td class="data bold width-15 ac"><?=$numedomains['expired']?></td>
                                                <td class="data bold width-15 ac"><a href="<?=$base?>/manage.php?search=1&list=expired"><?=VIEWEDIT?></a></td>
                                           </tr>
                                            <tr>
                                                <td class="data width-70 al"><?=MEMBERTRANSFERS?></td>
                                                <td class="data bold width-15 ac"><?=$numedomains['pendingtransfer']?></td>
                                                <td class="data bold width-15 ac"><a href="<?=$base?>/manage.php?search=1&list=transfer"><?=VIEWEDIT?></a></td>
                                            </tr>
                                            <tr>
                                                <td class="data width-70 al"><?=MEMBER4SALE?></td>
                                                <td class="data bold width-15 ac"><?=$counts['forsale']?></td>
                                                <td class="data bold width-15 ac"><a href="<?=$base?>/sellhome.php"><?=VIEWEDIT?></a></td>
                                            </tr>