Why you should take your business online ? – 8 Reasons

1. Best and Easy Customer Support

customer satisfaction

Customer support is one of the most important thing in business now. We are no longer in the 80’s or 90’s where we used (was forced) to depend on one or two stores for a product.Competition level  has turned up into a higher ratio . Customer satisfaction is an inevitable thing these days or else the customer might leave you(which means your competitor gains).By putting your business online, ,you can offer fantastic customer support for your product than from your shop. You can give 24/7 support from your home or wherever you wish. A customer can buy your product even on holidays or at any time irrespective of rain ,wind or any other climatic issues  provided an internet connection.

2. Best In Building Your Brand. 

If you are launching a new product into the market, you cannot survive without building the brand. Have a look at the top 15 internet using countries and the number of users . Quite appealing , right?.

internet statistics

source :http://www.aneki.com

Seeing this data , you cannot deny the mass visiblity of internet and its users as well as advertisments and brand building through internet. Huge success of Google adsense and adwords ensures this. Toyota is one of the best example of using internet to boost up its brand value. Toyota has its facebook page, youtube account and a perfect website(which give all the required information for the users). Toyota is one of the best example of creating huge success through online media.

Oreo’s facebook  page got now 3 crore(33 million) likes and its been termed as the best example of social media marketing excellency . What they posts in facebook and through other online media(Oreo’s Website) are  top notch stuffs with sleeky design and interesting thoughts. For example, have a look at this share in the oreo facebook page.

Which one was born cookie or creme?

oreo

Like wise you can build your brand online, and the cost would be much less compared to other advertising medium (like tv or newpapers). What you need is a couple good idea and a designer. You can make lots of interesting infographics and share it via the facebook page, website and other  online media.

 

3. Global reach for your products.

You can take your business to a global level . Consider your shop is in a small street in Mumbai, you will only be getting business in that area. But what is the case of amazon , or flipkart ? People all over the world are using it, and which means that much business. 

4. Going with the trend.

 Building  website is trendy. Having a website is getting mandatory now a days.What if your competitor has a website ?, the online income and all the other opportunities will be driven to him and you will be beaten ultimately.The number of people who buys things online is increasing day by day, so as  the amount of trust in online business. Once the customer tries it, and if they are satisfied they may try it again.

5. Low Start up Cost.

low cost

Cost of running a business online is  surprisingly smaller than you think.
How much would be the start up cost for your online business?
Lets have a small comparison about the finance required for online and non – online business.

Where you need to put money?

  • Cost of a domain.
  • Cost of the website(design and hosting).
  • Cost of marketing.

Where you saves your money?

  • You just need an office address, not an office. No online customer visits your office. So you can even set your home address as the office address.
  • Zero stock holding– What you need is some images or videos of your products. You need not hold the stock, and once you get the order you can get or make the product and ship it to the customer.
  • Least amount of employees– As almost 70% of the operations are automated, you only need a few staffs to do the rest of work(like shipping, order processing and all) and it depends on how big your business is.

6. Customer’s surety in buying.

  • Customer can make himself sure whether he should buy the product. For instance, if you are buying a t-shirt, you can give the link to many of your friends and ask for opinions. While its impractical taking all of your friends to the shop.

7. Automation of processes.

Everything is automatic. The payment, order, invoice generation and all. You dont need to worry about this at all  while in  the other side you need to.

  • You don’t need sales staff, what you may need would be some staff(depends on how big your business is) for packing and shipping.

8. Freedom to live anywhere.

You can live anywhere you like. You doesn’t need to be in a specific place to operate your business online. Just make sure you are updated with your website.

How to make custom posts and assign custom categories(taxonomies) to it in wordpress?

wordpress

We can use custom posts and categories, so that we can customize wordpress as we like . If you are attempting to build a real estate website using wordpress, it would be great if you have something like properties and property categories rather than post and categories right? Thats what we are attempting to achieve here.

wp1

wp2

Complete Code


add_action( 'init', 'eventcustom_init' );
function eventcustom_init() {
$argsPost = array( 'public' => true, 'label' => 'Events','taxonomies'=>array('eventtype') );
register_post_type( 'events', $argsPost );
$labels = array(
'name' => _x( 'Event Type', 'taxonomy general name' ),
'singular_name' => _x( 'Event Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Events Type' ),
'all_items' => __( 'All Event Type' ),
'parent_item' => __( 'Parent Events Type' ),
'parent_item_colon' => __( 'Parent Event Types:' ),
'edit_item' => __( 'Edit Event Type' ),
'update_item' => __( 'Update Event Type' ),
'add_new_item' => __( 'Add New Event Type' ),
'new_item_name' => __( 'New Event Type Name' ),
'menu_name' => __( 'Event Types' ),
);

$argsCategory = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'eventtype' ),
);

register_taxonomy('eventtype', array('events'), $argsCategory );
}

Everything are pretty straight forward for coders . WordPress Custom Taxonomy API gives the entire details which you need for it . For custom posts , refer the wordpress custom post api.

Code divided and explained

Initialization.

add_action( 'init', 'eventcustom_init' );

we have defined a function eventcustom_init, which will be initialized once the wordpress is loaded. Or in short this function will be called on wordpress load. Now lets check what we have written inside the function eventcustom_init.
Here in the function “function eventcustom_init()” we are defining the variable argsPost

$argsPost = array( 'public' => true, 'label' => 'Events','taxonomies'=>array('eventtype') );

In the argsPost Variable we are defining the required data like label and all as well the taxonomy(category) which we are linking to the custom post.


register_post_type( 'events', $argsPost );

This registers the events custom post, and after all you can see the events post added up in the wordpress admin side (very much like the normal posts).


$labels = array(
'name' => _x( 'Event Type', 'taxonomy general name' ),
'singular_name' => _x( 'Event Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Events Type' ),
'all_items' => __( 'All Event Type' ),
'parent_item' => __( 'Parent Events Type' ),
'parent_item_colon' => __( 'Parent Events:' ),
'edit_item' => __( 'Edit Events' ),
'update_item' => __( 'Update Event Type' ),
'add_new_item' => __( 'Add New Event Type' ),
'new_item_name' => __( 'New Event Type Name' ),
'menu_name' => __( 'Event Types' ),
);

$argsCategory = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'eventtype' ),
);

$labels hold the data with respect to which the custom taxonomies will be displayed in the wordpress admin.
After all we are registering the taxonomy using

register_taxonomy('eventtype', array('events'), $argsCategory );

where the second argument to the function register_taxonomy represents the post type  ‘events‘.

 

How to Upgrade or Reinstall WordPress in your Server

From time to time you will need to upgrade your WordPress installation for better security and making use of new features. I highly recommend everyone to upgrade your WordPress with the latest version as it is one of the fundamental concepts in securing WordPress. Upgrading WordPress is necessary whenever a new stable version is released in the community website – WordPress.org

Reinstalling WordPress is necessary only if your current WordPress installation goes buggy and becomes useless. In most cases, a bug in WordPress installation can be fixed by troubleshooting the codes, themes, checking for any messy plugins and other methods. But if you are not an expert programmer, the next best option is to reinstall your WordPress completely which may solve the problem.

Upgrading and reinstalling WordPress involves the same steps. In fact they both are very similar in process to Installing WordPress in your Server. But there are certain important things you need to take care of before upgrading/installing WordPress.

Important steps to take care before upgrading WordPress

1. Back up your Theme (and other important themes if any) – You can do this by downloading your themes folder via FTP. Access your websites FTP and from the main directory reach wp-contents directory. You can find the the “themes” directory here. You can either backup the whole directory or get inside the directory and backup the specific theme files.

2. Backup All Important Plugins – You can do so by accessing the wp-contents/plugins directory. In most cases you don’t need to back up all the plugins. But if you are not sure which all are the important ones, I would recommend a complete plugins directory backup.

3. Backup your files – In WordPress all the files are stored in the “uploads” directory inside “wp-contents” directory. So you can access it via wp-contents/uploads. Here you will see all your files stored inside many directories and sub directories which are named using numerical years & months. For example:- All the files uploaded in February – 2013 will be stored inside the subdirectory named 02 which will be inside the directory named 2013

4. Download a copy of the configuration file – In the main directory of your wordpress installation, you will find a PHP file named wp-config.php. Download a copy of the file. This file holds your database configuration details like Database name, Database username, password, Hostname etc.

5. Backup your WordPress Database – You can take a backup of your WordPress database in many ways. The most common method is to export data via PhpMyAdmin. You can also take a backup using the WordPress Database Backup plugin

These are the 5 important steps you must do before upgrading your WordPress installation. Now lets begin the process.

Upgrading your WordPress Installation

Let’s begin the process. First access your domains root folder via FTP. I have used WebFTP of Dreamhost to explain the process using screenshots. You can find the screenshot of WebFTP login screen. (You can use any FTP software of your choice. However choose one with zip folder extraction feature. This will make things very easy for you and fast.)

Upgrading WordPress Installation

A screenshot of the root directory is shown below. Yours will also look some what similar. See the directory named “mbaknol.com” marked inside the box. This is the directory where your active WordPress installation resides.

Upgrading and reinstalling wordpress

Note:-  Now get inside this active directory and do the important steps mentioned above. You can do steps 1,2,3 and 4.

The process of upgrading WordPress may take anywhere between 5 minutes to even 1 hour or more. This highly depends upon the speed of your internet connection and your overall knowledge of the process. A highly experienced person can do this in less than 10 minutes. In any case, we don’t prefer a website to go down while upgrading takes place. To make this possible we are creating a new directory in our root folder. You can name it anything (its just a temporary directory. we will rename it later) and here I call it “mbaknol_tempo“. Refer the screenshot below.

Upgrading and reinstalling wordpress. Securing WordPress.

Okay! Now get inside the directory “mbaknol_tempo” and upload your latest version of WordPress as Zip file. You cam download the latest version of WordPress from the community website. At the time of this article, I were uploading version 3.5.2. I used WebFTP of Dreamhost to upload the zipped folder of WordPress to the newly created directory. Refer the screenshot below.

Upgrading and reinstalling wordpress. Securing WordPress.

Now that we have finished uploading the zipped folder, lets now unzip it. Right click on the “zipped” folder and see if there is “extract” option. All you need to do is , select the uploaded zip file and hit the “extract’ button in your FTP client. Now if you have chosen an FTP client without an “extract” option, don’t worry! We have more ways to one destination! In my case, WebFTP of Dreamhost had no unzipping/extract option. So I opened a new tab in my browser, accessed Net2FTP and then logged into the same FTP area of MbaKnol. I then reached our newly created directory “mbaknol_tempo”, selected the zip folder and then hit “unzip” button. Refer the screenshots below to get more clarity.

Upgrade your WordPress. Secure WordPress.

Since we are using a temporary directory, you don’t need to set any specific target directory. Those files will get extracted to a directory named WordPress inside our newly created directory. So hit the  green tick button. Refer screenshot below.

netftp_etract_2

Upon successful extraction, a page shown as below will be outputted.

net2ftp_success

Upon completing “extraction” our newly created directory “mbaknol_tempo” will look like shown below.

extract_look

Okay! Now lets move those extracted files out of the “wordpress” directory. We need all the files and directories inside the extracted “wordpress” directory to be moved to main directory “mbaknol_tempo“. To do this, get inside “wordpress” directory and select all files and directories. Now right click and hit “move” button. Refer the screenshot below.

move_1

Once you hit the move button, select your destination directory. In our example case it is “mbaknol_tempo”. Refer the screenshot below.

move_2

Now this is how our newly created directory “mbaknol_tempo” will look like. Refer screenshot below.

moved_out

You can delete the empty directory “wordpress” if you want.

We are nearing the final steps of upgrading wordpress. Now you need to do four things to complete  upgradation. 1) Copy the “themes” folder (wp-content/themes) from the currently active WordPress installation directory to the newly created directories wp-contents folder. 2) Copy the “plugins” directory from active installation to new intsallation’s wp-contents folder. 3) Copy the “Uploads” folder from active installation to newly created wp-contents folder. 4) Finally copy the configuration file wp-config.php from active installation to newly created directory. I have added the screenshots of 1 step below. All other steps are just the same, all you need to do is change the source directory and destination directory perfectly.

 themes_copy

Note:- The source must be the active wordpress installation

Select the destination folder and hit the submit button.

themes_move_2

Okay! Now repeat the same steps for plugins, uploads and wp-config.php. Once you finish those 3 steps, lets move to the last step of upgrading wordpress.

Last step is very simple. Change the name of the directory which contains active wordpress installation. If you want to follow a standard practice, you can name it with a .old extension. So I named it mbaknol.old. Now finally we should rename our newly created directory with the original name of the active wordpress directory. So here in our example, rename the newly created directory “mbaknol_tempo” to “mbaknol.com

That’s all about upgrading WordPress. You are done with it.  Now you can test if everything is working fine. Load your website and check a couple of articles randomly. If everything is fine, go get yourself a cup of coffee.

Note:- In some cases you will have to upgrade your database too. Don’t worry! its a single click adventure.You will be prompted to upgrade database while you login to the admin area of your wordpress. If you are sure of having a database backup, just hit the “upgrade database” button with your sweet closed eyes.

5 steps in creating a facebook application to fetch user details using the latest Facebook PHP SDK (v.3.2.2)

DEMO      DOWNLOAD SOURCE
Facebook, being the most popular social network in this era, its applications also got high relevance. Facebook database contains the largest personal data all over the world. So how can you make a facebook application to access a third party data? Follow these steps.

Difference between Graph API and FQL

Graph API is the latest one , but still we may need to depend on FQL to get some complex results which graph API cannot fetch. FQL is facebook query language very much similar to SQL (structured Query Language). We can use either of them to fetch results from facebook, use the one which seems comfortable for you.

# Step 1 : Create a Facebook developers account and create an application.

  • You need  a facebook developers account in order to create a facebook application. Get in to the  Facebook Developers Zone and  sign up for a developer account and give a small description about the application you are going to make.
  • After that you need to go to your home and take the manage apps from the settings menu .

Create facebook application

 

  • Take the Create New App option from the menu , and fill in the application name, app namespace (this will be your application url, dollarfry is the namespace for this app and application url becomes apps.facebook.com/dollarfy) and other required basic info.
  • Facebook Integration – In this section we integrates our server with the app.  We need to enter the site url where your application is  being hosted, the canvas url and the secured canvas url . siteurl –  canvas url – This point to the directory of the index file, for secured canvas url add https://
  • SandBox mode – Enabling sandbox mode makes your application in testing environment. Disabling it makes your application live

# Step 2 : Download the php sdk  Library for facebook ,include it in your index file and connecting with the application.

require 'src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => 'XXXXXX',
'secret' => 'XXXXXX',
));

Download the latest facebook sdk for php and upload it into your server. After all we are going on with the index.php (the main file were in which we are going to write the code for the app). You need to connect your  file with the application id and secret key, so that facebook can  verify the identity of your app . You can get the app id and app secret key in the main home page of your app.

Get your app id and secret key and Put them in the index file.

# Step 3. Get the login and logout url. 

// Get User ID
$user = $facebook->getUser();
// Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl(
array(
'scope' => 'user_likes,user_photo_video_tags',
'redirect_uri' => 'http://www.dollarfry.com/facebook/'
)
);
}

First of all we get the user details, getUser function gets called from the sdk and it gets the user details (id and all of the currently logged in user). And if the user is logged in (or if a user session exists) it will get the logout  url via getLogoutUrl(), so that the user can log out. ‘scope’  in the login url determines the permissions which we request facebook. Scopes varies depending on your app. Here, using this application we are fetching user likes and photos so that we are using the scopes user_likes,user_photo_video_tags , these are the access tokens for your application. The redirect_uri is the url which we want to redirect the user after logging in. I will be explaining the scopes more detailed in next step (step 4)  using the graph api explorer.

[df_hireme2 text=”to develop a facebook application(or consultation)” extratext=”I have more than 5 years of experience in WordPress and PHP and have developed many facebook application for various clients”]

# Step 4 : Getting results using graph api

// Getting Results using Graph Api.
try {
// Proceed knowing you have a logged in user who's authenticated.
$userProfile = $facebook->api('/me');
// Getting the User Likes
$userLikes = $facebook->api('/me/likes');
// Applying the field and connections, (Getting bio and photos limited to 2)
$fieldConnections=$facebook->api('me/?fields=bio,photos.limit(2)');
// Processing the Likes array to the like name only
foreach ($userLikes['data'] as $key => $value) {
$likedNames[]=$value['name'];
}
// Processing the fieldConnections to get the photo url only
$processedFields=array();
$processedFields['bio']=$fieldConnections['bio'];
foreach ($fieldConnections['photos']['data'] as $key => $value) {
$processedFields['photos'][]= $value['source'];
}
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}

If the user is logged in and the session exists, we can fetch the results via the api.

$userProfile = $facebook->api(‘/me’) – This fetches the user details, with all the public profile info. This means we can fetch users name, id, first name, last name and all the other public profile information. If you check the first table column of the  demo application,  you can see the results fetched.

4.1 How to use the Graph API explorer?

Graph Api Explorer
Graph API is one of the powerful tools provided for the users by facebook. This helps you to see all the results fetched using your graph API. This also makes the implementation of fields, connections  and other permissions easy . Using the graph api explorer makes your development a way more easy than you expect , so its really recommended to use rather than sending requests to facebook from your application(in the testing phase).

graph api explorer

 

In this screenshot, I’ve fetched the user bio and photos(limited to 2), via graph api. I just added the field and connection(or in short what ever data I need ) and it generated the graph api for me. You can have a look at the complete reference to graph api and the permissions needed for accessing it. Of which the User graph api is the most important one. The graph api explorer generates access tokens for the permissions provided. You can check the permissions for the access tokens generated by selecting Get Access Token button .

access token graph api explorer

 

In the above screenshot you can select the permission which you need so that it will generate the access token corresponding to the token and you can fetch the required results.

Before getting into field and connections, its better you read the Getting Started with Graph API page in facebook, this explains detailed about field and connections. But if you got the concept already you may skip they.

4.2 Explaining The Results Obtained

Result 1 : User Profile using Graph api

$userProfile = $facebook->api('/me');

The first widget deals with displaying the user profile details, this is fetched through /me . Which displays all the user details.

Result 2 : User Likes using Graph api

$userLikes = $facebook->api('/me/likes');

/me/likes will fetch all the likes of the user, the permission required is user_likes . Here like is a connection. We do a foreach loop in the obtained result and process the likes to a different variable and prints it.

Result 3 : Fields and connections using graph api.

$fieldConnections=$facebook->api('me/?fields=bio,photos.limit(2)');

Fields and connections explains how we can fetch data in different cases . In User Graph API,
you can have a look at the different fields and connections and their permissions needed for user api. Here we are using field and connections simultaneously. We have used the field bio of the user api and the connection photos , which brings out the bio of the user and the photos in which user has been tagged. This require permission user_photo_video_tags.
You might have seen the limit in the end of the graph api, this limits the photos fetched to 2( The most recent two photos). Here I’ve displayed the bio and  two photos  seprately and the whole results array  are printed below .

# Step 5: Getting results using FQL

try{
// Fql query to get the user details
$fql1 = "select name, about_me, age_range, sex,pic_square from user where uid=" . $user;
$param = array(
'method' => 'fql.query',
'query' => $fql1,
'callback' => ''
);
$fqlOutput = $facebook->api($param);
// Fql Query to get the user movies and music.
$fql2 = "select movies, music from user where uid=" . $user;
$param = array(
'method' => 'fql.query',
'query' => $fql2,
'callback' => ''
);
$fqlMovies = $facebook->api($param);
}
catch(Exception $output){
print_r($output);
}

FQL query is a little bit different from graph api and very much similar to SQL . FQL helps you to obtain very complex results from facebook which the graph api cannot. Here $fql1 and $fql2 holds the fql query which we are sending to facebook. and $user is the user instance which we have mentioned above. $param holds the general keys .

Complete Reference to FQL

The only javascript we’ve used in the whole code is for redirecting the the user to the application page.

top.location.href = '$loginUrl';

NB: Regarding the new facebook terms, an ssl (https) is required for authentication. You need to login into facebook first or what you see  would be an SSL error.

It took me heaps of time to write this whole tutorial in detailed . We will be always here to help you, do post your suggestions, queries or whatever as comments .