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

Resolve fatal error caused by "Price on Request" with similar estates. #786

Open fredericalpers opened 3 months ago

fredericalpers commented 3 months ago

Resolve fatal error caused by "Price on Request" with similar estates.

Introduction

A bug has been identified in the similar estate feature, specifically affection properties marked with the “price on request” feature. This issue disrupts functionality of the similar estates, causing fatal errors in displaying relevant listings.

User Story

As a real estate agent utilizing the onOffice for WP-Websites plugin, I sometimes use the "Price on Request" feature when managing property listings. However, I encountered a fatal error when enabling this feature for similar estates. The error arises due to an undefined method being called.

This fatal error disrupts the functionality of the plugin and prevents users from effectively managing similar estates with the "Price on Request" feature enabled. To ensure a seamless user experience and maintain the stability of the plugin, I propose addressing this issue promptly.

By addressing this fatal error, we aim to enhance the reliability of the onOffice for WP-Websites plugin, allowing users to effectively utilize the "Price on Request" feature without encountering disruptive errors.

Error Log

Details

```php Fatal error: Uncaught Error: Call to undefined method onOffice\WPlugin\DataView\DataViewSimilarEstates::getListFieldsShowPriceOnRequest() in /www/htdocs/w01dbd85/testinstanz-fal.onofficeweb.com/htdocs/wp-content/plugins/onoffice-for-wp-websites/plugin/EstateList.php on line 518 Call stack: onOffice\WPlugin\EstateList::estateIterator() wp-content/plugins/onoffice-for-wp-websites/templates.dist/estate/similar_estates.php:16 include() wp-content/plugins/onoffice-for-wp-websites/plugin/Template.php:118 onOffice\WPlugin\Template::getIncludeContents() wp-content/plugins/onoffice-for-wp-websites/plugin/Template.php:82 onOffice\WPlugin\Template::render() wp-content/plugins/onoffice-for-wp-websites/plugin/Controller/EstateViewSimilarEstates.php:142 onOffice\W\C\EstateViewSimilarEstates::generateHtmlOutput() wp-content/plugins/onoffice-for-wp-websites/plugin/EstateDetail.php:265 onOffice\WPlugin\EstateDetail::getSimilarEstates() wp-content/plugins/onoffice-for-wp-websites/templates.dist/estate/default_detail.php:364 include() wp-content/plugins/onoffice-for-wp-websites/plugin/Template.php:118 onOffice\WPlugin\Template::getIncludeContents() wp-content/plugins/onoffice-for-wp-websites/plugin/Template.php:82 onOffice\WPlugin\Template::render() wp-content/plugins/onoffice-for-wp-websites/plugin/Controller/ContentFilter/ContentFilterShortCodeEstateDetail.php:91 onOffice\W\C\C\ContentFilterShortCodeEstateDetail::render() wp-content/plugins/onoffice-for-wp-websites/plugin/Controller/ContentFilter/ContentFilterShortCodeEstate.php:92 onOffice\W\C\C\ContentFilterShortCodeEstate::buildReplacementString() wp-content/plugins/onoffice-for-wp-websites/plugin/Controller/ContentFilter/ContentFilterShortCodeEstate.php:69 onOffice\W\C\C\ContentFilterShortCodeEstate::replaceShortCodes() wp-content/plugins/onoffice-for-wp-websites/plugin/Controller/ContentFilter/ContentFilterShortCodeRegistrator.php:59 onOffice\W\C\C\ContentFilterShortCodeRegistrator::onOffice\W\C\C\{closure}() wp-includes/shortcodes.php:433 do_shortcode_tag() preg_replace_callback() wp-includes/shortcodes.php:273 do_shortcode() wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters() wp-includes/plugin.php:205 apply_filters() wp-includes/post-template.php:256 the_content() wp-content/themes/oceanwp/partials/page/article.php:20 require() wp-includes/template.php:792 load_template() wp-includes/template.php:725 locate_template() wp-includes/general-template.php:206 get_template_part() wp-content/themes/oceanwp/partials/page/layout.php:20 require() wp-includes/template.php:792 load_template() wp-includes/template.php:725 locate_template() wp-includes/general-template.php:206 get_template_part() wp-content/themes/oceanwp/page.php:36 include() wp-includes/template-loader.php:106 require_once() wp-blog-header.php:19 require() index.php:17 ```

Requirements / Tasks

yeneastgate commented 3 months ago

@fredericalpers

  • Investigate the root cause of the fatal error triggered by enabling the "Price on Request" feature for similar estates.

When enabling the "Price on request" feature for similar estates will pass condition in this line https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/8eae46882ac2afcb2a9019895625677be2677043/plugin/EstateList.php#L515 So when you view "detail estate" page Which have show "similar estate" view, will run continue to the next line. At this line, $this->_pDataView(which is essentially DataViewSimilarEstates Class) is calling "getListFieldsShowPriceOnRequest" method. But this method has not been declared in this class

  • Develop a fix to resolve the error and ensure proper functionality of the plugin when using the "Price on Request" feature.

I fixed, I added "getListFieldsShowPriceOnRequest" method to "DataViewSimilarEstates" class

  • Conduct thorough testing to verify that the fix resolves the fatal error and does not introduce any regressions.

I checked that the "price on request" feature is only used on 3 screens: estate list, detail estate, and similar estate => We have been added the "getListFieldsShowPriceOnRequest" method for all. This is demo video. Please check and let me know your opinion

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/50fb7ca5-a48a-40bc-892e-9389a40afe0d

fredericalpers commented 3 months ago

@yeneastgate this seems to be working fine now. Thank you :)