<?php
/******************************************************************************/
//                                                                            //
//                             Smarty plugin                                  //
//                            @package Smarty                                 //
//							 @subpackage plugins                              //
//                        http://life-style.uz/                               //
//                   produced by Life Style, life-style.uz                    //
//                                                                            //
/******************************************************************************/

function smarty_function_fetch_dealers($params, &$smarty){

	$assign        = fetch_getParam('assign', $params, 'dealers');
	$fields        = fetch_getParam('fields', $params, 'dealerId, countryId, title, alias, content, status, coordinates');
	$status        = fetch_getParam('status', $params, 'V');
    $countryId     = (int) fetch_getParam('country', $params);


	/* conditions */
	if($countryId > 0) {
        connect()->where('countryId', $countryId);
    }

	$dealers = connect('dealers')->select($fields)->where('status', $status)->orderBy('orderBy ASC')->getAll('array');

//	print_r($dealers);
	$smarty->assign($assign, $dealers);

	return null;
}
?>