Advertisement:

Author Topic: (SOLVED) Custom Fields is not searching  (Read 2981 times)

makmortifera

  • Newbie
  • *
  • Posts: 33
(SOLVED) Custom Fields is not searching
« on: July 05, 2017, 04:10:36 pm »
Theme: Osclass Wizards

Hello everyone, I have a problem in the custom fields, when creating a field I activate the "Tick to allow searches by this field" option, but when trying to perform a search it does not select by this field.

Example: I have a field called "Room(Quarto)" and it already comes with the numbers that can be selected.


When you create an ad, you define a number.
Example:


But at the time of searching for "Room(Quarto)", I choose the number 1


it shows me all the ads, even what I set the number "Room(Quarto) = 4"

Any help?

« Last Edit: July 06, 2017, 04:14:53 am by makmortifera »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom Fields is not searching
« Reply #1 on: July 05, 2017, 04:26:27 pm »
Try replacing 9+ with
9 or more

and make sure the indentifier is unique.

If you added this custom field and an add was already posted on your website, it receives the first value of your dropdown.
All the ads in that category must be edited in order for this to work.
« Last Edit: July 05, 2017, 04:28:53 pm by marius-ciclistu »

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: Custom Fields is not searching
« Reply #2 on: July 05, 2017, 06:13:46 pm »
Try replacing 9+ with
9 or more

and make sure the indentifier is unique.

If you added this custom field and an add was already posted on your website, it receives the first value of your dropdown.
All the ads in that category must be edited in order for this to work.

Thx for reply marius, but didn't work...

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: Custom Fields is not searching
« Reply #3 on: July 05, 2017, 06:28:11 pm »
I noticed a detail, when I do a search on "Room(Quarto)", it changes the link to:

http://localhost.com/index.php?page=search&sOrder=dt_pub_date&iOrderType=desc

But, when i try to search for a min price... Ex: 13000, it shows

http://localhost.com/index.php?page=search&sOrder=dt_pub_date&iOrderType=desc&sPriceMax=13000 <- And Work

Maybe, something is missing at the end of link
« Last Edit: July 05, 2017, 06:30:25 pm by makmortifera »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom Fields is not searching
« Reply #4 on: July 05, 2017, 07:28:55 pm »
I don't have this issue with 3.7.1. and bender theme.
And I don't use plugins.

Some of the guis here said that the standard procedure is to swich to bender theme and disable all plugins, then test it. If it works, you can enable the plugins one by one and see if either of them is the cause. And then check the theme you are using if it is not bender.

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: Custom Fields is not searching
« Reply #5 on: July 05, 2017, 10:55:56 pm »
I did a clean install of "osclass.3.7.3" script and DB in my webhost, the script I downloaded directly from the site and made the install step by step from installation page.

And it still did not work

I tested inside the panel that the osclass itself offers, and it works normally, you can see at the link below
https://imoveisteste.osclass.org/houses-apartments-for-sale

The version that they use is 3.6.1, that is a joke...

They are releasing the script with problem, i think... i will try to found the script 3.6.1 or 3.7.1 to test
« Last Edit: July 05, 2017, 10:58:49 pm by makmortifera »

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: Custom Fields is not searching
« Reply #6 on: July 05, 2017, 11:10:53 pm »
Very strange, I did another clean installation of version 3.7.1 and it also does not work.
Can you zip and make it available for download?

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: Custom Fields is not searching
« Reply #7 on: July 05, 2017, 11:38:59 pm »
I don't have this issue with 3.7.1. and bender theme.
And I don't use plugins.

Some of the guis here said that the standard procedure is to swich to bender theme and disable all plugins, then test it. If it works, you can enable the plugins one by one and see if either of them is the cause. And then check the theme you are using if it is not bender.

I do not know how, but I found the problem... I do not know how in your version 3.7.1 works, because I tested it here and it did not work, version 3.6.1 works correctly.

I will post the problem soon

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom Fields is not searching
« Reply #8 on: July 05, 2017, 11:48:01 pm »
Well it works.... I just tried it just to be shure.

EDIT.
I use identifier the same as the name, in your example quartos

EDIT2
And my options are not made from 1 character.
These are the differences.

EDIT 3.
I just remembered I have a custom field like yours 1,2,3,4,5.....
it works for 1 as I have only ads with 1  as the field's value.

Edit 4
I just modified one of the ads with value 6 and tried the filter. It filters ok.
« Last Edit: July 06, 2017, 12:10:07 am by marius-ciclistu »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: Custom Fields is not searching
« Reply #9 on: July 06, 2017, 12:20:18 am »
Regarding the zip file:
Osclass 3.7.1 has 6.4 mb and the limit is 2 mb here.
I could send it to you via email.

EDIT:
Teseo said something about allow_url_fopen here:

https://forums.osclass.org/espanol-8/no-aparece-el-website-de-mi-usuarios/msg152163/#msg152163

Just to be sure, is your's open?
« Last Edit: July 06, 2017, 01:03:00 am by marius-ciclistu »

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: Custom Fields is not searching
« Reply #10 on: July 06, 2017, 04:14:08 am »

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: (SOLVED) Custom Fields is not searching
« Reply #11 on: July 06, 2017, 04:24:39 am »
As I said, the file that is coming from the download is either a problem or does not work specifically on my server.

This error was occurring when I searched with a custom field:

Code: [Select]
[Wed Jul 05 20:07:03 2017] [error] [client 177.143.236.173] PHP Warning:  urldecode() expects parameter 1 to be string, array given in /home/folder/oscalss.domain.com/oc-includes/osclass/classes/Rewrite.php on line 192, referer: http://oscalss.domain.com/index.php?page=search&sOrder=dt_pub_date&iOrderType=desc&sCategory=96
The problem is in the: /oc-includes/osclass/classes/Rewrite.php from version 3.7.3

When i change the code from version 3.7.3:
Code: [Select]
public function extractParams($uri = '')
        {
            $uri_array = explode('?', $uri);
            $length_i = count($uri_array);
            for($var_i = 1;$var_i<$length_i;$var_i++) {
                parse_str($uri_array[$var_i], $parsedVars);
                foreach($parsedVars as $k => $v) {
                    Params::setParam($k, urldecode($v));
                }
            }
        }

To code from 3.6.1:
Code: [Select]
public function extractParams($uri = '')
        {
            $uri_array = explode('?', $uri);
            $length_i = count($uri_array);
            for($var_i = 1;$var_i<$length_i;$var_i++) {
                if(preg_match_all('|&([^=]+)=([^&]*)|', '&'.$uri_array[$var_i].'&', $matches)) {
                    $length = count($matches[1]);
                    for($var_k = 0;$var_k<$length;$var_k++) {
                        Params::setParam($matches[1][$var_k], $matches[2][$var_k]);
                    }
                }
            }
        }

Now everything works normally.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: (SOLVED) Custom Fields is not searching
« Reply #12 on: July 06, 2017, 09:53:53 am »
I was just saying about that fopen thing...

Regarding the filter..... I made some modifications to the functions.php file with the help of Teseo for improving the search results and other things. Maybe those hooks are the difference in 3.7.1 that makes my website work ok in the filter's regard.

I don't know more.... maybe someone with more experience than me could figure out the problem.

(I checked the code you wrote. In 3.7.1 is the same as the one you wrote for 3.7.3)
« Last Edit: July 06, 2017, 10:02:22 am by marius-ciclistu »

makmortifera

  • Newbie
  • *
  • Posts: 33
Re: (SOLVED) Custom Fields is not searching
« Reply #13 on: July 06, 2017, 03:35:28 pm »
Regarding the filter..... I made some modifications to the functions.php file with the help of Teseo for improving the search results and other things. Maybe those hooks are the difference in 3.7.1 that makes my website work ok in the filter's regard.

I don't know more.... maybe someone with more experience than me could figure out the problem.

(I checked the code you wrote. In 3.7.1 is the same as the one you wrote for 3.7.3)

I do not know what that can be, I just know that by changing this code I posted, it worked normally.


I was just saying about that fopen thing...

Now I understand, I'm going to test this fopen later.... Thx

yassimus

  • Newbie
  • *
  • Posts: 1
Re: (SOLVED) Custom Fields is not searching
« Reply #14 on: March 08, 2018, 02:47:18 am »
Hello everybody,

The change made solves the problem but creates another. when you search with spaces or special characters, the url is badly coded and the search does not work. The code must be corrected as follows (see last line ):

public function extractParams($uri = '')
        {
            $uri_array = explode('?', $uri);
            $length_i = count($uri_array);
            for($var_i = 1;$var_i<$length_i;$var_i++) {
                if(preg_match_all('|&([^=]+)=([^&]*)|', '&'.$uri_array[$var_i].'&', $matches)) {
                    $length = count($matches[1]);
                    for($var_k = 0;$var_k<$length;$var_k++) {
                        Params::setParam($matches[1][$var_k], urldecode($matches[2][$var_k]));
                    }
                }
            }
        }