Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tomasz Kowalski 66 posts 208 karma points
    25 days ago
    Tomasz Kowalski
    0

    AddOrUpdateOrderLine HTML API and Public Access

    Hi,

    I have just upgraded a webshop from Umbraco 6.2 + TeaCommerce 2.3.3 to Umbraco 7.12.4 + TeaCommerce 3.2.5.

    All works fine but one thing. There are some products that can be purchased after login. Category page with these products has "Public Access" configured with role based access.

    I'm using HTML API to add products to the cart.

    It works fine, when I'm adding a product that is accessible to everyone. When I'm trying to add a product that is protected with login (yes, I am logged in), nothing happens. I'm just redirected to "returnUrl" page. No exceptions, nothing in log file.

    It's woking, when I'm temporarily remove protection with login. It worked fine in the old setup.

    Any ideas?

    EDIT: I have just tested it on TeaCommerce StartKit, and it has the same issue :(

    Kind regards

    Tomasz

  • Rune Grønkjær 1294 posts 2856 karma points
    25 days ago
    Rune Grønkjær
    0

    Hi Tomasz,

    Sounds like it might be the way Tea Commerce for umbraco checks if the user has access to the product that might be a problem.

    Tea Commerce makes the check in the HasAccess method of this class: https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/TeaCommerce.Umbraco.Configuration/InformationExtractors/PublishedContentProductInformationExtractor.cs

    Maybe I could have you download the Tea Commerce for Umbraco source code, build a debug version and check out your scenario? There might be another Umbraco way to do the check in the latest Umbraco 7.

    /Rune

  • Tomasz Kowalski 66 posts 208 karma points
    24 days ago
    Tomasz Kowalski
    0

    Hi Rune,

    Thanks for a quick response.

    Can it be, because you are using library.HasAccess instead of UmbracoHelper.MemberHasAccess ?

    I've cloned this project to my VS, but I'm getting build errors.

    Regards Tomasz

  • Rune Grønkjær 1294 posts 2856 karma points
    24 days ago
    Rune Grønkjær
    0

    Yes. And that could prove to be an issue. We don't have an UmbracoHelper at that point in the code. We will have a talk about what to do about it.

    Weird with the build errors. It should build just fine.

    /Rune

  • Tomasz Kowalski 66 posts 208 karma points
    24 days ago
    Tomasz Kowalski
    0

    But you are using UmrbacoHelper to get content i same method:

    public virtual bool HasAccess( long storeId, string productIdentifier ) {
      ProductIdentifier productIdentifierObj = new ProductIdentifier( productIdentifier );
      IPublishedContent content = UmbracoHelper.TypedContent( productIdentifierObj.NodeId );
    
      return storeId == GetStoreId( content ) && library.HasAccess( content.Id, content.Path );
    }
    
  • Rune Grønkjær 1294 posts 2856 karma points
    24 days ago
    Rune Grønkjær
    0

    Facepalm Of cause :)

    We will check it out and get back to you.

    /Rune

  • Rune Grønkjær 1294 posts 2856 karma points
    23 days ago
    Rune Grønkjær
    0

    Hi Tomasz,

    I have now updated the demo website to Umbraco 7.12.4: https://demo.teacommerce.net/umbraco/

    I also tested the hasaccess and it works perfectly. I build a debug version of the Tea Commerce for Umbraco project and tested both library and UmbracoHelper has access, and they work exactly the same way. They both return false when the product is member group protected.

    Something else must be your problem.

    /Rune

  • Tomasz Kowalski 66 posts 208 karma points
    23 days ago
    Tomasz Kowalski
    0

    Hi Rune,

    Can you add "protected" products to the cart, when you are logged in? I tried to do it on your demo site, but I can see a login page.

    /Tomasz

  • Rune Grønkjær 1294 posts 2856 karma points
    23 days ago
    Rune Grønkjær
    0

    There's no login functionality on the demo website. But yes. If you're logged in as an Umbraco member you can add the product to the cart.

    /Rune

  • Tomasz Kowalski 66 posts 208 karma points
    23 days ago
    Tomasz Kowalski
    0

    Hmmmm... It is very interesting case.

    I have a fresh project with the newest Umbraco, plus TeaCommerce, plus TC Starter kit. Nothing else.

    Yesterday I couldn't add protected product to the cart.

    But it was working suddenly today!?

    Now I can see, that I can add protected product to the cart IF I am NOT logged in to Umbraco backend in same webbrowser!

    When I am logged in, I can't add protected product to the cart.

    Maybe it's a bug in Umbraco?

    I still can't build a debug version of TCforUmbraco (or I don't know how to do it right). I'm getting build errors like:

    Error   CS0012  The type 'WebPage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. TeaCommerce.Umbraco.Configuration   d:\git\Source\Repos\Tea-Commerce-for-Umbraco\Source\TeaCommerce.Umbraco.Configuration\Infrastructure\Templating\TemplateContext.cs  6
    

    But I'm thinking about override "PublishedContentProductInformationExtractor" in my test project and test it.

    Anyway, thank you for your time :)

    /Tomasz

  • Rune Grønkjær 1294 posts 2856 karma points
    22 days ago
    Rune Grønkjær
    0

    I cannot reproduce the problem you are describing. No matter what I do with being logged into or out of the Umbraco back office I cannot add a member protected product to the cart.

    You need to be logged in with a member to gain access to a protected node.

    As for your build error, maybe you need to update some .net stuff?

    Hope you find a solution to your problem :)

    /Rune

  • Rune Grønkjær 1294 posts 2856 karma points
    22 days ago
    Rune Grønkjær
    0

    I have some more information now.

    It actually looks like there is a problem. The FromPost calls TC makes from the browser to the server does somehow NOT have access the the currently logged in member. So HasAccess will always return false.

    I believe a rewrite of the FormPost part in the TC core will be needed to fix the problem. :/

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft