Would like to create a custom product adapter that uses the default behavior of the Vendr Umbraco ProductAdapter but override the prices collection where I want to hook in external data.
The prices on the default product snapshot is set to only get via a private prices property.
Any reason why this isn't a get and set property so one inherit the UmbracoProductAdapter and fire the base GetProductSnapshot. Overwrite the prices property before returning a product snapshot?
A snapshot by it's nature is a read only entity and so when overriding the ProductAdapter you generally have to override the ProductSnapshot too.
We have a good example of overriding the defaults in the demo store which you can find here https://github.com/vendrhub/vendr-demo-store/tree/main/src/Vendr.DemoStore/Web/Adapters as we override the adapter / snapshot in order to override the product name so it should be pretty similar to your setup, just that you want to change the prices returned rather than the name.
Custom product adapter
Would like to create a custom product adapter that uses the default behavior of the Vendr Umbraco ProductAdapter but override the prices collection where I want to hook in external data.
The prices on the default product snapshot is set to only get via a private prices property.
Any reason why this isn't a get and set property so one inherit the UmbracoProductAdapter and fire the base GetProductSnapshot. Overwrite the prices property before returning a product snapshot?
Hey Anders,
A snapshot by it's nature is a read only entity and so when overriding the ProductAdapter you generally have to override the ProductSnapshot too.
We have a good example of overriding the defaults in the demo store which you can find here https://github.com/vendrhub/vendr-demo-store/tree/main/src/Vendr.DemoStore/Web/Adapters as we override the adapter / snapshot in order to override the product name so it should be pretty similar to your setup, just that you want to change the prices returned rather than the name.
Hope this helps
Matt
Did something similar for my solution. Just wanted to check that this is the correct way of doing it..
/Thanks Anders
is working on a reply...