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

Order properties by tags #550

Closed onOffice-Web closed 1 month ago

onOffice-Web commented 1 year ago

Discussed in https://github.com/onOffice-Web-Org/oo-wp-plugin/discussions/486

Originally posted by **fredericalpers** April 4, 2023 ### User story As an estate agent, I would like to show the top/new properties first in the property list, then the others, so that the results marked as top/new are seen more often. Example: https://www.firstkitzbuehel.com/de/portfolio _(see attachement "vorrang-top.png")_. ### Current state Within a property list, it is not possible to give priorities to marked properties (e.g. "Top properties" or "New") or to place them at the end (e.g. "References", "Sold", ...). It is also not possible to create two lists, one for e.g. "Top-Immos" and then one for the normal ones, as these are also recognisable to the user as two separate lists, which some clients do not want. In addition, pagination would not work with two lists on one page. ### Desired state **Backend:** In the settings of a property list, an additional option is to be inserted in the box "Sorting" in the select field "Sorting", with the label "Marked properties" _(see backend_markierte-immobilien.jpg)_. When selecting this option, a sorting option with the label "Order" is to be displayed below it _(see backend_markiert-sortierung-ausgewaehlt.jpg)_. This sorting option has the following default order: "New", "Top offer", "No selection", "Sold", "Rented", "Reserved", "Reference". The user can adjust the arrangement via drag-and-drop and thus influence the order of the properties in the frontend. The selection fields "Sort criteria" and "Sort direction" are to be displayed beneath "Order" as in the standard sorting. Rename the label of the selection field "Sort criteria" (Sortierkriterium) to "Sort criteria within same selection" (Sortierkriterium innerhalb gleicher Markierung). The sort criteria sorts the properties within the selected order. **Example:** Sequence: "New", "Top offer", "No marker", "Sold", "Rented", "Reserved", "Reference". Sorting criteria: "Number of rooms", Sorting direction: "Ascending Property 1 with "New" and "1 room Property 2 with "New" and "4 rooms Property 3 with "Top offer" and "2 rooms Property 4 with "Top offer" and "3 rooms Property 5 with "Sold" and "1 room **Frontend:** Based on the selected order in the backend, the properties are displayed the following by default: "New", "Top offer", "No selection", "Sold", "Rented", "Reserved", "Reference" _(see frontend_markiert-immobilien.jpg)_. No dropdown for user sorting. Even if the user performs a search, the results are grouped by selection and listed in the set order. Using the default order while searching for houses the "New" houses are displayed first, then the "top offer" houses and so on. _(see 1b default order and frontend_markiert-immobilien.jpg)_ **Miscellaneous** Marking fields Origin (enterprise) "New" -> The value from "Marketing > Own website > New" is queried here. "Top offer" -> The value from "Marketing > Own website > Top offer" is queried here. "Sold" -> Here the value from "Marketing > Marketing status > Sold" is queried "Rented" -> The value from "Marketing > Marketing status > Rented" is queried here. "Reserved" -> The value from "Marketing > Marketing Status > Reserved" is queried here. "Reference" -> Here the value from "Marketing > Own Website > Reference" is queried "No marker" -> If none of the other marker fields apply. What if a propertie has more than one marker? If a property has several markers, only one will be displayed at a time. The one that is highest in the set order is selected. **Examples:** Selected order: "New", "Top offer", "Sold", "Rented", "Reserved", "Reference". Property 1 has the values "New" and "Reference", then the property is considered "New". Property 2 has the values "Rented" and "Reference", then the property is considered to be "Rented Property 3 has the values "Top Offer" and "New", then the property is considered "New". Selected arrangement: "Top offer", "Reference", "Reserved", "Sold", "Rented", "New". Property 1 has the values "New" and "Reference", then the property is considered as "Reference Property 2 has the values "Rented" and "Reference", then the property is considered a "Reference". Property 3 has the values "Top offer" and "New", then the property is considered a "Top offer". ![vorrang-top](https://user-images.githubusercontent.com/88546396/229801848-21c5e734-a08b-446b-b009-87c1bbd1125a.png) ![frontend_markierte-immobilien](https://user-images.githubusercontent.com/88546396/229803173-0b7dcb70-b42c-4ce0-bcd3-941098b0c087.jpg) ![backend_markierte-immobilien](https://user-images.githubusercontent.com/88546396/229803379-c70f8f8a-9562-4bfd-b0d0-67f65f9610a3.jpg) ![backend_markierte-sortierung-ausgewaehlt](https://user-images.githubusercontent.com/88546396/229803420-2b58cc45-9794-4a14-a112-cfd3b907a19a.jpg)
yeneastgate commented 1 year ago

@fredericalpers These are the solutions, Please confirm for us:

  1. Backend
  1. In Frontend
    • The user performs a search, and the results are grouped by selection and listed in the set order. About the combination sort and search by page, the pagination is from the enterprise but sorting is on the plugin side.

I. Case 1: All properties have only a tag => The order of the properties in the frontend the same as the order of tags in the backend. ex: Property 1 (123456783) has the value "New" Property 2 (162323) has the value "No selection" Property 3 (117289) has the value "Rented" Property 4 (123456784) has the value "Top Offer"

The order of tags in the backend: "New", "Top offer", "No selection", "Sold", and "Rented". => The order of the properties in the frontend: Property 1, Property 4, Property 2, Property 3 https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/d4de8845-993d-4c42-a428-aee10e7922b2

II.Case 2: A property has more than one marker. Property 1 (123456783): has the values "New" and "Reference", then the property is considered "New". Property 2 (162323): None of the other marker fields apply. Property 3 (117289): has the values "Rented" and "Reference", then the property is considered to be "Rented". Property 4 (123456784): has the values "Top Offer" and "Sold", then the property is considered "Top Offer".

=> Find the "considered" tag to return to the same problem as case 1. Property 1 is considered "New". Property 2 is considered to be "No selection" Property 3 is considered a "Rented". Property 4 is considered a "Top Offer". => Algorithm "Sort by" same as case 1 The order of tags in the backend: "New", "Top offer", "No selection", "Sold", and "Rented". => The order of the properties in the frontend: Property 1, Property 4, Property 2, Property 3 https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/85c29be9-cc68-41fd-af40-3d063e9ee418

III. I have a few questions:

fredericalpers commented 1 year ago

Backend

I would use https://jqueryui.com/sortable/ => The user can adjust the arrangement via drag-and-drop

👍

Default order: "New", "Top offer", "No selection", "Sold", "Rented", "Reserved", "Reference".

👍

Rename the label of the selection field "Sort by" to "Sort criteria within same selection".

⚠Please do not rename or change the functionality of the current "sort by". The changes are an addition as seen in Screenshot (3) and (4). The select "sorting" should have a new item named "Marked Properties". If "Marked properties" is selected, the fields below will appear.

Frontend

I. Case 1: All properties have only a tag II.Case 2: A property has more than one marker.

The order of the properties in the frontend is correct.

Please specify what we will use the label "No marker" or "No selection"?

In frontend there obviously shouldn't be a label on the property cards. For the backend please use "No marker" as seen in screenshot (4). Pleas do not change anything in the template when this is added otherwise it is no longer backwards compatible.

Different label for "hereditary lease" and "lease" in onOffice enterprise and plugin?

The plugin should display the same as onOffice enterprise.

"No marker" -> If none of the other marker fields apply.=> What does it mean?

"No marker" are the properties which do not have a specific "Marketing status" set in onOffice enterprise. Which means none of them are labeled as "top offer" or "new" etc.

As I can see in the Enterprise data, there are other tags not in the list "New", "Top offer", "No selection", "Sold", "Rented", "Reserved", "Reference", in such cases, how do we sort the items ?

As mentioned above the changes should not be made to the current "sort by" instead added as a new selection.

Regarding the question in our meeting, when there is more than one page, the sorting should be as followed:

E.g. 20 properties - 5 per page. 8 are marked as top offer. which should make them appear first. In this case page 1 would only display top offers, page 2 would display 3 top offers followed by the next selected sorting criteria property. Sorting as seen in screenshot (4)

@yeneastgate If you have any further questions, let me know :)

yeneastgate commented 1 year ago

@fredericalpers

As mentioned above the changes should not be made to the current "sort by" instead added as a new selection.

I tried to implement adding a new selection.

E.g. 20 properties - 5 per page. 8 are marked as top offer. which should make them appear first. In this case page 1 would only display top offers, page 2 would display 3 top offers followed by the next selected sorting criteria property. Sorting as seen in screenshot (4)

To meet this Desired state: The result API must return a list which the properties are grouped by tags. I found that API doc has "sortby" parameters, support return the properties are grouped by those tags (New,Top offer, Reserved, Reference) In source code, we add this lines: 'sortby' => ["top_angebot" => "DESC", "neu" => "DESC", "referenz" => "DESC", "reserviert" => "DESC"]

E.g. 20 properties, the API results will return a list which the properties are grouped by tags (8 top offers => 4 new => 3 referenz => 5 reserviert) You can see video demo.

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/6304f661-b34a-4b4d-8a69-2b7f3b2a3186

However, currently the "sortby" parameters do not support those tags(Sold, Rented,No marker). So, the only solutions I can suggest is that: Please update "read estate" API for "sortby" parameters so that it can support those tags (Sold, Rented,No marker). Please check with your IT department and let us know your opinion about this matter. Thanks!

fredericalpers commented 1 year ago

@yeneastgate I will check it and get back to you asap

fredericalpers commented 1 year ago

@yeneastgate The fields can be obtained the following:

onOffice API Testing Tool

https://tools.onofficeweb.com/api-client/

If you have any further questions, please let me know.

yeneastgate commented 1 year ago

The fields can be obtained the following:

  • Properties that are rented or sold are obtained with "sold=1"
  • Properties that are only rented out also need marketing type="miete".
  • Properties that are only sold also need marketing type="kauf".

onOffice API Testing Tool If you have any further questions, please let me know.

Yes, I wil try it to continue to solve issue, thank you very much!

yeneastgate commented 1 year ago
  • Properties that are rented or sold are obtained with "sold=1"
  • Properties that are only rented out also need marketing type="miete".
  • Properties that are only sold also need marketing type="kauf".

@fredericalpers Based on your suggestion, I used "verkauft" => "DESC" for "sortby" parameters.

EX: 'sortby' => ["verkauft" => "DESC", "top_angebot" => "DESC", "referenz" => "DESC"]

This is the result page 1: sold+rented Page 2 page2

As shown in the two images above, the estate will automatically be sorted in the following order: Rented => Sold => Top Offer.

yeneastgate commented 1 year ago

@fredericalpers

EX: 'sortby' => ["verkauft" => "ASC", "vermarktungsart" => "ASC" , "top_angebot" => "DESC"]

sold_rented_01

rented_sold_02

However, "vermarktungsart" also has other values such as "erbpacht", .. other

=> Therefore, despite adding "vermarktungsart" => "DESC" or "vermarktungsart" => "ASC", the sorting result is still unexpected.

Please check the API results above with different "vermarktungsart" types and let me know your opinions.

fredericalpers commented 1 year ago

@yeneastgate Please go ahead and implement it as suggested by you. The other "vermarktungsart" as "erbpacht" or "pacht" can be ignored for now.

yeneastgate commented 1 year ago

@fredericalpers We have tried the solution Which we have suggested before. This is the result:

  1. The only case that works as we expect: We only can adjust the arrangement via drag-and-drop 4 tags(New, Top Offer, Reference, Reserved), the remaining 3 tags must be fixed at the bottom position with the following order: Sold > Rented > No marker.

example: Case 1: New, Top offer, Reference, Reserved, Sold, Rented, No marker.

Case 2: You can reverse the position of Top offer before New but still have to fix the position of the remaining 3 tags: Top Offer, New, Reference, Reserved, Sold, Rented, No marker

Please watch my video demo: https://files.fm/u/6htd2qyvb

  1. In the remaining cases (if sold and rented are arranged alternating with other tags), the API results are returned in a mixed order, which is not as expected. Please check with the IT department with the above results to give comments and the following plans for this issue. This is the branch I have implemented, you can test it: https://github.com/onOffice-Web-Org/oo-wp-plugin/tree/32991-order-properties-by-tags Note: I have not yet implemented two features - "Sort criteria within same selection" and "Sort direction". This is because we need to agree on the important part mentioned above before proceeding. If my suggestion meets your approval, I can then proceed with implementing these two features.
fredericalpers commented 8 months ago

@yeneastgate just to clarify one more time.. it is possible to create a fixed order, that can be selected in a dropdown instead of making them all changable as shown in https://files.fm/u/6htd2qyvb#/view/dkq8evgbc ?

e.g. we add the following fixed orders to a dropdown:

Fixed order 1:

"top_angebot" => "Top offer" "neu" => "New" "no_marker" => "No marker" (normal properties with no specific status) "reserviert" => "Reserved" "kauf" => "Sold" "miete" => "Rented" "referenz" => "Reference''

Fixed order 2:

"top_angebot" => "Top offer" "neu" => "New" "no_marker" => "No marker" (normal properties with no specific status) "reserviert" => "Reserved" "referenz" => "Reference'' "kauf" => "Sold" "miete" => "Rented"

fredericalpers commented 7 months ago

@yeneastgate after finishing up v4.21, please investigate this before starting with v4.22. Thank you :)

yeneastgate commented 7 months ago

after finishing up v4.21, please investigate this before starting with v4.22. Thank you :)

I got it.

yeneastgate commented 7 months ago

@fredericalpers I have a solution for this issue. Please watch the demo video

https://files.fm/u/hbe65ynaun

Do you confirm this feature worked as Desired state? => If you agree with this solution, I will continue to implement and finish it.

fredericalpers commented 5 months ago

@fredericalpers I have a solution for this issue. Please watch the demo video

https://files.fm/u/hbe65ynaun

Do you confirm this feature worked as Desired state? => If you agree with this solution, I will continue to implement and finish it.

Unfortunately the video is not available anymore. I was thinking about something like in the screenshot below.

ol

yeneastgate commented 5 months ago

Unfortunately the video is not available anymore.

@fredericalpers You can review the demo video. https://files.fm/u/3etd843vqz#/view/b2gagw9at9

I was thinking about something like in the screenshot below.

If you want, We will implement it as shown above.

fredericalpers commented 2 months ago

@yeneastgate Could you please provide a summary of the problem? Additionally, I'd appreciate it if you could explain why the original request or solution is not possible. This information will help me understand the context better and allow me to rework on it more effectively.

Looking forward to your response.

yeneastgate commented 2 months ago

@fredericalpers I will check and response asap

yeneastgate commented 2 months ago

@fredericalpers I found that:

However, with the current solution, it can only be done with number of properties less than 500, because in the current solution, we need to call the Read Estate API to get all the data Please check the video evidence below: https://files.fm/f/hjnr4ttyrt

fredericalpers commented 2 months ago

@yeneastgate thank you for the summary on this one more time. We will review this as soon as possible :)