Friday 15 November 2013

How to Add Stylesheet File to Iframe "head' tag

 <script type="text/javascript">
     setTimeout(function(){
     var $head = $("iframe").contents().find("head");               
    $head.append($("<link/>",
    { rel: "stylesheet", href: "cssfilepath", type: "text/css" }));
    },3000);

</script>

Get Visitor Info Using Their IP Address

funtion getVisitorInfo($userip,$output){
        $result  = "Unknown";     
        $url =  "http://www.geoplugin.net/json.gp?ip=".$ip;
        $data = file_get_contents($url);  
        $ip_data = @json_decode($data);
        if($ip_data && $ip_data->$output != null)
        {
           $result = $ip_data->$output;
        }
        return $result;
}
$userip = $_SERVER['REMOTE_ADDR'];
//Get Country Name
$userCountryName = getVisitorInfo($userip,'geoplugin_countryName');
 //Get Country Code
$userCountryCode = getVisitorInfo($userip,'geoplugin_countryCode'); 


Below is list of infromation can be get from user ip.
geoplugin_request,
geoplugin_status,
geoplugin_credit,
geoplugin_city,
geoplugin_region,
geoplugin_areaCode,
geoplugin_dmaCode,
geoplugin_countryCode,
geoplugin_countryName,
geoplugin_continentCode,
geoplugin_latitude,
geoplugin_longitude,
geoplugin_regionCode,
geoplugin_regionName,
geoplugin_currencyCode,
geoplugin_currencySymbol,
geoplugin_currencySymbol_UTF8,
geoplugin_currencyConverter

Note:You need to allow allow_url_fopen in your php.ini config file.

Thursday 8 August 2013

Update Column Value with Prefix and Sufix in MySql Database

Update particular column with specific prefix

update tablename set ColumnName= concat('prefix',ColumnName);

Update particular column with specific sufix

update tablename set ColumnName= concat(ColumnName,'sufix');

Remove prefix from any column in predefine char

UPDATE tablename  SET ColumnName = SUBSTRING(ColumnName,prefixLength) WHERE ColumnName RLIKE '^prefix';

Remove sufix from any column in predefine char

UPDATE tablename  SET ColumnName = SUBSTRING(ColumnName,sufixLength) WHERE ColumnName LLIKE '^sufix';

Example:
Below query update the vLongId field with "-" prefix;
update TableName set vLongId = concat('-',vLongId );

Below query update the vLongId field with "-" prefix;
UPDATE TableName SET vLongId = SUBSTRING(vLongId ,2) WHERE vLongId RLIKE '^-';

Friday 31 May 2013

"Get list of images based on width and height AND get list of files from a directory based on files extenstion"

<?php
/* "get list of images based on width and height" */
$dirpath = 'imgdirname'; // Name of folder(directory) containing the images files
function getimg($w,$h,$dirpath)
{
    $filesimg= array();
    $dh  = opendir($dirpath);
    while (false !== ($filename = readdir($dh)))
    {
        if(!is_dir($filename))
        {
            $imginfo = getimagesize($dirpath.'/'.$filename);
            if($imginfo[0] == $w || $imginfo[0] == $h ){
                $filesimg[] = $filename;
            }
        }
    }
    sort($filesimg);
    return $filesimg;
}
$imgdata = getimg(100,100,$dirpath);
echo "<pre>";print_r($imgdata); exit;

/* get list of html files from a directory*/
$dirpath = 'htmlfiledirc'; // Name of folder(directory) containing all the html files
function getHtmlfileList($dirpath,$fileExt)
{
    $fileshtml= array();
    $dh  = opendir($dirpath);
    while (false !== ($filename = readdir($dh)))
    {
        $files[] = $filename;
        if(!is_dir($filename) && strstr($filename,$fileExt)){
            $fileshtml[] = $filename;
        }
    }
    return $fileshtml;
}
$fileExt = '.html';
$filesdata = getHtmlfileList($dirpath,$fileExt);
echo "<pre>";print_r($imgdata); exit;
?>

Monday 27 May 2013

"X-cart Product Sort By - Dropdown"


Use belwo code instead of current used by "main/search_sort_by.tpl" or "customer/search_sort_by.tpl"

<strong class="search-sort-title">{$lng.lbl_sort_by}:</strong>
      <select name="sort_by" ONCHANGE="location = this.options[this.selectedIndex].value;" >
    {foreach from=$sort_fields key=name item=field}
        {if $navigation_page > 1}
            {assign var="cur_url" value=$url|cat:"page="|cat:$navigation_page|cat:"& amp;sort="|cat:$name|cat:"&amp;sort_direction="}
        {else}
            {assign var="cur_url" value=$url|cat:"sort="|cat:$name|cat:"&amp;sort_direction="}
        {/if}
        <option value="{$cur_url}1" {if $name eq $selected && $direction eq 1}selected="selected"{/if}>{$field} (UP)</option>
        <option value="{$cur_url}0" {if $name eq $selected && $direction eq 0}selected="selected"{/if}>{$field} (Down)</option>
    {/foreach}
    </select>
 

Monday 13 May 2013

"PHP Function For Truncate string and function For Truncate string"

/* Below function  For Truncate string */
    function truncate($text, $chars) {
    $add_dots='';
    if(strlen($text) > $chars){
        $add_dots = "...";
    }
    $text = str_replace('"','&rdquo;',$text);
    $text = str_replace('"','&ldquo;',$text);
    $text = str_replace("\n", "", $text);
    $text = str_replace("\r", "", $text);


    $text = $text." ";
    $text = substr($text,0,$chars);
    $text = substr($text,0,strrpos($text,' '));
    $text = $text.$add_dots;
    return $text;
    }
    /*Function for refine tag and quotes in description. */
    function refineTagQuotes($text)
    {
        $text = str_replace('"','&rdquo;',$text);
        $text = str_replace('"','&ldquo;',$text);
        $text = str_replace("\n", "", $text);
        $text = str_replace("\r", "", $text);
        return $text;
    }

Wednesday 8 May 2013

Event Based calendar with Javascript

<html>
    <head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/date.js"></script>
<script type="text/javascript" src="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePicker.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePicker.css">
<link rel="stylesheet" type="text/css" media="screen" href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePicker.css">

<script type="text/javascript" charset="utf-8">
    $(function()
            {
                $('.date-pick').datePicker()
                $('#start-date').bind(
                    'dpClosed',
                    function(e, selectedDates)
                    {
                        var d = selectedDates[0];
                        if (d) {
                            d = new Date(d);
                            $('#end-date').dpSetStartDate(d.addDays(1).asString());
                        }
                    }
                );
                $('#end-date').bind(
                    'dpClosed',
                    function(e, selectedDates)
                    {
                        var d = selectedDates[0];
                        if (d) {
                            d = new Date(d);
                            $('#start-date').dpSetEndDate(d.addDays(-1).asString());
                        }
                    }
                );
            });
</script>
    </head>
    <body>
        <ol>
                        <li><label for="start-date">Start date:</label>
            <input name="start-date" id="start-date" class="date-pick" /></li>
                        <li><label for="end-date">End date:</label>
            <input name="end-date" id="end-date" class="date-pick" /></li>   
        </ol>
    </body>
</html>

Image Upload With Resize



Image Upload With Resize

Create following directory structure
ImageResize (foldername)
ImageUploadWithResize.php
delete_all_images.php
uploads (foldername add 777 permission to this folder)

ImageUploadWithResize.php

<?php
//Define Memory Limit for large images so that we do not get "Allowed memory exhausted"
ini_set("memory_limit", "200000000");


// upload the file
if ((isset($_POST["submitted_form"])) && ($_POST["submitted_form"] == "image_upload_form")) {
            // file needs to be jpg,gif,bmp,x-png and 4 MB max
            if (($_FILES["image_upload_box"]["type"] == "image/jpeg" || $_FILES["image_upload_box"]["type"] == "image/pjpeg" || $_FILES["image_upload_box"]["type"] == "image/gif" || $_FILES["image_upload_box"]["type"] == "image/x-png") && ($_FILES["image_upload_box"]["size"] < 4000000))
            {
                        // some settings
                        $max_upload_width = 2592; $max_upload_height = 1944;
                        // if user chosed properly then scale down the image according to user preferances
                        if(isset($_REQUEST['max_width_box']) and $_REQUEST['max_width_box']!='' and $_REQUEST['max_width_box']<=$max_upload_width){
                                    $max_upload_width = $_REQUEST['max_width_box'];
                        }   
                        if(isset($_REQUEST['max_height_box']) and $_REQUEST['max_height_box']!='' and $_REQUEST['max_height_box']<=$max_upload_height){
                                    $max_upload_height = $_REQUEST['max_height_box'];
                        }         

                        // if uploaded image was JPG/JPEG
            if($_FILES["image_upload_box"]["type"] == "image/jpeg" || $_FILES["image_upload_box"]["type"] == "image/pjpeg")
{         
                                    $image_source = imagecreatefromjpeg($_FILES["image_upload_box"]["tmp_name"]);
                        }                     
                        // if uploaded image was GIF
                        if($_FILES["image_upload_box"]["type"] == "image/gif"){
                                    $image_source = imagecreatefromgif($_FILES["image_upload_box"]["tmp_name"]);
                        }         
                        // BMP doesn't seem to be supported so remove it form above image type test (reject bmps)           
                        // if uploaded image was BMP
                        if($_FILES["image_upload_box"]["type"] == "image/bmp"){          
                                    $image_source = imagecreatefromwbmp($_FILES["image_upload_box"]["tmp_name"]);
                        }                                 
                        // if uploaded image was PNG
                        if($_FILES["image_upload_box"]["type"] == "image/x-png"){
                                    $image_source = imagecreatefrompng($_FILES["image_upload_box"]["tmp_name"]);
                        }
                       
                       
                        $remote_file = "uploads/".$_FILES["image_upload_box"]["name"];
                        imagejpeg($image_source,$remote_file,100);
                        chmod($remote_file,0644);
                       
                        // get width and height of original image
                        list($image_width, $image_height) = getimagesize($remote_file);
           
                        if($image_width>$max_upload_width || $image_height >$max_upload_height){
                                    $proportions = $image_width/$image_height;
                                   
                                    if($image_width>$image_height){
                                                $new_width = $max_upload_width;
                                                $new_height = round($max_upload_width/$proportions);
                                    }                     
                                    else{
                                                $new_height = $max_upload_height;
                                                $new_width = round($max_upload_height*$proportions);
                                    }                     
                                   
                                   
                                    $new_image = imagecreatetruecolor($new_width , $new_height);
                                    $image_source = imagecreatefromjpeg($remote_file);
                                   
                                    imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
                                    imagejpeg($new_image,$remote_file,100);
                                   
                                    imagedestroy($new_image);
                        }
                       
                        imagedestroy($image_source);
                       
                       
                        header("Location: ImageUploadWithResize.php?upload_message=image uploaded&upload_message_type=success&show_image=".$_FILES["image_upload_box"]["name"]);
                        exit;
            }
            else{
                        header("Location: ImageUploadWithResize.php?upload_message=make sure the file is jpg, gif or png and that is smaller than 4MB&upload_message_type=error");
                        exit;
            }
}
?>

<html>
<head><title>Image Upload with resize</title>
<style type="text/css">
<!--
.upload_message_success {padding:4px;background-color:#009900;border:1px solid #006600;color:#FFFFFF;margin-top:10px;margin-bottom:10px;}
.upload_message_error {padding:4px;background-color:#CE0000;border:1px solid #990000;color:#FFFFFF;margin-top:10px;margin-bottom:10px;}
-->
</style></head>
<body>
<h1 style="margin-bottom: 0px">Upload an image</h1>
<?php if(isset($_REQUEST['upload_message'])){?>
            <div class="upload_message_<?php echo $_REQUEST['upload_message_type'];?>">
                        <?php echo htmlentities($_REQUEST['upload_message']);?>
            </div>
<?php }?>
<form action="#" method="post" enctype="multipart/form-data" name="image_upload_form" id="image_upload_form" style="margin-bottom:0px;">
            <label>Image file, maximum 4MB. it can be jpg, gif,  png:</label><br />
    <input name="image_upload_box" type="file" id="image_upload_box" size="40" />
    <input type="submit" name="submit" value="Upload image" /><br /><br />
            <label>Scale down image? (2592 x 1944 px max):</label><br />
            <input name="max_width_box" type="text" id="max_width_box" value="1024" size="4"> x
            <input name="max_height_box" type="text" id="max_height_box" value="768" size="4"> px.
    <br /><br />
            <p style="padding:5px; border:1px solid #EBEBEB; background-color:#FAFAFA;">
                        <strong>Notes:</strong><br />
                        The image will not be resized to this exact size; it will be scalled down so that neider width or height is larger than specified.<br />
                        After you uploaded images and made tests on our server please <a href="delete_all_images.php">delete all uploaded images </a> :)<br />
            </p>
            <input name="submitted_form" type="hidden" id="submitted_form" value="image_upload_form" />
</form>
<?php if(isset($_REQUEST['show_image']) and $_REQUEST['show_image']!=''){?>
<p><img src="uploads/<?php echo $_REQUEST['show_image'];?>" /></p>
<?php }?>
</body>
</html>

delete_all_images.php

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Delete all images</title>
</head>

<body>

<?
   $dir = 'uploads/';
   // open specified directory
   $dirHandle = opendir($dir);
   $total_deleted_images = 0;
   while ($file = readdir($dirHandle)) {
      // if not a subdirectory and if filename contains the string '.jpg'
      if(!is_dir($file)) {
         // update count and string of files to be returned
                         unlink($dir.$file);
         echo 'Deleted file <b>'.$file.'</b><br />';
                         $total_deleted_images++;
      }
   }
   closedir($dirHandle);
            if($total_deleted_images=='0'){
                        echo 'There ware no files uploaded there.';
            }
            echo '<br />Thank you.';
            echo '<br /><a href="ImageUploadWithResize.php" title="Upload Image"> Upload New Image </a>';

?>

</body>
</html>

Monday 6 May 2013

PHP Time Stamp Function

time_stamp.php
Contains PHP code. You have to use the time_stamp() function to display the date and time.

<?php
function time_stamp($session_time)
{
$time_difference = time() - $session_time ;

$seconds = $time_difference ;
$minutes = round($time_difference / 60 );
$hours = round($time_difference / 3600 );
$days = round($time_difference / 86400 );
$weeks = round($time_difference / 604800 );
$months = round($time_difference / 2419200 );
$years = round($time_difference / 29030400 );



// Seconds
if($seconds <= 60)
{
echo "$seconds seconds ago";
}
//Minutes
else if($minutes <=60)
{

   if($minutes==1)
  {
   echo "one minute ago";
   }
   else
   {
    echo "$minutes minutes ago";
   }

}
//Hours
else if($hours <=24)
{

   if($hours==1)
  {
   echo "one hour ago";
  }
  else
  {
   echo "$hours hours ago";
  }

}
//Days
else if($days <= 7)
{

  if($days==1)
  {
   echo "one day ago";
  }
  else
  {
   echo "$days days ago";
   }

}
//Weeks
else if($weeks <= 4)
{

   if($weeks==1)
  {
   echo "one week ago";
   }
  else
  {
   echo "$weeks weeks ago";
  }

}
//Months
else if($months <=12)
{

   if($months==1)
  {
   echo "one month ago";
   }
  else
  {
   echo "$months months ago";
   }

}
//Years
else
{

   if($years==1)
   {
    echo "one year ago";
   }
   else
  {
    echo "$years years ago";
   }

}

}
$session_time ="1264326122";
//$session_time=time();
echo time_stamp($session_time);
?>

Friday 26 April 2013

Function for create parent child Tree FROM Array

<?php
/* Function for create parent child Tree*/
function buildTree(array $elements, $parentId = '')
{
        $branch = array();
        foreach ($elements as $element)
    {
            if ($element['parent'] == $parentId)
        {
            $children = buildTree($elements, $element['id']);
            if ($children) {
            $element['children'] = $children;
            }
            $branch[] = $element;
        }
    }
    return $branch;
}   

$mainarray = array(
"0"=>array("id"=>1,"orderby"=>"10","title"=>"Home","link"=>"home.php","active"=>"Y","parent"=>""),
"1"=>array("id"=>2,"orderby"=>"20","title"=>"Item1","link"=>"item.php","active"=>"Y","parent"=>""),
"2"=>array("id"=>3,"orderby"=>"30","title"=>"Item2","link"=>"item2.php","active"=>"Y","parent"=>""),
"3"=>array("id"=>14,"orderby"=>"80","title"=>"Item3","link"=>"item3.php","active"=>"Y","parent"=>""),
"4"=>array("id"=>4,"orderby"=>"40","title"=>"Sub1Item1","link"=>"sub1item.php","active"=>"Y","parent"=>"2"),
"5"=>array("id"=>5,"orderby"=>"50","title"=>"Sub2Item1","link"=>"sub2item.php","active"=>"Y","parent"=>"2"),
"6"=>array("id"=>6,"orderby"=>"60","title"=>"Sub3Item1","link"=>"sub3item.php","active"=>"Y","parent"=>"2"),
"7"=>array("id"=>10,"orderby"=>"70","title"=>"Sub2Sub1Item1","link"=>"sub1item1.php","active"=>"Y","parent"=>"4"),
);
$mainarray = buildTree($mainarray);
echo "<pre>";print_r($mainarray); exit;
?>

Thursday 25 April 2013

Create HomePageBanner Module for X cart in Few Steps



Create HomePageBanner Module for X cart in Few Steps
Directory Structure.
Catelog
-admin
  -- home_banners.php (new file)
  --/* save as home_banners.php */
<?php
define('USE_TRUSTED_POST_VARIABLES',1);
$trusted_post_variables = array('add');
require './auth.php';
require $xcart_dir.'/include/security.php';
//if (empty($active_modules['XAffiliate']))
   // func_403(6);
require $xcart_dir . '/include/home_banners.php';
// Assign the section navigation data
$smarty->assign('dialog_tools_data', $dialog_tools_data);
if (
    file_exists($xcart_dir.'/modules/gold_display.php')
    && is_readable($xcart_dir.'/modules/gold_display.php')
) {
    include $xcart_dir.'/modules/gold_display.php';
}
func_display('admin/home.tpl', $smarty);
?>
-include
   -- home_banners.php (new file)
--/* save as home_banners.php */

<?php
if ( !defined('XCART_START') ) { header("Location: ../"); die("Access denied"); }
x_load('image');
x_session_register('file_upload_data');
x_session_register('store_banner_data', array());
$is_partner_area = constant('AREA_TYPE') == 'B';
$location[] = array(func_get_langvar_by_name('lbl_home_banners'), "");
/*** Define data for the navigation within section */
$dialog_tools_data['left'][] = array('link' => "home_banners.php", 'title' => func_get_langvar_by_name('lbl_banners_list'));
if (!$is_partner_area) {  
    $dialog_tools_data['left'][] = array('link'  => 'home_banners.php?banner_type=G','title' => func_get_langvar_by_name('lbl_add_graphic_banner'));
}
if ($mode == 'add' && $add && $banner_type)
{
    // Add/Modify banner
    $error = $err_field = false;
    if (empty($add['banner'])) {
        $error = func_get_langvar_by_name('lbl_banner_has_no_name');
        $err_field = 'banner';
    } elseif ( !empty($add['banner_x']) && (!is_numeric($add['banner_x']) || $add['banner_x'] < 1)) {
        $error = func_get_langvar_by_name('lbl_banner_has_wrong_width');
        $err_field = 'banner_xy';
    } elseif (!empty($add['banner_y']) && (!is_numeric($add['banner_y']) || $add['banner_y'] < 1)) {
        $error = func_get_langvar_by_name('lbl_banner_has_wrong_height');
        $err_field = 'banner_xy';
    }
    if ($error) {
        $store_banner_data = $add;
        $store_banner_data['bannerid'] = $bannerid;
        $top_message = array( 'type' => 'E',  'content' => $error );
        func_header_location('home_banners.php?banner_type=' . $banner_type . '&bannerid=' . $bannerid . '&err_field=' . $err_field);
    }
    $store_banner_data = array();
    $data = array(
        'banner'        => $add['banner'],
        'body'          => $add['body'],
        'avail'         => $add['avail'],
        'is_image'      => $add['is_image'],
        'is_name'       => $add['is_name'],
        'is_descr'      => $add['is_descr'],
        'is_add'        => $add['is_add'],
        'banner_type'   => $banner_type,
        'open_blank'    => $add['open_blank'],
        'legend'        => $add['legend'],
        'alt'           => $add['alt'],
        'direction'     => $add['direction'],
        'banner_x'      => $add['banner_x'],
        'banner_y'      => $add['banner_y']
    );
    $is_new = false;
    if ($bannerid) {
        func_array2update('home_banners', $data, "bannerid = '$bannerid'");
        $top_message = array('content' => func_get_langvar_by_name('lbl_banner_is_updated'));
    } else {     
       $bannerid = func_array2insert('home_banners', $data);
        $top_message = array('content' => func_get_langvar_by_name('lbl_banner_is_created'));
        $is_new = true;
    }
    if ($banner_type == 'G' && $bannerid && func_check_image_posted($file_upload_data, 'H')) {
        func_save_image($file_upload_data, 'H', $bannerid);
    }
    if ($banner_type == 'G' && $bannerid) {
        $has_image = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[images_H] WHERE id = '$bannerid'");
        if (!$has_image) {
            func_array2update('home_banners', array('avail' => ''), "bannerid = '$bannerid'");
            $top_message['content'] .='<br>'.func_get_langvar_by_name($is_new ? 'lbl_banner_is_created_without_image':'lbl_banner_is_updated_without_image');
        }
    }
    func_header_location('home_banners.php?bannerid=' . $bannerid);
}
elseif ($mode == 'delete') { // Delete banner element
    if ($bannerid) {
        db_query ("DELETE FROM $sql_tbl[home_banners] WHERE bannerid = '$bannerid'");
        func_delete_image($bannerid, 'H');
        $top_message = array('content' => func_get_langvar_by_name('lbl_banner_is_deleted'));
        func_header_location('home_banners.php');
    }
}

if (!empty($bannerid) && empty($err_field)) {
    $banner = func_query_first("SELECT * FROM $sql_tbl[home_banners] WHERE bannerid = '$bannerid'");
    if (!$banner) {
        func_header_location('home_banners.php');
    }   
    $banner['can_edit'] = true;
    $smarty->assign ('banner', $banner);
    $banner_type = $banner['banner_type'];
    $location[count($location) - 1][1] = 'home_banners.php';
    $location[] = array($banner['banner'], 'home_banners.php?bannerid=' . $bannerid);
} elseif ($store_banner_data) {
    $smarty->assign ('err_field', $err_field);
    $smarty->assign ('banner', $store_banner_data);
}

$banners = func_query("SELECT * FROM $sql_tbl[home_banners]");
if ($banners) {
    foreach ($banners as $k => $v) {
        $banners[$k]['banner_type_text'] = func_get_banner_type_text($v['banner_type']);
        $banners[$k]['can_edit'] = true;
    }
    $smarty->assign('banners', $banners);
}
if (!empty($banner_type)) {
    $smarty->assign('banner_type', $banner_type);
}
$smarty->assign('now',            XC_TIME);
$smarty->assign('main',           'home_banners');
// Assign the current location line
$smarty->assign('location', $location);
?>
-module
  ---HomeBanners
      ---config.php(newfile)
--/* save as config.php */
            <?php
if (!defined('XCART_START') ) { header('Location: ../../'); die('Access denied'); }
$addons['HomeBanners'] = true;
$css_files['HomeBanners'][] = array();
$config['available_images']['H'] = "U";
$sql_tbl['images_H']       = XC_TBL_PREFIX . 'images_H';
$sql_tbl['home_banners']   = XC_TBL_PREFIX . 'home_banners';
if (defined('TOOLS')) {     
    $tbl_keys['images_H.id'] = array(
        'keys' => array('images_H.id' => 'home_banners.bannerid'),
        'where' => "home_banners.banner_type = 'G'",
        'fields' => array('id')
    );
    $tbl_keys['home_banners.imageid'] = array(
        'keys' => array('home_banners.bannerid' => 'images_H.id'),
        'where' => "home_banners.banner_type = 'G'",
        'fields' => array('bannerid')
    );
    $tbl_demo_data['HomeBanners'] = array('home_banners'  => '', );
}
?>
      --- home_banners.php (newfile)
--/* save as home_banners.php */
            <?php
if ( !defined('XCART_START') ) { header("Location: ../"); die("Access denied"); }
$banners = func_query("SELECT * FROM $sql_tbl[home_banners] WHERE avail = 'Y'");
if ($banners) {   
    $smarty->assign('banners', $banners);
    $smarty->assign('customer_home_banners','Y');
}
?>
-images
   --image_H
-skin
   --common_files
      ---admin
          ---newfilesbysr
              --- display_banner.tpl (newfile)
{if $banners ne "" and $banner_type eq ''}
            <a href="home_banners.php?bannerid={$v.bannerid}">
<img src="{$current_location}/image.php?type=H&amp;id={$banner.bannerid}" border="0" alt="{if $banner.alt ne ''}{$banner.alt|escape}{/if}" width="960" height="230px;">
            </a>
{/if}  
              --- edit_image.tpl (newfile)
{if $idtag eq ''}
  {assign var="idtag" value="edit_image"}
{/if}
<img id="{$idtag}" src="{$xcart_web_dir}/image.php?type={$type}&amp;id={$id}&amp;ts={$smarty.now}{if $already_loaded}&amp;tmp=Y{/if}" width="905" height="230" alt="{include file="main/image_property.tpl"}" style="margin-bottom: 10px;" />

<table  cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <input type="button" value="{$lng.lbl_change_image|strip_tags:false|escape}" onclick='javascript: popup_image_selection("{$type}", "{$id}", "{$idtag}");' />
      {if $id ne '' and not $no_delete and ($delete_url or $delete_js)}
        &nbsp;&nbsp;
        <input id="{$idtag}_delete" type="button" value="{$lng.lbl_delete_image|strip_tags:false|escape}" onclick="javascript: {if $delete_js ne ''}{$delete_js|replace:'"':'\"'}{else}self.location='{$delete_url}';{/if}" />
      {/if}
      <span style="{if not $already_loaded}display: none; {/if}padding-left: 10px;" id="{$idtag}_reset">
        <input type="button" value="{$lng.lbl_reset|strip_tags:false|escape}" onclick="javascript: popup_image_selection_reset('{$type}', '{$id}', '{$idtag}');" />
        <input id="skip_image_{$type}" type="hidden" name="skip_image[{$type}]" value="" />
      </span>
    </td>
  </tr>
  <tr style="display: none;" id="{$idtag}_text">
 {if $button_name eq ''} {assign var="button_name" value=$lng.lbl_submit} {/if}
    <td style="padding-top: 10px;">{$lng.txt_image_note|substitute:"button_name":$button_name}</td>
  </tr>
</table>
              --- home_banners.tpl (newfile)

{include file="page_title.tpl" title=$lng.lbl_home_banners_management}
<script type="text/javascript" src="{$SkinDir}/js/popup_image_selection.js"></script>
This section is used to create, modify and delete the home page banners.
<br /><br />
{if $banners ne "" and $banner_type eq ''}
  {capture name=dialog}
    {foreach from=$banners item=v}
      <div class="xaff-banner-item{cycle values=", xaff-banner-item-odd"}">
        {if $v.can_edit}
          <a href="home_banners.php?bannerid={$v.bannerid}" class="modify" >{$lng.lbl_modify}</a>
          &nbsp;&nbsp;&nbsp;
          <a href="home_banners.php?bannerid={$v.bannerid}&amp;mode=delete" class="delete">{$lng.lbl_delete}</a>
        {/if}
        <br />
        <table cellspacing="1" cellpadding="0" class="banner-box">
          <tr>
            <td class="banner-box">
                        {include file="admin/newfilesbysr/display_banner.tpl" assign="ban" banner=$v}
                        {$ban|amp}
                </td>
          </tr>
        </table>
      </div>
    {/foreach}
  {/capture}
  {include file="dialog.tpl" content=$smarty.capture.dialog title=$lng.lbl_available_banners extra='width="100%"'}
{elseif $banner_type ne ''}
  {if not $get and (not $banner.banner_type or $banner.can_edit)}
    {capture name=dialog}
    <script type="text/javascript">
    //<![CDATA[
    var requiredFields = [
      ['banner', "{$lng.lbl_banner_name|strip_tags|wm_remove|escape:javascript}", false], ]
    //]]>
    </script>
    {include file="check_required_fields_js.tpl"}
    <form action="home_banners.php" method="post" enctype="multipart/form-data" name="edit_banner" onsubmit="javascript: return checkRequired(requiredFields)">
      <input type="hidden" name="mode" value="add" />
      <input type="hidden" name="mode2" value="" />
      <input type="hidden" name="banner_type" value="{$banner_type}" />
      <input type="hidden" name="bannerid" value="{$banner.bannerid}" />
      <table cellpadding="0" cellspacing="3" width="100%">
        <tr{cycle values=", class='TableSubHead'"}>
          <td><label for="banner">{$lng.lbl_banner_name}:</label></td>
          <td><input type="text" maxlength="128" size="40" id="banner" name="add[banner]" value="{$banner.banner|escape}" />{if $err_field eq 'banner'}<font class="Star">&lt;&lt;</font>{/if}</td>
        </tr>
        <tr{cycle values=", class='TableSubHead'"} style="display:none;">
          <td><label>Banner size (width x height):</label></td>
          <td>
            <input type="text" size="5" id="banner_x" value="{$banner.banner_x|default:960}" name="add[banner_x]" />
            &nbsp;x&nbsp;
            <input type="text" size="5" id="banner_y" value="{$banner.banner_y|default:230}" name="add[banner_y]" />{if $err_field eq 'banner_xy'}<font class="Star">&lt;&lt;</font>{/if}
          </td>
        </tr>
             <tr{cycle values=", class='TableSubHead'"} class='TableSubHead' >
            <td><label for="alt">{$lng.lbl_alt_tag}</label> ({$lng.lbl_optional}):</td>
            <td><textarea cols="50" rows="3" id="alt" name="add[alt]">{$banner.alt}</textarea></td>
          </tr>
        <tr>
          <td><label for="avail">{$lng.lbl_availability}:</label></td>
          <td><input type="checkbox" value="Y" id="avail" name="add[avail]"{if $banner.avail eq 'Y' or ($banner.bannerid eq '' and $err_field eq '')} checked="checked"{/if} /></td>
        </tr>
        <tr{cycle values=", class='TableSubHead'"}  style="display:none;">
          <td><label for="open_blank">{$lng.lbl_open_in_new_window}:</label></td>
          <td><input type="checkbox" value="N" id="open_blank" name="add[open_blank]"{if $banner.open_blank eq 'Y' or ($banner.bannerid eq '' and $err_field eq '')} checked="checked"{/if} /></td>
        </tr>      
          <tr{cycle values=", class='TableSubHead'"} style="display:none;">
            <td><label for="legend">{$lng.lbl_text}</label> ({$lng.lbl_optional}):</td>
            <td><textarea cols="50" rows="3" id="legend" name="add[legend]">{$banner.legend}</textarea></td>
          </tr>
          
          <tr{cycle values=", class='TableSubHead'"} style="display:none;">
            <td><label for="direction">{$lng.lbl_text_location}:</label></td>
            <td>
              <select id="direction" name="add[direction]">
                <option value="U"{if $banner.direction eq 'U' or $banner.direction eq ''} selected="selected"{/if}>{$lng.lbl_above}</option>
                <option value="L"{if $banner.direction eq 'L'} selected="selected"{/if}>{$lng.lbl_left}</option>
                <option value="R"{if $banner.direction eq 'R'} selected="selected"{/if}>{$lng.lbl_right}</option>
                <option value="D"{if $banner.direction eq 'D'} selected="selected"{/if}>{$lng.lbl_below}</option>
              </select>
            </td>
          </tr> 
          <tr{cycle values=", class='TableSubHead'"} class='TableSubHead'>
            <td>{$lng.lbl_image}:</td>
            <td>
              {include file="admin/newfilesbysr/edit_image.tpl" type="H" id=$banner.bannerid button_name=$lng.lbl_save_banner}
            </td>
          </tr> 
         <tr>
          <td>&nbsp;</td>
          <td class="SubmitBox"><input type="submit" value="{$lng.lbl_save_banner|strip_tags:false|escape}" /></td>
        </tr>
      </table>
    </form>  
  {/capture}
  {if $banner.banner_type ne ''}
    {assign var="title" value=$lng.lbl_modify_banner}
  {else}
    {assign var="title" value=$lng.lbl_add_banner}
  {/if}
  {include file="dialog.tpl" content=$smarty.capture.dialog title=$title extra='width="100%"'}
  {/if}
{/if}

n      custommodules.tpl (newfile)
n      <li>
n              <a href='{$catalogs.provider}/testimonials.php'>Custom Modules</a>
n              <div>
n                          <a href="{$catalogs.admin}/home_banners.php">Home Page Banners</a>
n              </div>
n      </li>
      ---customer
         ---newfilesbysr
              --- home_banners.tpl (newfile)
{literal}
<style type="text/css">
div#slideshow {width: 965px; overflow: scroll; position: relative; z-index: 5; margin-bottom:20px;}
div#slideshow ul#nav {display: none;list-style: none;position: relative; top: 75px; z-index: 15;}
div#slideshow ul#nav li#prev {float: left; margin: 0 0 0 10px;}
div#slideshow ul#nav li#next {float: right; margin: 0 50px 0 0;}
div#slideshow ul#nav li a {display: block; width: 80px; height: 80px; text-indent: -9999px;}
div#slideshow ul#nav li#prev a {background: url("../AddYourDirName/skin/common_files/images/prev.png");}
div#slideshow ul#nav li#next a {background: url("../AddYourDirName/skin/common_files/images/next.png");}
div#slideshow ul#slides {list-style: none; padding-left:0px;}
div#slideshow ul#slides li {margin: 0 0 20px 0;}
a {outline: none!important; }
</style>
<script type="text/javascript" src="../AddYourDirName/skin/common_files/js/newfilesbysr/jquery.cycle.all.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
            $("#slideshow").css("overflow", "hidden");   
            $("ul#slides").cycle({
                        fx: 'fade',
                        pause: 1,
                        prev: '#prev',
                        next: '#next'
            });       
            $("#slideshow").hover(function() { $("ul#nav").fadeIn(); },
            function() { $("ul#nav").fadeOut(); });
});
</script>
{/literal}
<div id="slideshow">
{if $banners|@count gt 1} <ul id="nav" style="display: none;"> <li id="prev"><a href="#">Previous</a></li><li id="next"><a href="#">Next</a></li> </ul> {/if}
<ul id="slides">
    {foreach from=$banners item=v}
            <li>
<img src="{$current_location}/image.php?type=H&amp;id={$v.bannerid}" border="0" alt="{if $v.alt ne ''}{$v.alt|escape}{/if}" width="{$v.banner_x}" height="{$v.banner_y}" >
</li>
    {/foreach}
</ul>
</div>
      ---images
          next.png,prev.png(80X80)
      ---js
         ---newfilesbysr
                ----jquery.cycle.all.min.js (new files) à http://code.google.com/p/rgbm/downloads/detail?name=jquery.cycle.all.min.js&can=2&q=
                        or
                ----jquery.wgslider.js (new files) à http://wegraphics.net/downloads/free-simple-jquery-slider/

MODIFY Following EXSITING FILES
home.php
/*** HOME PAGE BANNER MODULE CODE ***/
if (!empty($active_modules['HomeBanners'])) {
    include $xcart_dir . '/modules/HomeBanners/home_banners.php';
}
/** END */

INSTALLATION INSTRUCTION
1. place all the file on proper laoction.
2. run the following patch
     2.a) Create Table for store banner Image
           CREATE TABLE IF NOT EXISTS `xcart_images_H` (
             `imageid` int(11) NOT NULL AUTO_INCREMENT,
             `id` int(11) NOT NULL DEFAULT '0',
             `image` mediumblob NOT NULL,
             `image_path` varchar(255) NOT NULL DEFAULT '',
             `image_type` varchar(64) NOT NULL DEFAULT 'image/jpeg',
             `image_x` int(11) NOT NULL DEFAULT '0',
             `image_y` int(11) NOT NULL DEFAULT '0',
             `image_size` int(11) NOT NULL DEFAULT '0',
             `filename` varchar(255) NOT NULL DEFAULT '',
             `date` int(11) NOT NULL DEFAULT '0',
             `alt` varchar(255) NOT NULL DEFAULT '',
             `avail` char(1) NOT NULL DEFAULT 'Y',
             `orderby` int(11) NOT NULL DEFAULT '0',
             `md5` char(32) NOT NULL DEFAULT '',
             PRIMARY KEY (`imageid`),
             UNIQUE KEY `id` (`id`),
             KEY `image_path` (`image_path`)
           ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

     2.b) Create Table for store banner Image Info.
           CREATE TABLE IF NOT EXISTS `xcart_home_banners` (
             `bannerid` int(11) NOT NULL AUTO_INCREMENT,
             `banner` varchar(128) NOT NULL DEFAULT '',
             `body` mediumblob NOT NULL,
             `avail` char(1) NOT NULL DEFAULT 'Y',
             `is_image` char(1) NOT NULL DEFAULT 'Y',
             `is_name` char(1) NOT NULL DEFAULT 'Y',
             `is_descr` char(1) NOT NULL DEFAULT 'Y',
             `is_add` char(1) NOT NULL DEFAULT 'Y',
             `banner_type` char(1) NOT NULL DEFAULT 'T',
             `open_blank` char(1) NOT NULL DEFAULT 'Y',
             `legend` text NOT NULL,
             `alt` text NOT NULL,
             `direction` char(1) NOT NULL DEFAULT 'D',
             `banner_x` int(11) NOT NULL DEFAULT '0',
             `banner_y` int(11) NOT NULL DEFAULT '0',
             `userid` int(11) NOT NULL DEFAULT '0',
             PRIMARY KEY (`bannerid`),
             KEY `userid` (`userid`)
           ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

     2.c) Patch for home page banner Labels and text
           REPLACE INTO xcart_languages SET code='en', name='lbl_home_banners', value='Home page banners', topic='Labels';
           REPLACE INTO xcart_languages SET code='en', name='lbl_home_banners_management', value='Home page banners management', topic='Labels';
     2.d) patch for insert new module entry in database
           INSERT INTO `xcart_modules` (`moduleid`, `module_name`, `module_descr`, `active`, `init_orderby`, `author`, `module_url`) VALUES
           ('', 'HomeBanners', 'This module enables the Home Page Banners', 'Y', 0, 'qualiteam', '');


3.) Create images_H folder under images folder at root level with 777 permision

4.) Modify following files.
     4.1) Admin section TPL
           a.) open /skin/common_files/single/menu_box.tpl
                insert <a href="{$catalogs.admin}/home_banners.php">Home Page Banners</a>
                after <a href="{$catalogs.admin}/images_location.php">{$lng.lbl_images_location}</a>
           b.) open /skin/common_files/single/home.tpl
                insert
                     {elseif $main eq "home_banners"}
                     {include file="admin/newfilesbysr/home_banners.tpl"}
                after
                     {elseif $main eq "configuration"}
                           {include file="admin/main/configuration.tpl"}
     4.2) FRONT END SECTION TPL
           a.) open /skin/common_files/customer/home_main.tpl
                insert
                      {if $customer_home_banners eq "Y"} 
                         {include file="customer/newfilesbysr/home_banners.tpl"}
                      {/if}
                after
                     {elseif $main eq "catalog" and $current_category.category eq ""}
           b.) open /home.php
                insert
                     if (!empty($active_modules['HomeBanners'])) {
                          include $xcart_dir . '/modules/HomeBanners/home_banners.php';
                     }
                before
                     $smarty->assign('main',     'catalog');
    

For Customize slider option check this link
http://wegraphics.net/downloads/free-simple-jquery-slider/
http://basic-slider.com/

List OF BANK PAN Numbers

List OF BANK PAN Numbers Bank/Home Loan Providers PAN Number Allahabad Bank AACCA8464F Andhra Bank AABCA7375C Axis Bank...