Closed timdk closed 4 years ago
Hi @timdk , thank you for opening the new issue, I have seen your comment in #14 and created an internal ticket to check it, but I have been a few days offline, I'll try checking it soon.
Have a nice day!
Hi @jochhop thanks for replying. I have found another symptom with CMS blocks, hopefully it can help with debugging
I have a CMS block that contains links to pages using the syntax
<a href="{{store direct_url="contacts"}}" title="Support">
When I query on the /search
endpoint the URLs are generated relative to /admin
GET /rest/de/V1/snowdog/cmsBlock/search?searchCriteria=undefined
Response: <a href=\"http://magento.test/admin/contacts\" title=\"Support\">
Querying directly by ID has the expected format
GET /rest/de/V1/snowdog/cmsBlock/1
Response: <a href=\"http://magento.test/de/contacts\" title=\"Support\">
Same thing using a widget e.g.
{{widget type="Magento\\Cms\\Block\\Widget\\Page\\Link" template="widget/link/link_block.phtml" page_id="21"}}
Thanks!
Hi @timdk , I am really sorry for late reply, we have been checking the issue and here are the conclusions:
When I search for pages with /rest/de/V1/snowdog/cmsPage/search?searchCriteria=undefined the page content is all from the default view in English.
After testing standard Magento API endpoints for getting CMS pages, I have found the same behaviour, so this issue comes from Magento core (we have checked it using /rest/de/V1/cmsPage/search?searchCriteria=undefined
)
If I specify the store ID in the searchCriteria /rest/de/V1/snowdog/cmsPage/search?searchCriteria[filter_groups][0][filters][0][field]=store_id&searchCriteria[filter_groups][0][filters][0][value]=de I get the correct German content, although the pages still have "store_id": [ 0 ] on the response.
This is weird, we have tested Snowdog CMS API endpoints and they behave similarly to standard CMS API endpoints from Magento core, however, the returned result is different to the one you get. Instead of getting the correct German content, store code is ignored and default pages come in the response (that's why they have "store_id": [ 0 ]
in Snowdog CMS API response)
Also, we have tested the issue you get in your newest comment: https://github.com/SnowdogApps/magento2-cms-api/issues/21#issuecomment-675296193, but it works correctly for us, it doesn't return admin URLs
We have tested it in Magento 2.4, could you please let us know if it's replicable in such version (or please let us know what version are you using)
As we don't have more details since 7 days ago, I am closing this
Hey @jochhop apologies for the non-response, I have since moved on to a new project so I haven't had time to set up a clean Magento instance again. We implemented the workaround to apply filters query on all requests in the API client in the end.
For the CMS blocks it was a deeper issue in Magento core relating to selecting theme widgets. We had a non-default theme applied and it was always selecting the default theme widget templates when exporting CMS.
This issue can stay closed, if I have time to investigate further I will come back with a cleaner reproduction. Until then, thanks for your efforts.
Hi @timdk no worries, sorry again for our late response as well, if you find anything else please let us know.
Thanks and have a nice day!
This is related to #14 , I'm reposting my comment there as a new issue because it didn't get any traction. I can provide sample API responses but I'm not sure how useful it is considering they are specific to my store.
I have a second store view set up with code
de
for German. I am receiving different content when I query all CMS pages via the/search
endpoint and when I query a page by its ID.When I search for pages with
/rest/de/V1/snowdog/cmsPage/search?searchCriteria=undefined
the page content is all from the default view in English.If I query a specific page like
/rest/de/V1/snowdog/cmsPage/5
, the content is in German as expected.If I specify the store ID in the searchCriteria
/rest/de/V1/snowdog/cmsPage/search?searchCriteria[filter_groups][0][filters][0][field]=store_id&searchCriteria[filter_groups][0][filters][0][value]=de
I get the correct German content, although the pages still have"store_id": [ 0 ]
on the response.Can you tell me, is this the expected behaviour for the search endpoint?