toJson()); $pattern = $query_elements['sPattern']; foreach (explode(' ', $pattern) as $word) { $query_elements['sPattern'] = str_replace($word, '+' . $word, $query_elements['sPattern']); } $mSearch->addLocale('%'); $mSearch->addGroupBy(DB_TABLE_PREFIX.'t_item.pk_i_id'); $mSearch->setJsonAlert($query_elements); } } osc_add_hook('search_conditions', 'cust_pattern_search_all_keywords_only', 10); function cust_alerts_user_dashboard() { if (Params::getParam('page') == "user" && Params::getParam('action') == "alerts") { $webUser = new CWebUser; $aAlerts = Alerts::newInstance()->findByUser( Session::newInstance()->_get('userId'), false ); $user = User::newInstance()->findByPrimaryKey( Session::newInstance()->_get('userId')); foreach($aAlerts as $k => $a) { $array_conditions = (array)json_decode($a['s_search']); $search = new Search(); $search->setJsonAlert($array_conditions); if (osc_version() > 361) $search->notFromUser(Session::newInstance()->_get('userId')); $search->addLocale('%'); $search->addGroupBy(DB_TABLE_PREFIX.'t_item.pk_i_id'); $search->limit(0, 3); $aAlerts[$k]['items'] = $search->doSearch(); } $webUser->_exportVariableToView('alerts', $aAlerts); View::newInstance()->_reset('alerts'); $webUser->_exportVariableToView('user', $user); } } osc_add_hook('before_html', 'cust_alerts_user_dashboard'); ?> Clothing, Shoes & Accessories for sale - County Down