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

P#71803 Multiple detail pages for translation #243

Closed jmaas-onoffice closed 2 years ago

jmaas-onoffice commented 2 years ago

Current state

The plugin only allows one detail page. This is a problem when translating the website, since the detail page exists in multiple languages.

When you open a detail page and switch languages, WPML will link the correct URL, but since the rewrite rule is not set correctly for that language, the URL will lose the ID (e.g. will link /immobiliendetails/123 to /estatedetails/123, but opening /estatedetails/123 will redirect to /estatedetails which causes the error that the EstateId must not be 0).

Due to a bug, it actually is currently possible to make this work, but it is easy to break it again, since any time the rewrite rules are reset, only the latest detail page works.

Desired state

  1. The plugin should allow multiple detail pages. For this, the rewrite rules probably need to be updated.

  2. The estate lists need to know which detail page to link to. They should link to the most recently added detail page. This page should also be the one linked in the detail view settings:

    grafik

Notes

It might be helpful to do it together with #251.

jmaas-onoffice commented 2 years ago

I imagine that currently the detection for estate list, detail view and form shortcodes is different. It might make sense to have one system to detect our shortcodes.

LongTrong-exe commented 2 years ago

@jmaas-onoffice This requirments was fix by #234 https://github.com/onOfficeGmbH/oo-wp-plugin/blob/e14c933391420df1f9cf026ebcba5de5df27130f/plugin/Controller/RewriteRuleBuilder.php#L64-L72

I think you better create a new issue with this comment, and close this issue.

jmaas-onoffice commented 2 years ago

That's great! I just tested it and it works as desired. :)

@longtrong-exe Since my comment is about a refactoring, could you create the issue/PR? I'm not sure what the best way to do the refactoring is or if it even is a good idea. But feel free to do it, if it seems like an improvement to you!