vendrhub / vendr-checkout

A ready made checkout flow for Vendr, the eCommerce solution for Umbraco v8+
https://vendr.net/add-ons/vendr-checkout/
MIT License
14 stars 17 forks source link

Support for Umbraco v10 #34

Closed pageorge closed 2 years ago

pageorge commented 2 years ago

Hey Matt

I tried installing the latest Vendr Checkout v2.1.1 with Umbraco 10.0.1 and I got the following error when clicking the install button in the back office: Method not found: 'Umbraco.Cms.Core.Services.OperationResult Umbraco.Cms.Core.Services.IContentService.Save(Umbraco.Cms.Core.Models.IContent, Int32)'.

I had a look at the source and Vendr.Checkout.csproj is only targeting net472 (Umbraco 8) and net5.0 (Umbraco 9)

  <PropertyGroup>
      <TargetFrameworks>net472;net5.0</TargetFrameworks>
  </PropertyGroup>

    <ItemGroup Condition="'$(TargetFramework)' == 'net472'">
        <PackageReference Include="UmbracoCms.Web" Version="8.17.0" />
        <PackageReference Include="Vendr.Umbraco.Startup" Version="2.0.0" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
        <PackageReference Include="Umbraco.Cms.Web.Website" Version="9.0.0" />
        <PackageReference Include="Vendr.Umbraco.Startup" Version="2.0.0" />
    </ItemGroup>

I added a reference to net6.0 Umbraco.Cms.Web.Website Version="10.0.1", tried again and everything installed fine! One thing to note is I had to delete the Checkout node in order for the steps to get recreated due to the totalRecords being > 1 and the calls to CreateCheckoutStepPage being skipped, as the error occurs inside CreateCheckoutStepPage when _contentService.Save(checkoutStepNode) tries to reference an older Umbraco IContentService - in my case it was the v8 one installed in my local git repo. This might affect other peeps installing with Umbraco v10.

Hope this info is of help, have a great weekend!

Cheers Phil

mattbrailsford commented 2 years ago

Hey,

There is 2.1.2-beta0001 on our unstable nuget feed which should address this.

It shouldn't matter that the pkg is duel targted or that it targets .NET Framework and .NET 5. .NET 5 compiled libraries should still work on .NET 6.

The real issue is that Umbraco moved an interface method to another base interface and so code compiled against the older Umbraco library will fail becuase it looks for the method in the wrong place. In the beta I mentioned above we now use reflection to call that method so that it can continue to run for v8, v9 and v10 (while we still support all versions)

pageorge commented 2 years ago

Hey Mat,

Thanks for the quick response, that all makes sense now why the save method could not be found (looking in the wrong place!).

Is this the correct url for your nuget server? https://nuget.outfield.digital? In VS I get the following error: [Outfield] The V2 feed at 'https://nuget.outfield.digital/Search()?$filter=IsLatestVersion&searchTerm='vendr'&targetFramework='net6.0'&includePrerelease=false&$skip=0&$top=26&semVerLevel=2.0.0' returned an unexpected status code '503 Service Unavailable'.

and I just get a site maintenance page when I browse to https://nuget.outfield.digital/.

Cheers Phil

mattbrailsford commented 2 years ago

Hey Phil,

Sorry, I should have posted it. It's https://nuget.outfield.digital/unstable/vendr/v3/index.json

pageorge commented 2 years ago

Hey Matt,

2.1.2-beta0001 works like a charm! I deleted the Content\Checkout node and child step nodes, re-ran the Settings\Vendr Checkout\Install and viola! All nodes re-created.

Thanks for unblocking us so quickly, we can now get cracking implementing Vendr Checkout on Umbraco v10. 👍

mattbrailsford commented 2 years ago

Great stuff 👍

I'll get released shortly.

mattbrailsford commented 2 years ago

2.1.2 was released with v10 support

dawoe commented 2 years ago

Hi @mattbrailsford

I'm in the progress of updating a site using Vendr from V9 to V10

Check out is preventing me to upgrade. It stumbles on checkout having a constraint on the Vendr.Umbraco.Startup version

image

While I'm trying to use Vendr 3.0.3

mattbrailsford commented 2 years ago

Looks like I haven't pushed out the v3 release yet. I seem to have one on our unstable feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json but I must have asked someone to test and forgot about it.

You're welome to try the 3.0.0-alpha0002 that is on that feed and let me know if it works. Feel free to raise new issues if something isn't working.

dawoe commented 2 years ago

That solved my issue