Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue with the Houzez theme where the property counter on the search results page is not working correctly. The counter is including properties from all languages, not just the current language, leading to incorrect counts displayed in the autocomplete search results.

Solution:
We have identified a problem in the Houzez theme code and are providing a hotfix. We also recommend contacting the theme author to ensure the fix is included in the next theme update. Here are the steps to apply the hotfix:

1. Open the file

wp-content/themes/houzez/framework/functions/property_functions.php

.

2. Before the line

foreach ( $data as $post ) {

, add the following line:

$new_data = array();

3. After the code snippet:

if ($post_language !== $current_language) continue;

Add the following line:

$new_data[] = $post;

4. In the line that outputs the count:

echo '<span class="auto-complete-count"><i class="houzez-icon icon-pin mr-1"></i> ' . sizeof( $data ) . ' '.$houzez_local['listins_found'].'</span>';

Replace

$data

with

$new_data

so it becomes:

echo '<span class="auto-complete-count"><i class="houzez-icon icon-pin mr-1"></i> ' . sizeof( $new_data ) . ' '.$houzez_local['listins_found'].'</span>';

If this solution does not seem relevant to your issue, please open a new support ticket with us.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 17 replies, has 2 voices.

Last updated by Dražen 4 years, 4 months ago.

Assisted by: Dražen.

Author Posts
April 29, 2021 at 11:31 am #8653229

waldemarK

Hi, I have the same problem with houzez like here: https://wpml.org/forums/topic/split-houzez-search-results-page-shows-all-properties/

but the solution does not work for me

April 29, 2021 at 9:01 pm #8657725

waldemarK

Ok Bot, please let's hear tomorrow.

May 3, 2021 at 8:51 am #8673701

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I will be taking over the ticket and helping you out with the issue.

In order to check if this and general bug with the theme, I created a minimal installation of WordPress, WPML, and all necessary WPML add-ons.

You can access the WordPress dashboard using the link below:
- hidden link

Kindly follow the steps below:
- Install Houzez theme
- Create 2 simple dummy properties and translate it
- Try to replicate and check if the issue happens
- Share with me step by step guide on how can I check the issue

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

Please let me know how it goes.

Thanks,
Drazen

May 3, 2021 at 8:54 am #8673715

waldemarK

Hi, I can give you access here, its the old beta site with all plugins disabled, we would be quicker and have all properties inside

hidden link

May 3, 2021 at 9:03 am #8673871

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

Yes, but even so, to proceed we need to check if the issue is a bug. I can not escalate the case as a bug if it doesn't happen on a clean website, but only on yours. The procedure is then different.

If yes, and we reproduce, it will be quickly escalated to our developers for a fix. I suppose you would more easily replicate it than me, since you are familiar with the process, and it will speed up the escalation.

Otherwise, we would need to do the debug your website and follow a different procedure, for a client site-specific case. Testing on the clean sandbox would help speed up the process and confirm what type of issue is this.

Can you please check and follow my suggestion from the previous reply?

If not, please provide admin and FTP access for your test site in the next private reply, and I will check it out further.

Thanks,
Drazen

May 3, 2021 at 11:56 am #8675823

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

I have checked your website, and couldn't find a solution. I actually think this is a bug with the Houzez theme, so I have tried to replicate the issue, but am afraid I can not set up the same search form/result as on your website.

I can not get the same total count to show up after autocomplete search.

Can you please share instructions on how to set up the same search form so I can see I confirm if the same issue happens there?

Example page:
- hidden link

Thanks,
Drazen

May 3, 2021 at 12:18 pm #8676063

waldemarK

Hi,

Houzez told me that the theme works fine and that „Then you need to ask WPML support, this is only settings WPML told us* and some other clients and it is working for other clients “

* In WPML there is a setting "Languages – set Store language cookie to support filtering for AJAX" which you need to turned on then it will work.
https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/​

May 3, 2021 at 12:25 pm #8676187

waldemarK

The problem with the filter is that it is looking up both titles and properties, the one of the original language AND the one of the 'other' language.

Example A - 2 properties all with city Legnano in title

when I am searching keyword in it or de I see the image of only 2, but the counter shows 4

it
1. Capannone in vendita a Legnano
2. Negozio in vendita a Legnano

de
1. Lagerhalle zu verkaufen in Legnano
2. Geschäft zu verkaufen in Legnano

Example B – 8 properties that have the word 'zwei' in german title

open italian page (!)
keyword 'key'
no listings with image
but counter shows 8
clicking on 'show all results' > no results

May 3, 2021 at 1:26 pm #8676885

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

I understand your issue and I already tried the suggested fix.

In order to proceed forward can you please follow my last reply and visit the sandbox site and help us out with reproducing the issue there?

It is already all set up, you just need to share with us steps on how can we enable counter in search form results.

Thanks,
Drazen

May 6, 2021 at 11:32 am #8703633

waldemarK

Ok, today I will try to upload all in your sandbox

May 6, 2021 at 12:45 pm #8704659

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

you do not need to upload anything, everything is set up already.

All you need is to go to the sandbox site and enable/create the same search form as you use on your website (total count to show up after autocomplete search) or share steps with us on how can we set up the same search.

I tried to do it on the next link, but as you can see it doesn't have to autocomplete option.

- hidden link

Please let me know.

Thanks,
Drazen

May 7, 2021 at 7:49 am #8711067

waldemarK

Hi Drazen, it took me some time to insert content in the Sandbox because your server is extremely slow, some pages could bot be loaded.

I inserted 2 bilingual properties with the word 'Verona'. Half Map page is also bilingual, so you can switch languages and see the different property title. hidden link

I was able to replicate the same bug

case 1
If you insert 'Verona' in the keywords field, the autofill shows you 2 properties, but counts 4.

case 2
Same if you switch to italian half map page and insert an english keyword like 'industrial'. Autocomplete shows NO image/property, but the counter counts 1.

case 3
If you switch to english half map page and insert an itlian keyword like 'negozio'. Autocomplete shows NO image/property, but the counter counts 1.

Means that also in your sandbox the keyword search works for the autocomplete, but not for the counter. Because counter includes all languages, and is counting also non relevant properties.

Houzez Theme settings allow to modify where keywords should be searched, in my case the keyword search is set to 'property title and content' which is a very useful setting and my client loves that.

May 7, 2021 at 9:34 am #8712155

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back and taking the time to replicate the issue.

I was also able to reproduce the issue by copying your settings.

This issue is now escalated to our compatibility team and they will be checking it further.

I will update you as soon as I have some news.

Thanks,
Drazen

May 7, 2021 at 2:18 pm #8714937

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

there seems to be an issue in the Houzez theme code. We will be providing a fix, and updating the theme author, but please contact them also and make sure they include the fix in the next version of the theme.

Hotfix steps:

In

wp-content/themes/houzez/framework/functions/property_functions.php

,

1- Before

foreach ( $data as $post ) {

add

$new_data = array();

2- After

if ($post_language !== $current_language)
                            continue;

add

$new_data [] = $post;

3- In this line

echo '<span class="auto-complete-count"><i class="houzez-icon icon-pin mr-1"></i> ' . sizeof( $data ) . ' '.$houzez_local['listins_found'].'</span>';

replace

$data with $new_data

so it becomes

echo '<span class="auto-complete-count"><i class="houzez-icon icon-pin mr-1"></i> ' . sizeof( $new_data ) . ' '.$houzez_local['listins_found'].'</span>';

Image attached.

Kind regards,
Drazen

ver.png
May 7, 2021 at 2:29 pm #8715021

waldemarK

Hi Drazen,

I was sure that it was the themes fault. You shoud reconsider about declaring Houzez 100% WPML compatible, this is not my first issue and your support is full of other cases. It's not correct for new customers if they get a wrong promise.

So thank you again for the help and wpml support. I will try to insert this manually, but I hope to see soon a theme update so this is done automatically.

Waldemar