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

function smarty_function_fetch_features($params, &$smarty){


	$assign        = fetch_getParam('assign', $params, 'features');
	$fields        = fetch_getParam('fields', $params, 'id, name, fileName, status, orderBy, sectionIds, isFilter, content');
	$status        = fetch_getParam('status', $params, 'V');

	$isFilter      = fetch_getParam('isFilter', $params, 1);
	$order         = fetch_getParam('order', $params, 'orderBy ASC');
	$orderBy       = fetch_getParam('orderBy', $params, $order);

	$section       = fetch_getParam('section', $params);

    if (!empty($status)) connect()->where('status', $status);
    if (!empty($section))  connect()->like('sectionIds', "%". $section . "%");

	$features = connect()->table('product_features')->select($fields)->where('isFilter',$isFilter)->orderBy($orderBy)->indexkey('id')->getAllIndexes('array');
//   print_r(connect()->getQuery());

//    print_r($features);
	$smarty->assign($assign, $features);
	
	return null;
}



?>