Blog

Latest Blog Articles

Core table in wordpress plugin

Many times when we develop custom plugin we need a listing table for records. WordPress has inbuilt table template class for listing and it can be inherit in our wordpress plugin to use core style of table and pagination.
Wordpress use class WP_List_Table to display data of posts, comments etc and this class have all important methods like sorting, paging, searching.
Here we are going to understand that how can we use this useful thing in our custom plugin.

Before start creating listing table we should add condition of class include.
if( ! class_exists( 'WP_List_Table' ) ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}

Create class and extend core class of WP
class My_Store_Table extends WP_List_Table {
}

Prepare Columns and get rows
Please make sure you have modified db table name. In this example table name is listing_example.
function get_columns(){
$columns = array(
'store' => 'Store',
'address' => 'Address',
'mobile' => 'Mobile'
);
return $columns;
}

function prepare_items() {
$columns = $this->get_columns();
$hidden = array();
$sortable = array();
$response = $this->get_store_list();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->items = $response['data'];
}

function get_store_list() {
global $wpdb;
$total_items = 0;
if ( isset( $_POST['s'] ) && ( !empty( $_POST['s'] ) ) ) {
$search = trim( $_POST['s'] );
$result = $wpdb->get_results(
$wpdb->prepare( "SELECT * FROM listing_example
WHERE fieldName LIKE %s"
), ARRAY_A
);
} else {
$orderby = !empty ( $_GET["orderby"] ) ? mysql_real_escape_string ( $_GET["orderby"] ) : 'fieldName';
$order = !empty ( $_GET["order"] ) ? mysql_real_escape_string ( $_GET["order"] ) : 'ASC';
$order_sql = $orderby.' '.$order;

$total_items = $wpdb->get_var( "SELECT COUNT(*) AS count FROM listing_example" );
$paged = !empty ( $_GET["paged"] ) ? mysql_real_escape_string ( $_GET["paged"] ) : '';

if ( empty( $paged ) || !is_numeric( $paged ) || $paged <= 0 ) { $paged = 1; } $totalpages = ceil( $total_items / $this->_per_page );

if ( !empty( $paged ) && !empty( $this->_per_page ) ){
$offset = ( $paged - 1 ) * $this->_per_page;
$limit_sql = (int)$offset.',' . (int)$this->_per_page;
}

$result = $wpdb->get_results( "SELECT * FROM listing_example ORDER BY $order_sql LIMIT $limit_sql", ARRAY_A );
}
$response = array(
"data" => stripslashes_deep( $result ),
"count" => $total_items
);

return $response;
}

Define Column
To define each column, WP_List_Table has a function column_default
function column_default( $item, $column_name ) {
switch( $column_name ) {
case 'store':
case 'address':
case 'mobile':
return $item[ $column_name ];
default:
return 'id';
}

That’s it. Now all code have been prepared and we can use it in our listing. Below is code to call function and display listing

$storeTable = new My_Store_Table();
echo '

Store Listing Table

';
$storeTable->prepare_items();
$storeTable->display();
echo '

';

How to Approach Automation

Automation, in true sense, relieves the person from manual efforts by regulating the repetitive tasks to an extent. Automation is the preferred choice in most industries and software may also be brought into the circle of automation, but without deviating from its actual definition. Automation should not become a costly affair for an engineer to perform.

So, here comes the big question: How to approach Automation? “

That brings us to the basics of Automation, i.e. what and when to automate. It is not possible to automate everything in software; however test scenarios those are time consuming and executed repeatedly can be considered for automation. GUI items, Business Critical test cases, connections with database, data validation generally make good automation stuff. Test automation should be done when the projects are large and critical to business, requires frequent regression testing, requirements are not changing frequently, load and performance tests needs to be included, and most importantly project build is stable.

It is required to follow a proper approach to create and execute automation test script so as to increase the efficiency in automating the software. Firstly, define the scope of automation, taking in view the test scenarios to be tested, technical feasibility, complexity and priority of selected tests. After defining the scope, test tool selection should be made depending upon the software interface and technology used. A proper framework is needed to execute automation scripts, so the framework implementationon the selected test tool should be undertaken.

Improve Quality & Eliminate Errors Through Data Enrichment

Have you invested a lot of time and money into processing your database, but have still not been able to make sense out of your data? This is a problem that most organizations face, when dealing with inaccurate data. How do you optimize the potency of your database and catapult your sales and marketing efforts? The answer to this question is Data Enrichment Services.

If your business belongs to the insurance, banking, telecommunications or retail industry, you will know that the quality of data is critical and can have a direct impact on your company/ Investing in data enrichment services from India can help you accurately organize, format, modify, classify, replace, delete or correct information gathered across data fields.

Data enrichment is a niche field, where trained data experts will rectify any type of irregularity in your data and make your data more effective. By refining your database, you can come up with targeted sales and formulate direct marketing campaigns. An outsourced service provider like Outsource2india can update old or obsolete data with new information, conduct referential integrity checks, organize mailing lists, use consistent attribute names and develop homogenous pools of data.

In data scrubbing, specialized tools are used to carefully examine a database for flaws. Various algorithms, rules and look-up tables are used to correct different types of errors. For instance, finding out duplicate records or adding missing zip codes can be achieved through the use of database enrichment tools.

When to use data enrichment?

  • Your data is gathered from different sources, and you are left with data in inconsistent formats that cannot be evaluated or used
  • Your current data has several inaccurate/duplicate records and incomplete descriptions
  • You require data from external sources in order to complete your database and enhance its quality
  • You want to improve the accuracy of your customer data

Increase sales force efficiency with SugarCRM

SugarCRM is a customer relationship management application that comes in three versions: Sugar Open Source, Sugar Professional and Sugar Enterprise. The open source version contains over 85% of the functionalities of the commercial versions. Many medium sized and large companies with a growing sales and CRM teams have realized the benefits of efficient management of customer relationships though SugarCRM.

Your company can also implement SugarCRM to increase operational efficiencies, streamline CRM functions and make your inside sales and customer support teams more productive. You can utilize the open source version and customize it to meet your needs. Outsource2india can help you in building a powerful CRM application with selected features at a very low cost. This solution can be deployed on almost any environment. With expertise in Linux, Apache, MySQL and PHP, our SugarCRM development team has worked on many simple and complex customization assignments for global clients.