Developer forum

Forum » Integration » Prices not updated when using Live integration and Impersonation

Prices not updated when using Live integration and Impersonation

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

We are experiencing a weird behavior on DW 9.8.5 using live integration and impersonation.

Basically, what we see is that the prices are cached and persistent when changing the impersonated user.

Apparently on logout or change impersonation, some session information is cleared but not the price.

Anybody else experienced the same problem? Is there a way to connect to a notification on change impersonation and use some method to clear just the price related part of the session?

Thank you,
Adrian


Replies

 
Nicolai Pedersen
Reply

standard liveintegration dll or is it customized? It has some caching of prices that sounds like could be an issue.

 
Emil Dumitrescu
Reply

This happens with both the patched assembly (I've written in a forum post about a different issue we have) as well as the standard live integration 3.0.0 assembly. This doesn't happen on impersonation only, you could just log out and enter with a different account in the same window. If you do this using a separate incognito window, everything is fine. So yes, this is related to the session (I saw that in 9.8 you are not using the Session.Abandon() anymore).

 
Emil Dumitrescu
Reply

I found a way to fix this problem, by creating a custom provider that inherits ProductProviderBase (from Live Integration 3.0) and there I include the user's customer number in the product identifier. It works fine for now.

 
Nicolai Pedersen
Reply

Hi Emil

Well done. Can you share your code - then we can incorporate it (or find another way to address the issue)

Thanks!

Nicolai

 
Emil Dumitrescu
Reply

Hello Nicolai,

I've attached a file with the code that worked for us. For you will be more complicated as it's more generic and must cover more scenarios.

Regards,

Emil

In case the file can't be opened:

using Dynamicweb.Ecommerce.LiveIntegration.Products;
using Dynamicweb.Ecommerce.Products;
using Dynamicweb.Security.UserManagement;

namespace Df.Dw.Total.Ecommerce.Products.Price
{
    public class CustomLiveIntegrationProductProvider : ProductProviderBase
    {
        public override string GetProductIdentifier(Product product)
        {
            return GetProductIdentifier(product, null);
        }

        public override string GetProductIdentifier(Product product, string unitId)
        {
            var user = User.GetCurrentExtranetUser();
            return $"{product.Number}.{product.VariantId}.{product.LanguageId}.{user?.CustomerNumber}";
        }
    }
}

 

 

You must be logged in to post in the forum