This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

rsn

  • ***
  • 61 posts
how to configure the search (or it does not work)?
« on: February 19, 2017, 07:50:49 PM »
Search does not work correctly or do not work
1) all work ok
2) (particular) does not work
3) (company) does not work

Although the previous version of the theme to work all ok
« Last Edit: February 25, 2017, 07:52:30 PM by rsn »

*

Ivanko

  • *****
  • 388 posts
Re: how to configure the search (or it does not work)?
« Reply #1 on: February 19, 2017, 10:09:26 PM »
@ RSN
working on this site

https://mercado24.ro/
2) - OK
3) not sure about option private (particular)...

*

MB Themes

Re: how to configure the search (or it does not work)?
« Reply #2 on: February 19, 2017, 10:11:42 PM »
@rsn
I believe you have updated in way that you modified just few files.
Please replace all theme files and try again.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

rsn

  • ***
  • 61 posts
Re: how to configure the search (or it does not work)?
« Reply #3 on: February 20, 2017, 08:10:20 AM »
Hey. so on your website[/i]]website, this search does not work
http://veronika.mb-themes.com/search/cookieAction,done/sOrder,dt_pub_date/iOrderType,desc/sCompany,1
check on your site please

and is a previous version of the author himself wrote on this site mercado24

Marked as best answer by rsn on February 20, 2017, 09:15:43 AM
*

MB Themes

Re: how to configure the search (or it does not work)?
« Reply #4 on: February 20, 2017, 09:02:50 AM »
@rsn
Thank you, it seems problem was caused by order of conditions in theme functions.

Go to oc-content/themes/veronika/functions.php

Find function:
Code: [Select]
mb_filter_extend
Replace it with:
Code: [Select]
function mb_filter_extend() {
  // SEARCH - ALL - INDIVIDUAL - COMPANY TYPE
  Search::newInstance()->addJoinTable( 'pk_i_id', DB_TABLE_PREFIX.'t_item_veronika', DB_TABLE_PREFIX.'t_item.pk_i_id = '.DB_TABLE_PREFIX.'t_item_veronika.fk_i_item_id', 'LEFT OUTER' ) ; // Mod

  // SEARCH - TRANSACTION
  if(Params::getParam('sTransaction') <> '') {
    Search::newInstance()->addConditions(sprintf("%st_item_veronika.i_transaction = %d", DB_TABLE_PREFIX, Params::getParam('sTransaction')));
  }


  // SEARCH - CONDITION
  if(Params::getParam('sCondition') <> '') {
    Search::newInstance()->addConditions(sprintf("%st_item_veronika.i_condition = %d", DB_TABLE_PREFIX, Params::getParam('sCondition')));
  }


  // SEARCH - PERIOD
  if(Params::getParam('sPeriod') <> '') {
    $date_from = date('Y-m-d', strtotime(' -' . Params::getParam('sPeriod') . ' day', time()));
   
    Search::newInstance()->addConditions(sprintf('cast(%st_item.dt_pub_date as date) > "%s"', DB_TABLE_PREFIX, $date_from));
  }


  // SEARCH - COMPANY
  if(Params::getParam('sCompany') <> '' and Params::getParam('sCompany') <> null) {
    Search::newInstance()->addJoinTable( 'pk_i_id', DB_TABLE_PREFIX.'t_user', DB_TABLE_PREFIX.'t_item.fk_i_user_id = '.DB_TABLE_PREFIX.'t_user.pk_i_id', 'LEFT OUTER' ) ; // Mod

    if(Params::getParam('sCompany') == 1) {
      Search::newInstance()->addConditions(sprintf("%st_user.b_company = 1", DB_TABLE_PREFIX));
    } else {
      Search::newInstance()->addConditions(sprintf("coalesce(%st_user.b_company, 0) <> 1", DB_TABLE_PREFIX));
    }
  }
}
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Ivanko

  • *****
  • 388 posts
Re: how to configure the search (or it does not work)?
« Reply #5 on: February 20, 2017, 10:37:03 PM »
Is this will be updated in new upgraded release?

*

MB Themes

Re: how to configure the search (or it does not work)?
« Reply #6 on: February 21, 2017, 09:18:38 AM »
@Ivanko
Yes, it seems problem was that left outer join was before inner join that could cause mess in SQL (even it looked ok when I checked that)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bobyrou

  • ****
  • 107 posts
Re: how to configure the search (or it does not work)?
« Reply #7 on: April 24, 2017, 02:49:14 PM »
I have the same issue, BELOW is my code, can you please advise what exactly needs replaced?? thanks!!

Code: [Select]

function mb_filter_extend() {
  // SEARCH - ALL - INDIVIDUAL - COMPANY TYPE
  if(Params::getParam('sCompany') <> '' and Params::getParam('sCompany') <> null) {
    Search::newInstance()->addJoinTable( 'pk_i_id', DB_TABLE_PREFIX.'t_user', DB_TABLE_PREFIX.'t_item.fk_i_user_id = '.DB_TABLE_PREFIX.'t_user.pk_i_id', 'LEFT OUTER' ) ; // Mod

    if(Params::getParam('sCompany') == 1) {
      Search::newInstance()->addConditions(sprintf("%st_user.b_company = 1", DB_TABLE_PREFIX));
    } else {
      Search::newInstance()->addConditions(sprintf("coalesce(%st_user.b_company, 0) <> 1", DB_TABLE_PREFIX, DB_TABLE_PREFIX));
    }
  }


  Search::newInstance()->addJoinTable( 'pk_i_id', DB_TABLE_PREFIX.'t_item_veronika', DB_TABLE_PREFIX.'t_item.pk_i_id = '.DB_TABLE_PREFIX.'t_item_veronika.fk_i_item_id', 'LEFT OUTER' ) ; // Mod

  // SEARCH - TRANSACTION
  if(Params::getParam('sTransaction') <> '') {
    Search::newInstance()->addConditions(sprintf("%st_item_veronika.i_transaction = %d", DB_TABLE_PREFIX, Params::getParam('sTransaction')));
  }


  // SEARCH - CONDITION
  if(Params::getParam('sCondition') <> '') {
    Search::newInstance()->addConditions(sprintf("%st_item_veronika.i_condition = %d", DB_TABLE_PREFIX, Params::getParam('sCondition')));
  }


  // SEARCH - PERIOD
  if(Params::getParam('sPeriod') <> '') {
    $date_from = date('Y-m-d', strtotime(' -' . Params::getParam('sPeriod') . ' day', time()));
   
    Search::newInstance()->addConditions(sprintf('cast(%st_item.dt_pub_date as date) > "%s"', DB_TABLE_PREFIX, $date_from));
  }
}

osc_add_hook('search_conditions', 'mb_filter_extend');

*

Ivanko

  • *****
  • 388 posts
Re: how to configure the search (or it does not work)?
« Reply #8 on: April 24, 2017, 03:28:04 PM »
@bobyrou

The bug was fixed in latest version of theme.


*

bobyrou

  • ****
  • 107 posts
Re: how to configure the search (or it does not work)?
« Reply #9 on: April 24, 2017, 05:49:16 PM »
thanks, I will apply the update.

*

R3sidento

  • *
  • 3 posts
Re: how to configure the search (or it does not work)?
« Reply #10 on: April 24, 2017, 06:11:50 PM »
If I use the repaired code, the problem will not be solved completely.

On my domain http://suprbazar.cz/search

If I use the filter combination on the left (transaction, condition, price, with foto, Etc.) and a filter at the top (private and company ads) Nothing is found.

How do I fix this problem?

*

MB Themes

Re: how to configure the search (or it does not work)?
« Reply #11 on: April 24, 2017, 06:14:25 PM »
@R3sidento
It usually happen if you have first installed theme with older version. There was database structure change.

Try this:
http://forums.mb-themes.com/veronika-osclass-responsive-theme/i-can't-see-any-listing-after-update/msg5878/#msg5878

Note that for attributes new tables are used and therefore it will erase existing inputs of Transaction, Status, ...
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots