onOffice-Web-Org / oo-wp-plugin

onOffice for WP-Websites
https://wp-plugin.onoffice.com
GNU General Public License v3.0
9 stars 9 forks source link

Price on request can be "bypassed" #583

Closed fredericalpers closed 9 months ago

fredericalpers commented 1 year ago

Current state

If you use the filters smartly, you can narrow down the price with the search in such a way that you can guess the approximate price.

E. g.: The purchase price for the property XYZ is 500,000 €. Price on request is set for this specific property. Therefore, the purchase price is not displayed on the website.

If I now use the filtering for purchase price from - to in the property search, it is possible for me to narrow down the price of the property so that it can be identified almost exactly down to the exact price in euros.

If I filter for purchase price from 450,000 € and purchase price to 550,000 €, the property is displayed. If I filter for 490,000 € and 510,000 € the property will still be displayed. So Ican narrow down the purchase price to the exact price in euros.

Desired state

Properties with price on request should always be displayed when filtering for prices. The customers should not be able to filter the price still.

Fieldnames for Price on request fields

- Kaufpreis fieldname = kaufpreis - Erbpacht fieldname = erbpacht - Netto Kaltmiete fieldname = nettokaltmiete - Warmmiete fieldname = warmmiete - Pacht fieldname = pacht - Kaltmiete fieldname = kaltmiete - Pauschalmiete fieldname = miete_pauschal - Saisonmiete pauschal fieldname = saisonmiete - Wochenmietpreis brutto fieldname = wochmietbto - Kaufpreis pro qm fieldname = kaufpreis_pro_qm - Mietpreis pro qm fieldname = mietpreis_pro_qm)

fredericalpers commented 1 year ago

As discussed in our meeting today (2023-07-05) I moved this issues to investigate and resolve into this milestone if possible.

dai-eastgate commented 1 year ago

As discussed in our meeting today (2023-07-05) I moved this issues to investigate and resolve into this milestone if possible.

I will investigate and let you know as soon as possible

yeneastgate commented 1 year ago

@fredericalpers
A. As discussed in our meeting today (2023-07-12) you said that we need to exclude all "price on Request" items from the search results. E. g.: Current: If I filter for 4,000€ and 6,000€ the property which is set "price on request" will still be displayed image Desire: If I filter for 4,000€ and 6,000€ then only the property with real price will be displayed: image

B. But in the requirement you mention aboved, I see that "Properties with price on request should always be displayed when filtering for prices." E. g.: Desire: If I filter for 4,000€ and 6,000€ then the result: price(3)

Please confirm which we will follow (A or B). Thanks!

onOffice-Web commented 1 year ago

@yeneastgate if possible please implement (B). So the properties are displayed, but not filterable as in narrowing down the price.

yeneastgate commented 1 year ago

@fredericalpers Yes, I will continue to investigate and let you know when I have the results.

yeneastgate commented 1 year ago

@fredericalpers We have found a solution that can temporarily solve your requirement as in option B. However, this solution is not optimal for customers with large amounts of data.

Here is my solution:

  1. step 1: Call "read estate API with $filter['preisAufAnfrage']" to get all properties with price on request => get array of Ids(priceOnRequestEstateIDs)

  2. step 2: Call "read estate API with $filter['kaufpreis']": $filter['kaufpreis'] = [ [ 'op' => '>=', 'val' => 490 ], [ 'op' => '<=', 'val' => 510 ], ]; AND $filter['preisAufAnfrage'] = [ [ 'op' => '=', 'val' => 0 ]" to get all properties that are within the search price range but not the price on request(resultSearchPropertyNotIsPriceONRequestIDs)

=> desiredIds = priceOnRequestEstateIDs + resultSearchPropertyNotIsPriceONRequestIDs

  1. step 3: Call "read estate API with $filter['Id']" $filter['Id'] = [ ['op' => 'print', 'val' => desiredIds], ];

Please let me know your opinion about this, thanks!

onOffice-Web commented 1 year ago

@yeneastgate I will postpone this to v4.16 so we can discuss this internally again. This is unfortunately as you mentioned not an optimal solution. Maybe it will have less of an impact after v4.15. Thank you :)

fredericalpers commented 1 year ago

@yeneastgate can you please elaborate for us how the performance will be worse than if the they are shown anyway?

We thought about maybe removing the properties which are marked with "price on request" all the time when using the price filter. Is it possible to test this to see the performance difference?

yeneastgate commented 1 year ago

@yeneastgate can you please elaborate for us how the performance will be worse than if the they are shown anyway?

We thought about maybe removing the properties which are marked with "price on request" all the time when using the price filter. Is it possible to test this to see the performance difference?

We will check and let you know as soon as possible.

dai-eastgate commented 1 year ago

@fredericalpers I have tried to implement the solution and found that:

  1. The google speed score reduces quite a lot Ex: In the case of "estate per page = 300", the performance compared to the master branch is as follows: image
  1. Reason: We are calling 2 more APIs at the same time to get and compare data
    • 1 API calls the estates as "price on request": there are 200 estates
    • 1 API call real estates with real price filtering: there are 100 estates

This makes the solution we have noted above not optimal yet.

dai-eastgate commented 1 year ago

@fredericalpers I tried implementing it on this branch 37740-price-on-request-can-be-bypassed, you can test it again. Thanks!

andernath commented 1 year ago

@dai-eastgate, @yeneastgate You are right. This solution is not performant and I think requests to the API do not belong in the FilterBuilder.

Here's what we agreed on: estates wit "priceOnRequest" should be filtered out if filter with prices is active. (Option A "If I filter for 4,000€ and 6,000€ then only the property with real price will be displayed")

Here is my suggestion, please feel free to add your ideas. DefaultFilterBuilderListView.php 93:

        $priceFields = ['kaufpreis', 'erbpacht', 'nettokaltmiete', 'warmmiete', 'pacht', 'kaltmiete', 'miete_pauschal', 'saisonmiete', 'wochmietbto', 'kaufpreis_pro_qm', 'mietpreis_pro_qm'];
        $filterKeys = array_keys($filter);
        if(count(array_intersect($priceFields, $filterKeys)) > 0) {
            $filter['preisAufAnfrage'][] = ['op' => '!=', 'val' => 1];

        }
dai-eastgate commented 1 year ago

@andernath I will check and let you know asap.

dai-eastgate commented 1 year ago

@fredericalpers @andernath Do you want me to implement this issue in this cycle or during the ramp up, please let us know your plan for this issue. Thanks!

fredericalpers commented 1 year ago

@dai-eastgate Please try to work on this issue in v4.17 and postpone some of the smaller stuff to ramp up, thank you :)

dai-eastgate commented 1 year ago

@fredericalpers What does "the property with real price" mean? Please help me confirm the following issue: If a property has the following characteristics

fredericalpers commented 1 year ago

@dai-eastgate sorry for the confusion. Real price is supposed to mean that all properties that do not have "price on request" activated are supposed to be displayed when filtering for a certain price.

The ones that do have "price on request" activated are not supposed to be displayed when filtering as mentioned here.

dai-eastgate commented 1 year ago

@fredericalpers Thank you for the clarification. I will check and implement it.

dai-eastgate commented 1 year ago

@fredericalpers I implemented option A. Please watch my video demo and let me know your opinion about this. Thanks!

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/106214469/25bb9034-dd63-455b-ab8d-e7f6f699abfe

fredericalpers commented 1 year ago

@yeneastgate if I search without using a price the properties marked as "price on request" will show?

dai-eastgate commented 1 year ago

@yeneastgate if I search without using a price the properties marked as "price on request" will show?

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/106214469/b748fdb1-fe1d-45d5-a4ef-4c0f9fb3013e

@fredericalpers Yes, as you can see in my video. If I search without using a price, the properties marked as “price on request” will show

fredericalpers commented 1 year ago

@dai-eastgate seems to be working as intended then! Thank you :) Let me know if this is ready to be reviewed.

dai-eastgate commented 1 year ago

@dai-eastgate seems to be working as intended then! Thank you :) Let me know if this is ready to be reviewed.

@fredericalpers yes, please help us to review. Thanks!