Closed jmaas-onoffice closed 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.
@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.
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!
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
The plugin should allow multiple detail pages. For this, the rewrite rules probably need to be updated.
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:
Notes
It might be helpful to do it together with #251.