umbraco / Umbraco.Commerce.DemoStore

MIT License
12 stars 13 forks source link

order.editor.config.js not working #1

Closed mathiasdebugged closed 1 year ago

mathiasdebugged commented 1 year ago

If we modify blendid.order.editor.config.js, it isn't reflected in the order detail in the backoffice. It seems like the config file isn't picked up. Omitting the store alias also doesn't work.

mattbrailsford commented 1 year ago

Can you please detail where the config file is located and what actual changes you are making to the file?

mathiasdebugged commented 1 year ago

Hi thank you for your response, I just edited the config file in this repo under 'src/Umbraco.Commerce.DemoStore.Web/App_Plugins/UmbracoCommerce/config/blendid.order.editor.config.js' for testing purposes, because I noticed it stopped working when I upgraded to Umbraco Commerce from Vendr.

I removed all the properties under 'billing' but the billing properties still remained visible.

mattbrailsford commented 1 year ago

Yea, that's not how it works. The billing properties will always be there, the config is just there to allow you to say "which properties in my order do they map to". The only fields you can add remove are the order line properties and the additional info.

mathiasdebugged commented 1 year ago

But the properties in the above config file like 'billingAddressLine1' are additional properties? So the should disappear, right? I also tested with additional props I had added to orderlines via the dictionary in the 'AddProduct' function and they also didn't appear on the orderline. It's like the file is completely ignored. When I remove exactly the same additional billing properties in the Vendr demostore they do disappear.

I even tried putting: { view : "/wrong-file-path" }

With this you would expect an error, but the order detail remains unchanged.

mattbrailsford commented 1 year ago

Can you please share exact config examples with expected result and actual result

mathiasdebugged commented 1 year ago

I use this config under 'src/Umbraco.Commerce.DemoStore.Web/App_Plugins/UmbracoCommerce/config/blendid.order.editor.config.js': { view : "/wrong-file-path" }

I expect to get a 404 error if I go to the order detail, like it did with Vendr. But I just see the regular order detail. I don't think it's a problem with the config itself, because nothing gets picked up. And all these configs did work in my old Vendr project. It's maybe a problem with the file location or name or some caching? It doesn't get picked up in my own project nor in this demo project.

I also tried putting the file under wwwroot/App_plugins to no avail.

mattbrailsford commented 1 year ago

And this is using the otherwise unchanged demo project?

mattbrailsford commented 1 year ago

Ahh, ok, I think I know the issue. In Umbraco Commerce we changed it to use the correct .json file suffix, rather than .js that we had in Vendr.

In Vendr we used .js to fool IIS to return it without needing a custom mime type adding for .json. In .NET Core this is not an issue so we can actually use the correct .json file extension.

I've submitted a PR to the docs to correct this https://github.com/umbraco/UmbracoDocs/pull/5361

Update I've run a test locally and using the right extension does indeed throw the error you would expect so I'll consider this resovled.

mathiasdebugged commented 1 year ago

This indeed works, ty 🙏