• Online Demo
  • 30-day Free Trial

Go Back   Blesta Forums > Developer Corner > API & Order Forms

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 09-13-2007, 07:16 PM
Cody's Avatar
Cody Cody is offline
Blesta Developer
 
Join Date: Apr 2006
Location: Tustin, CA
Posts: 632
Default Configuring Your Order Form (version 1.1.0-1.3.3)

THIS ARTICLE IS MEANT FOR VERSIONS 1.1.0-1.3.3 OF BLESTA ONLY.

This tutorial will guide you through setting up an order form for use with Blesta version 1.1.0. No programming knowledge is required for basic set up.

ALWAYS make a back up of any file you modify before you make any changes!

There are four main section of this document:
Configuring Order Settings
Customizing Templates
Advanced: Writing Your Own
FAQs


Configuring Order Settings
1. Navigate to the order directory: /order/

2. Open index.php in your favorite text editor.

3. You will be working in the following section of this file:
Code:
/*******************************************************************************
* Order Settings
*******************************************************************************/
$blesta_url = "http://192.168.0.7/api.php"; // The full URL to the API page.
$remote_key = "abcdefg1234567";  // Remote access key as defined in Tools -> Standard Settings.
$emailadmins = "true"; // E-mails admins when a service fails to be added unexpectedly.
$emailreceipt = "true"; // E-mails a receipt to the customer if their card charge is approved.
$autodebit = "true"; // All new accounts have auto debit set to this value.
$title = "Order"; // Title as displayed in the user's browser.
//$module = "cpanel"; // Name of package module to use in this order.

$testmode = "true"; // Note: setting to "false" will not force live mode. If set to "true" will force test mode.
$setasdefault = "true"; // If a user pays with a credit card this will set that contact information as the default billing contact.
$overwrite = "true"; // If a user pays with a credit card and this information matches the first name & last name of a contact already under that account it will overwrite the contact details with the new details, otherwise a new contact will be created.

// Web hosting specific settings
$webhosting = true; // true if this order is for web hosting, false otherwise.
$domain_pid = "41"; // The package ID used to create domain registrations.
$domain_term = "12"; // Ther term used to create domain registrations.

// Errors
$_invalid_coupon = "That coupon code does not exist or is not applicable to that service.";
$_domain_not_available = "That domain is not available.";
$_multiple_users = "Multiple accounts are associated with that E-mail address. Please enter your User ID.";
$_invalid_credentials = "The E-mail/UID and Password combination you entered is invalid.";
$_cc_error = "The Credit Card and/or expiration date you entered appears to be invalid. Please try again.";

/*******************************************************************************
* End Order Settings
*******************************************************************************/
4. The first order of business is to change

Code:
$blesta_url = "http://192.168.0.7/api.php";
$blesta_url is a variable that identifies the full URL path to the Blesta API driver file. If you have installed Blesta on www.yourdomain.com, inside a folder called "blesta", it should look like this:

Code:
$blesta_url = "http://www.yourdomain.com/blesta/api.php";
5. Next you will need to supply your Remote Access Key. This is the Key you set during the installation process and you can find it by going to Tools -> Settings, under Standard Settings. Simply replace abcdefg1234567 with your key.

Code:
$remote_key = "abcdefg1234567";
6. $emailadmins, $emailreceipt, and $autodebit are set to "true" by default, but if you wish you can turn these off by setting them to "false". It is recommended to leave these settings as they are.

7. $title is the Title that is given to the browser.

8. $module is an optional variable (it is commented out above with two forward slashes). If you wish for your oder form to only allows signups of cPanel accounts simply remove the two forward slashes here. If wish for your order form to only allow DirectAdmin accounts to be created replace "cpanel" with "directadmin". The same follows for any module (e.g. "enom", "none").

9. $testmode if set to "true" will NOT attempt to process a credit card during the transaction. If set to "false" the default setting in Blesta for the selected Non-Merchant gateway will be used. CAUTION: You MUST set this to "false" in a live environment, or users will get all their services for free! Please note that this ONLY applies to credit card transactions (i.e. merchant gateways).

You can set individual gateway Test Modes in Tools -> Gateways. $setasdefault and $overwrite affect creating/updating contact information and should be left alone by default.

10. The next block of settings only apply to web hosting orders.

Code:
// Web hosting specific settings
$webhosting = true; // true if this order is for web hosting, false otherwise.
$domain_pid = "41"; // The package ID used to create domain registrations.
$domain_term = "12"; // Ther term used to create domain registrations.
If $webhosting is set to true, the user will be prompted to enter their domain information (for ordering or transfering their domain). If you set this to false, users will not be prompted for this information, but they will still be able to place web hosting orders. $domain_pid is the Package ID set in Blesta that will be used for Domain Registration. $domain_term is the Term that will be used to create domain registration. Please note that this value MUST match a term set for your Domain Registration package in Blesta.

11. The rest of the variables simply set the error messages for the order form, these should be self explanatory.
__________________
Cody
Lead Developer

Blesta
Professional Billing
www.blesta.com

Last edited by Cody; 07-18-2008 at 09:14 PM.
  #2  
Old 09-13-2007, 07:17 PM
Cody's Avatar
Cody Cody is offline
Blesta Developer
 
Join Date: Apr 2006
Location: Tustin, CA
Posts: 632
Default

Customizing Templates
Note: This section is recommended for users who are at least somewhat experienced with HTML/CSS.

1. navigate to /order/templates/

2. Each of the files listed in this directory contain PHP/HTML.

structure.pdt - Contains the basic structure of each page in the order form. You can easily modify the header and footer of this file to make it appear more like your web site. For most users this is the only template file you will wish to modify.

step1.pdt through step4.pdt - Contain the HTML specific to each step in the order form.

step5.pdt contains the Thank You page for users whose credit cards have been successfully processed.

3. To customize the look and feel of the entire order process you will want to modify the style sheet for this order form. This can be found in /order/css/master.css


Advanced: Writing Your Own
Note: This section is recommended for users with a working knowledge of PHP and HTML.

1. Download the Blesta API documentation at http://www.blesta.com/documents/API_Documentation.pdf

2. Examine /order/index.php and /order/index.old.php. These files make frequent calls to functions in /order/inc/func.php. Open func.php to see how API calls are placed, and the parameters required to make such API calls. More calls are supported than are included in func.php, since this file is not intended as a SDK, but rather as a working example of the Blesta API system.

3. In /api_samples/ you will find additional API samples. To execute these examples you will need to make similar changes to those made to the order form (e.g. supplying the path to your Blesta API driver file and your Remote Access Key).

4. Remember, you have FULL control over the order process, enjoy it!
__________________
Cody
Lead Developer

Blesta
Professional Billing
www.blesta.com

Last edited by Cody; 09-13-2007 at 07:39 PM.
  #3  
Old 09-13-2007, 07:17 PM
Cody's Avatar
Cody Cody is offline
Blesta Developer
 
Join Date: Apr 2006
Location: Tustin, CA
Posts: 632
Default

FAQs
Q. How can I have users place orders on www.mydomain.com when I have Blesta installed on www.myotherdomain.com?

A. The answer is simple. Simply take the entire order directory and place it somewhere on www.mydomain.com. That's it! (you may also need the Source Guardian loader files found in the ixed directory of your Blesta install, if you don't already have them on the remote server).

Q. Is there anyway I can direct people to the order page with a package and possibly a coupon already selected? I want to send my customers a direct link to order a product and give them a coupon code I have entered in Blesta.

A. Easy! Let's say your order form is installed on www.mydomain.com. You will want to send your customers a link to
Code:
www.mydomain.com/index.php?step=2&pid=3&term=1&coupon=abcd
Where 3 is the Package ID for the service you are linking them to, 1 is the term in months supported by this package, and optionally abcd is the coupon code you set up in Blesta for this Package. If you do not wish to supply a coupon code simply leave &coupon=abcd off of this string.
__________________
Cody
Lead Developer

Blesta
Professional Billing
www.blesta.com

Last edited by Cody; 09-21-2007 at 04:30 PM.
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoices on order form naja7host API & Order Forms 1 01-01-2010 10:05 PM
API Sample Order Form davidolaj API & Order Forms 1 07-05-2009 10:50 PM
Integrated order form suggestions FB-Ryan Feature Requests 7 04-12-2009 06:35 PM
Order Form - Again naja7host API & Order Forms 4 12-20-2008 12:33 PM
problem with configuring order form mo_mughrabi API & Order Forms 5 01-17-2008 07:01 PM


All times are GMT. The time now is 05:18 AM.