umbraco-community / Our.Umbraco.OpeningHours

An Umbraco property editor for handling opening hours
MIT License
9 stars 13 forks source link

Issues when deploying to test server #13

Closed smanaton closed 7 years ago

smanaton commented 7 years ago

Hi, I've installed the plugin via nuget, works perfectly locally, when i deploy its unable to retrieve the opening hours object from the document type, any ideas on what could be wrong?

As far as i can see the plugin is installed correctly,

abjerner commented 7 years ago

@smanaton Do you get any errors? Eg. in the developer console?

Also, can you confirm that all files from the package are deployed?

smanaton commented 7 years ago

No errors, all the files seem to be there, the backend is working, i can set new opening times, my development machine connected to the same database displays everything correctly, but the deployed codebase doesnt.

I think the issue is how i get the content, the openingHours property is stored on the contact page, to get the contact page i was using var contactPage = Umbraco.TypedContentSingleAtXPath("//homepage//contactPage"); , if i use var contactPage = Umbraco.ContentQuery.TypedContent(2202); instead then it work as expected. the first example works locally but not on the server.

I can probably find a better way to locate the contact page, strange how it doesnt work in both environments.

smanaton commented 7 years ago

i have worked around it by using both: var contactPageNode = Umbraco.TypedContentSingleAtXPath("//homepage//contactPage"); var contactPage = Umbraco.ContentQuery.TypedContent(contactPageNode.Id);

umbraco seems to be returning the content differently from each call so i've used both.

abjerner commented 7 years ago

Based on your answers, this seems more like an Umbraco issues in general, so I'm closing the issue.

Given your the code you have posted, I can't think of any reason why it shouldn't work in both environments. Are you sure both environments have a published contact page?

smanaton commented 7 years ago

Agreed, seems like an umbraco issue, they were both connected to the same database with the same result