Example #1
0
function multicurrency_add_prices($formatted_price)
{
    if (osc_item_price() != NULL && osc_item_price() != '' && osc_item_price() != 0) {
        $rates = ModelMC::newInstance()->getRates(osc_item_currency());
        $data = array();
        foreach ($rates as $r) {
            $price = osc_item_price() / 1000000 * $r['f_rate'];
            $symbol = $r['s_to'];
            $currencyFormat = osc_locale_currency_format();
            $currencyFormat = str_replace('{NUMBER}', number_format($price, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep()), $currencyFormat);
            $currencyFormat = str_replace('{CURRENCY}', $symbol, $currencyFormat);
            $data[] = $currencyFormat;
        }
        return $formatted_price . ' <a class=MCtooltip href="#">' . __('Other currencies', 'multicurrency') . '<span>' . implode("<br />", $data) . '</span></a>';
    }
    return $formatted_price;
}
Example #2
0
        /**
         * Return an array with all data necessary for do the action (ADD OR EDIT)
         * @param <type> $is_add
         * @return array
         */
        public function prepareData( $is_add )
        {
            $aItem = array();
            $data = array();

            $userId = null;
            if( $this->is_admin ) {
                // user
                $data   = User::newInstance()->findByEmail(Params::getParam('contactEmail'));
                if( isset($data['pk_i_id']) && is_numeric($data['pk_i_id']) ) {
                    $userId = $data['pk_i_id'];
                }
            } else {
                $userId = Session::newInstance()->_get('userId');
                if( $userId == '' ) {
                    $userId = NULL;
                } elseif ($userId != NULL) {
                    $data   = User::newInstance()->findByPrimaryKey( $userId );
                }
            }

            if( $userId != null ) {
                $aItem['contactName']   = $data['s_name'];
                $aItem['contactEmail']  = $data['s_email'];
                Params::setParam('contactName', $data['s_name']);
                Params::setParam('contactEmail', $data['s_email']);
            } else {
                $aItem['contactName']   = Params::getParam('contactName');
                $aItem['contactEmail']  = Params::getParam('contactEmail');
            }
            $aItem['userId']        = $userId;

            if( $is_add ) {   // ADD
                if($this->is_admin) {
                    $active = 'ACTIVE';
                } else {
                    if(osc_moderate_items()>0) { // HAS TO VALIDATE
                        if(!osc_is_web_user_logged_in()) { // NO USER IS LOGGED, VALIDATE
                            $active = 'INACTIVE';
                        } else { // USER IS LOGGED
                            if(osc_logged_user_item_validation()) { //USER IS LOGGED, BUT NO NEED TO VALIDATE
                                $active = 'ACTIVE';
                            } else { // USER IS LOGGED, NEED TO VALIDATE, CHECK NUMBER OF PREVIOUS ITEMS
                                $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
                                if($user['i_items']<osc_moderate_items()) {
                                    $active = 'INACTIVE';
                                } else {
                                    $active = 'ACTIVE';
                                }
                            }
                        }
                    } else if(osc_moderate_items()==0 ){
                        if(osc_is_web_user_logged_in() && osc_logged_user_item_validation() ) {
                            $active = 'ACTIVE';
                        } else {
                            $active = 'INACTIVE';
                        }
                    } else {
                        $active = 'ACTIVE';
                    }
                }
                $aItem['active']        = $active;
            } else {          // EDIT
                $aItem['secret']    = Params::getParam('secret');
                $aItem['idItem']    = Params::getParam('id');
            }

            // get params
            $aItem['catId']         = Params::getParam('catId');
            $aItem['countryId']     = Params::getParam('countryId');
            $aItem['country']       = Params::getParam('country');
            $aItem['region']        = Params::getParam('region');
            $aItem['regionId']      = Params::getParam('regionId');
            $aItem['city']          = Params::getParam('city');
            $aItem['cityId']        = Params::getParam('cityId');
            $aItem['price']         = (Params::getParam('price') != '') ? Params::getParam('price') : null;
            $aItem['cityArea']      = Params::getParam('cityArea');
            $aItem['address']       = Params::getParam('address');
            $aItem['currency']      = Params::getParam('currency');
            $aItem['showEmail']     = (Params::getParam('showEmail') != '') ? 1 : 0;
            $aItem['title']         = Params::getParam('title');
            $aItem['description']   = Params::getParam('description');
            $aItem['photos']        = Params::getFiles('photos');
            $ajax_photos            = Params::getParam('ajax_photos');
            $aItem['s_ip']          = get_ip();
            $aItem['d_coord_lat']   = (Params::getParam('d_coord_lat')  != '') ? Params::getParam('d_coord_lat') : null;
            $aItem['d_coord_long']  = (Params::getParam('d_coord_long') != '') ? Params::getParam('d_coord_long') : null;
            $aItem['s_zip']         = (Params::getParam('zip')  != '') ? Params::getParam('zip') : null;

            // $ajax_photos is an array of filenames of the photos uploaded by ajax to a temporary folder
            // fake insert them into the array of the form-uploaded photos
            if(is_array($ajax_photos)) {
                foreach($ajax_photos as $photo) {
                    if(file_exists(osc_content_path().'uploads/temp/'.$photo)) {
                        $aItem['photos']['name'][]      = $photo;
                        $aItem['photos']['type'][]      = 'image/*';
                        $aItem['photos']['tmp_name'][]  = osc_content_path().'uploads/temp/'.$photo;
                        $aItem['photos']['error'][]     = UPLOAD_ERR_OK;
                        $aItem['photos']['size'][]      = 0;
                    }
                }
            }

            if($is_add || $this->is_admin) {
                $dt_expiration = Params::getParam('dt_expiration');
                if($dt_expiration==-1) {
                    $aItem['dt_expiration'] = '';
                } else if($dt_expiration!='' && (preg_match('|^([0-9]+)$|', $dt_expiration, $match) || preg_match('|([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})|', $dt_expiration, $match))) {
                    $aItem['dt_expiration'] = $dt_expiration;
                } else {
                    $_category = Category::newInstance()->findByPrimaryKey($aItem['catId']);
                    $aItem['dt_expiration'] = $_category['i_expiration_days'];
                }
                unset($dt_expiration);
            } else {
                $aItem['dt_expiration'] = '';
            };

            // check params
            $country = Country::newInstance()->findByCode($aItem['countryId']);
            if( count($country) > 0 ) {
                $countryId = $country['pk_c_code'];
                $countryName = $country['s_name'];
            } else {
                $countryId = null;
                $countryName = $aItem['country'];
            }
            $aItem['countryId']   = $countryId;
            $aItem['countryName']   = $countryName;

            if( $aItem['regionId'] != '' ) {
                if( intval($aItem['regionId']) ) {
                    $region = Region::newInstance()->findByPrimaryKey($aItem['regionId']);
                    if( count($region) > 0 ) {
                        $regionId = $region['pk_i_id'];
                        $regionName = $region['s_name'];
                    }
                }
            } else {
                $regionId = null;
                $regionName = $aItem['region'];
                if( $aItem['countryId'] != '' ) {
                    $auxRegion  = Region::newInstance()->findByName($aItem['region'], $aItem['countryId'] );
                    if($auxRegion){
                        $regionId   = $auxRegion['pk_i_id'];
                        $regionName = $auxRegion['s_name'];
                    }
                }
            }

            $aItem['regionId']      = $regionId;
            $aItem['regionName']    = $regionName;

            if( $aItem['cityId'] != '' ) {
                if( intval($aItem['cityId']) ) {
                    $city = City::newInstance()->findByPrimaryKey($aItem['cityId']);
                    if( count($city) > 0 ) {
                        $cityId = $city['pk_i_id'];
                        $cityName = $city['s_name'];
                    }
                }
            } else {
                $cityId = null;
                $cityName = $aItem['city'];
                if( $aItem['countryId'] != '' ) {
                    $auxCity = City::newInstance()->findByName($aItem['city'], $aItem['regionId'] );
                    if($auxCity){
                        $cityId   = $auxCity['pk_i_id'];
                        $cityName = $auxCity['s_name'];
                    }
                }
            }

            $aItem['cityId']      = $cityId;
            $aItem['cityName']    = $cityName;

            if( $aItem['cityArea'] == '' ) {
                $aItem['cityArea'] = null;
            }

            if( $aItem['address'] == '' ) {
                $aItem['address'] = null;
            }

            if( !is_null($aItem['price']) ) {
                $price = str_replace(osc_locale_thousands_sep(), '', trim($aItem['price']));
                $price = str_replace(osc_locale_dec_point(), '.', $price);
                $aItem['price'] = $price*1000000;
                //$aItem['price'] = (float) $aItem['price'];
            }

            if( $aItem['catId'] == ''){
                $aItem['catId'] = 0;
            }

            if( $aItem['currency'] == '' ) {
                $aItem['currency'] = null;
            }

            $this->data = $aItem;
        }
Example #3
0
 /**
  * Return an array with all data necessary for do the action (ADD OR EDIT)
  * @param <type> $is_add
  * @return array
  */
 public function prepareData($is_add)
 {
     $aItem = array();
     // prepare user
     $userId = null;
     if ($this->is_admin) {
         if (Params::getParam('userId') != '') {
             $userId = Params::getParam('userId');
         }
     } else {
         $userId = Session::newInstance()->_get('userId');
         if ($userId == '') {
             $userId = NULL;
         }
     }
     if ($is_add) {
         // ADD
         if ($this->is_admin) {
             $active = 'ACTIVE';
         } else {
             if (osc_moderate_items() > 0) {
                 // HAS TO VALIDATE
                 if (!osc_is_web_user_logged_in()) {
                     // NO USER IS LOGGED, VALIDATE
                     $active = 'INACTIVE';
                 } else {
                     // USER IS LOGGED
                     if (osc_logged_user_item_validation()) {
                         //USER IS LOGGED, BUT NO NEED TO VALIDATE
                         $active = 'ACTIVE';
                     } else {
                         // USER IS LOGGED, NEED TO VALIDATE, CHECK NUMBER OF PREVIOUS ITEMS
                         $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());
                         if ($user['i_items'] < osc_moderate_items()) {
                             $active = 'INACTIVE';
                         } else {
                             $active = 'ACTIVE';
                         }
                     }
                 }
             } else {
                 if (osc_moderate_items() == 0) {
                     if (osc_is_web_user_logged_in() && osc_logged_user_item_validation()) {
                         $active = 'ACTIVE';
                     } else {
                         $active = 'INACTIVE';
                     }
                 } else {
                     $active = 'ACTIVE';
                 }
             }
         }
         if ($userId != null) {
             $data = User::newInstance()->findByPrimaryKey($userId);
             $aItem['contactName'] = $data['s_name'];
             $aItem['contactEmail'] = $data['s_email'];
             Params::setParam('contactName', $data['s_name']);
             Params::setParam('contactEmail', $data['s_email']);
         } else {
             $aItem['contactName'] = Params::getParam('contactName');
             $aItem['contactEmail'] = Params::getParam('contactEmail');
         }
         $aItem['active'] = $active;
         $aItem['userId'] = $userId;
     } else {
         // EDIT
         $aItem['secret'] = Params::getParam('secret');
         $aItem['idItem'] = Params::getParam('id');
         if ($userId != null) {
             $data = User::newInstance()->findByPrimaryKey($userId);
             $aItem['contactName'] = $data['s_name'];
             $aItem['contactEmail'] = $data['s_email'];
             Params::setParam('contactName', $data['s_name']);
             Params::setParam('contactEmail', $data['s_email']);
         } else {
             $aItem['contactName'] = Params::getParam('contactName');
             $aItem['contactEmail'] = Params::getParam('contactEmail');
         }
         $aItem['userId'] = $userId;
     }
     // get params
     $aItem['catId'] = Params::getParam('catId');
     $aItem['countryId'] = Params::getParam('countryId');
     $aItem['country'] = Params::getParam('country');
     $aItem['region'] = Params::getParam('region');
     $aItem['regionId'] = Params::getParam('regionId');
     $aItem['city'] = Params::getParam('city');
     $aItem['cityId'] = Params::getParam('cityId');
     $aItem['price'] = Params::getParam('price') != '' ? Params::getParam('price') : null;
     $aItem['cityArea'] = Params::getParam('cityArea');
     $aItem['address'] = Params::getParam('address');
     $aItem['currency'] = Params::getParam('currency');
     $aItem['showEmail'] = Params::getParam('showEmail') != '' ? 1 : 0;
     $aItem['title'] = Params::getParam('title');
     $aItem['description'] = Params::getParam('description');
     $aItem['photos'] = Params::getFiles('photos');
     // check params
     $country = Country::newInstance()->findByCode($aItem['countryId']);
     if (count($country) > 0) {
         $countryId = $country['pk_c_code'];
         $countryName = $country['s_name'];
     } else {
         $countryId = null;
         $countryName = $aItem['country'];
     }
     $aItem['countryId'] = $countryId;
     $aItem['countryName'] = $countryName;
     if ($aItem['regionId'] != '') {
         if (intval($aItem['regionId'])) {
             $region = Region::newInstance()->findByPrimaryKey($aItem['regionId']);
             if (count($region) > 0) {
                 $regionId = $region['pk_i_id'];
                 $regionName = $region['s_name'];
             }
         }
     } else {
         $regionId = null;
         $regionName = $aItem['region'];
         if ($aItem['countryId'] != '') {
             $auxRegion = Region::newInstance()->findByName($aItem['region'], $aItem['countryId']);
             if ($auxRegion) {
                 $regionId = $auxRegion['pk_i_id'];
                 $regionName = $auxRegion['s_name'];
             }
         }
     }
     $aItem['regionId'] = $regionId;
     $aItem['regionName'] = $regionName;
     if ($aItem['cityId'] != '') {
         if (intval($aItem['cityId'])) {
             $city = City::newInstance()->findByPrimaryKey($aItem['cityId']);
             if (count($city) > 0) {
                 $cityId = $city['pk_i_id'];
                 $cityName = $city['s_name'];
             }
         }
     } else {
         $cityId = null;
         $cityName = $aItem['city'];
         if ($aItem['countryId'] != '') {
             $auxCity = City::newInstance()->findByName($aItem['city'], $aItem['regionId']);
             if ($auxCity) {
                 $cityId = $auxCity['pk_i_id'];
                 $cityName = $auxCity['s_name'];
             }
         }
     }
     $aItem['cityId'] = $cityId;
     $aItem['cityName'] = $cityName;
     if ($aItem['cityArea'] == '') {
         $aItem['cityArea'] = null;
     }
     if ($aItem['address'] == '') {
         $aItem['address'] = null;
     }
     if (!is_null($aItem['price'])) {
         $price = str_replace(osc_locale_thousands_sep(), '', trim($aItem['price']));
         $price = str_replace(osc_locale_dec_point(), '.', $price);
         $aItem['price'] = $price * 1000000;
         //$aItem['price'] = (float) $aItem['price'];
     }
     if ($aItem['catId'] == '') {
         $aItem['catId'] = 0;
     }
     if ($aItem['currency'] == '') {
         $aItem['currency'] = null;
     }
     $this->data = $aItem;
 }
Example #4
0
        ?>
', '');
            }
            <?php 
    }
    ?>
            <?php 
    if (osc_locale_dec_point() != '') {
        ?>
            var tmp = price.split('<?php 
        echo osc_esc_js(osc_locale_dec_point());
        ?>
');
            if(tmp.length>2) {
                price = tmp[0]+'<?php 
        echo osc_esc_js(osc_locale_dec_point());
        ?>
'+tmp[1];
            }
            <?php 
    }
    ?>
            $("#price").prop("value", price);
        });
    });
    <?php 
}
?>
</script>
<?php 
osc_current_web_theme_path('footer.php');
Example #5
0
/**
 * Formats the price using the appropiate currency.
 *
 * @param float $price
 * @return string
 */
function osc_format_price($price)
{
    if ($price == null) {
        return osc_apply_filter('item_price_null', __('Check with seller'));
    }
    if ($price == 0) {
        return osc_apply_filter('item_price_zero', __('Free'));
    }
    $price = $price / 1000000;
    $currencyFormat = osc_locale_currency_format();
    $currencyFormat = str_replace('{NUMBER}', number_format($price, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep()), $currencyFormat);
    $currencyFormat = str_replace('{CURRENCY}', osc_item_currency(), $currencyFormat);
    return osc_apply_filter('item_price', $currencyFormat);
}
Example #6
0
function customHead()
{
    ?>
        <script type="text/javascript">

            document.write('<style type="text/css"> .tabber{ display:none; } </style>');
            $(document).ready(function(){
                $('input[name="user"]').attr( "autocomplete", "off" );
                $('#user,#fUser').autocomplete({
                    source: "<?php 
    echo osc_admin_base_url(true);
    ?>
?page=ajax&action=userajax",
                    minLength: 0,
                    select: function( event, ui ) {
                        if(ui.item.id=='') {
                            $("#contact_info").show();
                            return false;
                        }
                        $('#userId').val(ui.item.id);
                        $('#fUserId').val(ui.item.id);
                        $("#contact_info").hide();
                    }
                });

                <?php 
    if (osc_locale_thousands_sep() != '' || osc_locale_dec_point() != '') {
        ?>
                $("#price").blur(function(event) {
                    var price = $("#price").attr("value");
                    <?php 
        if (osc_locale_thousands_sep() != '') {
            ?>
                    while(price.indexOf('<?php 
            echo osc_esc_js(osc_locale_thousands_sep());
            ?>
')!=-1) {
                        price = price.replace('<?php 
            echo osc_esc_js(osc_locale_thousands_sep());
            ?>
', '');
                    }
                    <?php 
        }
        ?>
                    <?php 
        if (osc_locale_dec_point() != '') {
            ?>
                    var tmp = price.split('<?php 
            echo osc_esc_js(osc_locale_dec_point());
            ?>
');
                    if(tmp.length>2) {
                        price = tmp[0]+'<?php 
            echo osc_esc_js(osc_locale_dec_point());
            ?>
'+tmp[1];
                    }
                    <?php 
        }
        ?>
                    $("#price").attr("value", price);
                });
                <?php 
    }
    ?>
            });
        </script>
        <?php 
    ItemForm::location_javascript_new('admin');
    ?>
        <?php 
    if (osc_images_enabled_at_items()) {
        ItemForm::photos_javascript();
    }
    ?>
        <?php 
}
Example #7
0
function osc_prepare_price($price)
{
    return number_format($price / 1000000, osc_locale_num_dec(), osc_locale_dec_point(), osc_locale_thousands_sep());
}
Example #8
0
function customHead()
{
    ?>
        <script type="text/javascript" src="<?php 
    echo osc_current_admin_theme_js_url('jquery.validate.min.js');
    ?>
"></script>
        <script type="text/javascript">
            document.write('<style type="text/css"> .tabber{ display:none; } </style>') ;
            $(document).ready(function(){
                $("#userId").bind('change', function() {
                    if($(this).val() == '') {
                        $("#contact_info").show() ;
                    } else {
                        $("#contact_info").hide() ;
                    }
                }) ;

                if( $("#userId").val() == '') {
                    $("#contact_info").show() ;
                } else {
                    $("#contact_info").hide() ;
                }

                <?php 
    if (osc_locale_thousands_sep() != '' || osc_locale_dec_point() != '') {
        ?>
                $("#price").blur(function(event) {
                    var price = $("#price").attr("value");
                    <?php 
        if (osc_locale_thousands_sep() != '') {
            ?>
                    while(price.indexOf('<?php 
            echo osc_esc_js(osc_locale_thousands_sep());
            ?>
')!=-1) {
                        price = price.replace('<?php 
            echo osc_esc_js(osc_locale_thousands_sep());
            ?>
', '');
                    }
                    <?php 
        }
        ?>
                    <?php 
        if (osc_locale_dec_point() != '') {
            ?>
                    var tmp = price.split('<?php 
            echo osc_esc_js(osc_locale_dec_point());
            ?>
');
                    if(tmp.length>2) {
                        price = tmp[0]+'<?php 
            echo osc_esc_js(osc_locale_dec_point());
            ?>
'+tmp[1];
                    }
                    <?php 
        }
        ?>
                    $("#price").attr("value", price);
                });
                <?php 
    }
    ?>
            });
        </script>
        <?php 
    ItemForm::location_javascript_new('admin');
    ?>
        <?php 
    if (osc_images_enabled_at_items()) {
        ItemForm::photos_javascript();
    }
    ?>
        <?php 
}
Example #9
0
function customHead()
{
    ?>
        <script type="text/javascript">

            document.write('<style type="text/css"> .tabber{ display:none; } </style>');
            $(document).ready(function(){
                $('input[name="user"]').attr( "autocomplete", "off" );
                $('#user,#fUser').autocomplete({
                    source: "<?php 
    echo osc_admin_base_url(true);
    ?>
?page=ajax&action=userajax",
                    minLength: 0,
                    select: function( event, ui ) {
                        if(ui.item.id=='') {
                            $("#contact_info").show();
                            return false;
                        }
                        $('#userId').val(ui.item.id);
                        $('#fUserId').val(ui.item.id);
                        $("#contact_info").hide();
                    }
                });

                $('.ui-autocomplete').css('zIndex', 10000);

                <?php 
    if (osc_locale_thousands_sep() != '' || osc_locale_dec_point() != '') {
        ?>
                $("#price").on("blur", function(event) {
                    var price = $("#price").prop("value");
                    <?php 
        if (osc_locale_thousands_sep() != '') {
            ?>
                    while(price.indexOf('<?php 
            echo osc_esc_js(osc_locale_thousands_sep());
            ?>
')!=-1) {
                        price = price.replace('<?php 
            echo osc_esc_js(osc_locale_thousands_sep());
            ?>
', '');
                    }
                    <?php 
        }
        ?>
                    <?php 
        if (osc_locale_dec_point() != '') {
            ?>
                    var tmp = price.split('<?php 
            echo osc_esc_js(osc_locale_dec_point());
            ?>
');
                    if(tmp.length>2) {
                        price = tmp[0]+'<?php 
            echo osc_esc_js(osc_locale_dec_point());
            ?>
'+tmp[1];
                    }
                    <?php 
        }
        ?>
                    $("#price").prop("value", price);

                });
                <?php 
    }
    ?>

                $('#update_expiration').change( function() {
                    if($(this).attr("checked")) {
                        $('#dt_expiration').prop('value', '');
                        $('div.update_expiration').show();
                    } else {
                        $('#dt_expiration').prop('value', '-1');
                        $('div.update_expiration').hide();
                    }
                });

                $('body').on("created", '[name^="select_"]',function(evt) {
                    selectUi($(this));
                });

            });
        </script>
        <?php 
    ItemForm::location_javascript('admin');
    ?>
        <?php 
    if (osc_images_enabled_at_items()) {
        ItemForm::photos_javascript();
    }
    ?>
        <?php 
}
Example #10
0
    function fjs_search()
    {
        echo "\n";
        ?>
    <script type="text/javascript">
    var sQuery = '<?php 
        echo osc_esc_js(osc_get_preference('keyword_placeholder', 'realestate'));
        ?>
' ;
    $(document).ready(function(){
                var element = $('input[name="sPattern"]');
                element.focus(function(){
                        $(this).prev().hide();
                }).blur(function(){
                    if($(this).val() == '') {
                        $(this).prev().show();
                    }
                }).prev().click(function(){
                        $(this).hide();
                        $(this).next().focus();
                });
                if(element.val() != ''){
                    element.prev().hide();
                }
                <?php 
        if (osc_locale_thousands_sep() != '' || osc_locale_dec_point() != '') {
            ?>
                    $("#price").blur(function(event) {
                        var price = $("#price").attr("value");
                        <?php 
            if (osc_locale_thousands_sep() != '') {
                ?>
                        while(price.indexOf('<?php 
                echo osc_esc_js(osc_locale_thousands_sep());
                ?>
')!=-1) {
                            price = price.replace('<?php 
                echo osc_esc_js(osc_locale_thousands_sep());
                ?>
', '');
                        }
                        <?php 
            }
            ?>
                        <?php 
            if (osc_locale_dec_point() != '') {
                ?>
                        var tmp = price.split('<?php 
                echo osc_esc_js(osc_locale_dec_point());
                ?>
');
                        if(tmp.length>2) {
                            price = tmp[0]+'<?php 
                echo osc_esc_js(osc_locale_dec_point());
                ?>
'+tmp[1];
                        }
                        <?php 
            }
            ?>
                        $("#price").attr("value", price);
                    });
                <?php 
        }
        ?>
            });
    function doSearch() {
        var sPattern = $('input[name=sPattern]');
        var text = '<?php 
        echo osc_esc_js(__('Your search must be at least three characters long', 'realestate'));
        ?>
';
        if((sPattern.hasClass('js-input-home') && sPattern.val() == '' && sPattern.val().length < 3) || (sPattern.val() != '' && sPattern.val().length < 3)) {
            $('#message-seach').text(text).show();
            return false;
        }
        return true;
    }
    </script>
    <?php 
    }