Saturday 29 October 2016

Custom module customer portal vtiger

when you create a custom or fresh module in vTiger (6.4 and 6.5), so for displaying it in myc customer portal dashboard side bar panel , we need to modified some tables , after modifying tables you will see your module showing in customer portal dashboard side bar as hyper link. Below are the tables you need to modified.
 
vtiger_tab : just look for table in mysql and search for your module name get tabid of it.
vtiger_customerportal_tabs: just copy or insert a new record in this table as below colums 
tabid: from vtiger_tab table , visible:1 (do not change) , sequence=MAX ID + 1
vtiger_customerportal_prefs: just copy or insert new record with 
tabid: from table vtiger_tab , prefkey:(do no change) , perfvalue :(do no change)

Thursday 14 July 2016

Skrill payment integration

1. For setting up both Merchant and Customer Test Account, please do the following:
Go to skrill.com and open two standard customer accounts without doing any transactions. Send the E-mail addresses of the accounts to integrationsupport@paysafe.com and inform them which one you`d like converted to Customer and which one to Merchant Test Accounts. Feel free to input any kind of data when opening up the as they will be converted. Be informed that these accounts will not be converted back to real ones and the funds added can only be used in test environment.
 
2. Your html markup will goes like below. This is just a sample or test html page. security and other things depends upon your code style.
<form action="https://pay.skrill.com?action=status_trn" method="post" name="payment_form" 
id="payment_form">
<input type="hidden" name="pay_to_email" value="demoqco@sun-fish.com">
<input type="hidden" name="transaction_id" value="">
<input type="hidden" name="return_url" value="">
<input type="hidden" name="cancel_url" value="">
<input type="hidden" name="status_url" value="">
<input type="hidden" name="language" value="EN">
<input type="hidden" name="pay_from_email" value="payer123@skrill.com">
<input type="hidden" name="amount" value="">
<input type="hidden" name="currency" value="">
<input type="hidden" name="firstname" value="">
<input type="hidden" name="lastname" value="">
<input type="hidden" name="postal_code" value="">
<input type="hidden" name="city" value="">
<input type="hidden" name="country" value="">
<input type="hidden" name="address" value="">
<input type="hidden" name="date_of_birth" value="">
<input type="hidden" name="confirmation_note" value="Thanks for depositing fund into your account">
<input type="submit" value="Pay!">
</form>
<script type='text/javascript'>
    window.onload = function () {
        document.payment_form.submit()
    }
</script>

Sunday 10 April 2016

Php helper functions

Below are some usefull functions which you can use in your projects in any PHP framwork.
 
1. Below function will generate string as every string come with single quotes like ('Php','vTiger','Yii','Lavavel').
function in_clause($string){
   return "in ('" . str_replace(",", "','", $string) . "') ";
}
2. To count digit in a given numer.
function count_digit($number) {
    $digit = 0;
    do {
        $number /= 10;      //$number = $number / 10;
        $number = intval($number);
        $digit++;
    } while ($number != 0);
    return $digit;
}
2. To format an array as string which is need for running IN clause.
function format_in_clause($array) {
    if (isset($array)) {
        $realArray = explode(',', $array);
        if (is_array($realArray)) {
            $stringForIn = "'" . implode("','", $realArray) . "'";
            return $stringForIn;
        } 
    } else {
        return NULL;
    }
}
3. To converting an array to string.
function get_comma_seperator($array) {
    if (is_array($array)) {
        return $str = implode(",", $array);
    } else if (is_object($array)) {
        return implode(",", (array) $array);
    } else {
        return $array;
    }
}
4. To find a string contain comma in it or not.
function find_comma($string) {
    if (strpos($string, ",") !== false) {
        return 1;
    } else {
        return 0;
    }
}
5. To find a url contain http:// , https:// in it or not.
function check_http($url) {
    if (strpos($url, "http://") !== false) {
        return 1;
    } else {
        if (strpos($url, "https://") !== false) {
            return 1;
        } else {
            return 0;
        }
    }
}
6. To generate unique ids using mysql.
function gen_uuid() {
        global $adb;
        $order_id = NULL;
        $res = $adb->pquery("SELECT uuid() As order_id", array());
        $norows = $adb->num_rows($res);
        if ($norows > 0) {
            $order_id = $adb->query_result($res, 0, 'order_id');
            $order_id = str_replace('-', '', $order_id);
        }
        return $order_id;
    }