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

When no estate is published, refer to documentation #416

Closed jmaas-onoffice closed 1 year ago

jmaas-onoffice commented 1 year ago

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

Originally posted by **jmaas-onoffice** January 6, 2023 > Time-tracking ticket: T#3442759 ## Empty array leads to problems Currently, when no estate is published for the website, the detail view shortcode can produce a warning [due to an array being empty](https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/master/plugin/Controller/ContentFilter/ContentFilterShortCodeEstateDetail.php#L141): ``` Fatal error: Uncaught ValueError: array_rand(): Argument #1 ($array) cannot be empty in /usr/www/users/raumgu/raumgut_com/wp-content/plugins/onoffice-for-wp-websites/plugin/Controller/ContentFilter/ContentFilterShortCodeEstateDetail.php:141 ``` When using Elementor, this leads to a crash that makes it impossible to edit the detail page. ## Show link to documentation instead Currently, when there are estates available and the user visits the detail page without an estate ID (for example /detail), then we show this message: ![image](https://user-images.githubusercontent.com/90763364/210955487-0d94912b-8c8c-4018-b260-ab4ddac17b21.png) When the user has no estates published for the website, we want to instead show the following message with a link to https://wp-plugin.onoffice.com/en/first-steps/estate-lists/. (The link should be translatable, of course.) ![image](https://user-images.githubusercontent.com/90763364/210955457-761aba28-8fd4-46db-b9d6-bb25a3c27c73.png)
dai-eastgate commented 1 year ago

@jmaas-onoffice "The plugin could find any estates. Please make sure that you have published some estates, as described in the estate list documentation" => I think it must be "The plugin couldn't find any estates?", right?

jmaas-onoffice commented 1 year ago

Yes, you're correct! Thanks for catching that! :)

dai-eastgate commented 1 year ago

@jmaas-onoffice I fixed the message for the case no estate is published, you can watch and give me feedback.

https://user-images.githubusercontent.com/106214469/212234026-02f02854-8692-42c8-a79d-c10f8c20a11f.mp4

jmaas-onoffice commented 1 year ago

Looks great, thank you! :)