Advertisement:

Author Topic: Theme Paris - function.php  (Read 193 times)

Demyka

  • Newbie
  • *
  • Posts: 2
Theme Paris - function.php
« on: March 11, 2019, 02:19:42 pm »
Hello

My Theme is Paris. I found a code to improve the search function, I used this code in my previous theme (Bitfinder) and It worked but when I modify function.php in Paris theme, I can not be redirected to an existing page when I publish a new item. (I don't leave blank space at the end of the file).  Here is the code:

<?php
function cust_search_keyword_wildcard_with_username($params) {

    if ($params['sPattern']) {
        $mSearch =  Search::newInstance();
        $query_elements = (array) json_decode($mSearch->toJson());
        $pattern = $query_elements['sPattern'];


        $query_elements['sPattern'] = str_replace(' ', '* ', $pattern) . '*';

        $mSearch->setJsonAlert($query_elements);

        // Search by Username too
        $aPattern = explode(' ', $pattern);
        $userNameCond = '';

        foreach ($aPattern as $word) {
            if ($word) $userNameCond .= sprintf(" || %st_item.s_contact_name LIKE '%s%%'", DB_TABLE_PREFIX, $word);
        }

        $mSearch->addConditions("1 = 1 " . $userNameCond);
        $mSearch->addGroupBy(DB_TABLE_PREFIX.'t_item.pk_i_id');
    }
}

osc_add_hook('search_conditions', 'cust_search_keyword_wildcard_with_username', 1);
?>

Please, how can I avoid this error issue with Paris theme when I add any function to function.php. I have sent a ticket but for now I didn't get any answer.

Best regards

Demyka

  • Newbie
  • *
  • Posts: 2
Re: Theme Paris - function.php
« Reply #1 on: March 11, 2019, 07:20:49 pm »
Solved!