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

Detail Page > Needed Filter Hook or Option to stopping redirection #558

Closed BenjaminZekavica closed 9 months ago

BenjaminZekavica commented 1 year ago

I need one filter hook to stop redirection like this:

I use this Link: http://example.de/detail/213 onOffice Plugin Redirect to: http://example.de/detail/213-3-zimmer-wohnung-in-kitzbuehel

One example that I created into the plugin.php Code Link : https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/master/plugin.php#L243

Todo: Need functional filter hook for custom themes - I added into the plugin but it dosn't work. Please check it Reason for the change: For the API "Timum" we add parameters to detail page and validate it, but we need a option to skip this redirection.

<?php 
$pEstateRedirection = apply_filters('oo_is_detailpage_redirection', true );

if( $pEstateRedirection ) {
    // Wrapping Code here: 
        https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/master/plugin.php#L243 
}

?>
fredericalpers commented 1 year ago

@dai-eastgate @yeneastgate If possible please investigate as soon as possible for feedback. Otherwise we will have to postpone it to the new cycle/milestone.

dai-eastgate commented 1 year ago

Hi, @BenjaminZekavica @fredericalpers We already have the checkbox "Show title in URL" in the plugin's settings. If you want that URL not to include the title, you need to disable that checkbox. Please take a look at my tutorial video. Thanks!

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/106214469/78820eac-2f37-420c-9aa7-2e53e7f2e209

BenjaminZekavica commented 1 year ago

@dai-eastgate Yes, I know about this option. But our customer wants to have a same url with a title, but without redirection. We need to have an option like a filter hook, that we could set and prevent the redirection.

fredericalpers commented 1 year ago

@dai-eastgate sorry for the late reply. If this does not fit into the next cycle its no problem at all. I will talk to Linh and Yen on wednesday.

fredericalpers commented 1 year ago

@dai-eastgate for clarification:

the current URL structure with "speaking-URLs" looks like the following: test.com/detail/221-3-room-apartment-in-berlin onOffice enterprise can not read the speaking-URL "-3-room-apartment-in-berlin" and will only identify the apartment by its ID "221"

Scenario example: After sending an inquiry for an apartment, the automatic response e-mail will include the URL + the necessary timum parameters for booking an appointment: e.g. test.com/detail/221/?parameters

We need to stop the redirection from "test.com/detail/221/?parameters" to "test.com/detail/221-3-room-apartment-in-berlin/?parameters" after opening the link from the e-mail. Maybe we can implement a check if the parameters are included in the URL and then skip the redirection?

yeneastgate commented 11 months ago

@fredericalpers I have found a solution to stop the redirect from "test.com/detail/221/?parameters" to "test.com/detail/221-3-room-apartment-in-berlin/?parameters". It will take me 3 days to implement and test. Thanks!

yeneastgate commented 11 months ago
<?php 
$pEstateRedirection = apply_filters('oo_is_detailpage_redirection', true );

if( $pEstateRedirection ) {
  // Wrapping Code here: 
        https://github.com/onOffice-Web-Org/oo-wp-plugin/blob/master/plugin.php#L243 
}

?>

@fredericalpers I added the filter hook as above.

yeneastgate commented 11 months ago

@fredericalpers Case 1: if I set the "oo_is_detailpage_redirection" filter to true in the source code, then all URLs will always redirect to url+title.

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/10b991ab-81a4-408b-be26-0bbfdac84df3

yeneastgate commented 11 months ago

@fredericalpers Case 2: " We need to stop the redirection from "test.com/detail/221/?parameters" to "test.com/detail/221-3-room-apartment-in-berlin/?parameters" after opening the link from the e-mail. " => To do this you just need to set the "oo_is_detailpage_redirection" filter to false in the source code

https://github.com/onOffice-Web-Org/oo-wp-plugin/assets/104892108/b9318923-4f18-4a57-88ef-cb3ed2a8397e

fredericalpers commented 11 months ago

@yeneastgate I will let my colleague check this, as soon as he's back from vacation if this is as he wished for. Thank you :)