Advertisement:

Author Topic: [SOLVED] Insert word "in" before location  (Read 1190 times)

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
[SOLVED] Insert word "in" before location
« on: June 11, 2015, 07:31:30 pm »
When we search in a category + a location, we see the result as Category Location instead of Category in Location. How can i add a "in" before location? I do not find the file from where to fix this.
« Last Edit: July 02, 2015, 10:02:26 pm by Adyyda »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Insert word "in" before location
« Reply #1 on: June 11, 2015, 08:51:40 pm »
***CORRECTED***

Hi,

Locate this in your theme search.php:

Code: [Select]
<?php echo search_title(); ?>


Replace with:

Code: [Select]
<?php $search_region osc_search_region();
                
$search_city osc_search_city();
                
                if (
$search_region || $search_city) {
                    
$pattern '~\W+('.($search_region $search_region $search_city).')~';
                    echo 
preg_replace($pattern' in $1'search_title()); 
                } else echo 
search_title(); ?>


Regards
« Last Edit: July 02, 2015, 05:50:10 pm by teseo »

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2519
Re: Insert word "in" before location
« Reply #2 on: June 11, 2015, 09:11:16 pm »
This is a very nice tip and solution, thanks guys!

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: SOLVED by Teseo - Insert word "in" before location
« Reply #3 on: June 12, 2015, 11:09:51 am »
Fix confirmed. Thanks Teseo

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: Insert word "in" before location
« Reply #4 on: July 02, 2015, 05:06:25 pm »
Hi,

Locate this in your theme search.php:

Code: [Select]
<?php echo search_title(); ?>


Replace with:

Code: [Select]
<?php $pattern '~\W+('.(osc_search_region() ? osc_search_region() : osc_search_city()).')~';
                echo 
preg_replace($pattern' in $1'search_title()); ?>


Regards

Hello Teseo. The fix works for the keyword + category + location search but it breaks the normal search

If i click on a main category (in home page) i get what you see in images (with a simple category name - Electronice or a complex category - Modă, frumusețe, sănătate).
Can we adjust it so that it works properly? Thanks

Category is

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: Insert word "in" before location
« Reply #5 on: July 02, 2015, 05:51:02 pm »
Hi,

I see. Use my corrected code in the post above.

Regards

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: Insert word "in" before location
« Reply #6 on: July 02, 2015, 08:40:21 pm »
Ok now

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: FIXED - Insert word "in" before location
« Reply #7 on: July 02, 2015, 09:03:21 pm »
You're welcome. Please add [SOLVED] to the title of this thread.

Regards

Adyyda

  • Sr. Member
  • ****
  • Posts: 435
Re: [SOLVED] Insert word "in" before location
« Reply #8 on: July 02, 2015, 10:02:37 pm »
Done