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

function smarty_function_fetch_payments($params, &$smarty) {
	
	$assign   = fetch_getParam('assign', $params, 'payments');
	$fields   = fetch_getParam('fields', $params, 'paymentId, name, fileName, status, summary');
	$status   = fetch_getParam('status', $params, 'V');
	$limit    = (int) fetch_getParam('limit', $params,  10);
    $orderBy  = fetch_getParam('orderBy', $params, 'paymentId ASC');

	/* conditions */
	$where = array();
	if(!empty($status)) connect()->where('status',  $status);


    $payments = connect()->table('shop_payments')->select($fields)->orderBy($orderBy)->limit($limit)->getAll('array');

//    $sliders = prepareSliders($sliders);
    
//    print_r($sliders);

	$smarty->assign($assign, $payments);

}