We advise against such direct data manupulation. Is there any reason you can't use the APIs to update the order?
Technically you can remove the cache before loading the order, but that would be expensive.
There is a complicated process that integrates with a 3rd party outside epi that we cant change. We usually try to avoid direct manipulation, but was not an option in this case.
I am assuming removing the cache would effect everything and not just the one order?
Basically yes. We don't disclose how is the cache key is constructed (it's internal implementation), and there might be more than 1. So to be "safe" you would need to clear the cache, and that'd be expensive.
Is it possible to share which data are you updating? I don't think that can't be done via APIs which adequate performance.
We are updating data on order group and purchase order. We have a workaround in place now that seems to work without having to clear cache.
Thanks for your help.
Hallo ,
I have the same problem . I am saving my cart from orderrepository but it is reflected after Irestart my solution.
I can't fetch the updated repository.
_wishlist.Name = "wishList";
DateTime today = DateTime.Today;
Cart.Properties["DeliveryDate"] = today;
Cart.Properties["DeliveryTime"] = DateTime.Now.ToString("HH:mm");
var result = _orderRepository.Save(Cart);
//saves my current cart as wishlist
var wishlistsOrders = _orderRepository.Load(_customerContext.CurrentContactId, string.Empty)
//loads my wishlists but doesn't lods the one just updated above.
//loads it after I have restarted the solution.
Any input will be great help.
private ICart Cart
{
get { return _wishlist ?? (_wishlist = _cartService.LoadCart(_cartService.DefaultCartName)); }
}
//this loads my current cart.
Hmm, I think there is a bug in our side, I'll file a bug for it.
In the meanwhile, what you can do is to load the wishlist by
_orderRepository.Load(_customerContext.CurrentContactId, _cartService.DefaultCartName);
instead.
I'm not sure why you are using "DefaultCartName" for wishlist, but that's your decision
Actually we already had the bug COM-6485, which was fixed and released in Commerce 11.8.2
Your best option should be upgrade to latest version (well, you can upgrade to that exact version, but newer version is better)
Actually..we are using "Default" as cart and we are saving a cart as our wishlist by updating the name of our cart.
if (Cart == null)
{
_wishlist = _cartService.LoadOrCreateCart(_cartService.DefaultCartName);
}
_wishlist.Name = "wishList"; // cart name updated here
DateTime today = DateTime.Today;
Cart.Properties["DeliveryDate"] = today;
Cart.Properties["DeliveryTime"] = DateTime.Now.ToString("HH:mm");
var result = _orderRepository.Save(Cart);
In this way we moved cart with name "Default" to wishlist named as "Wishlist" in the orderrepository.
But when I tried to load the all saved wishlist I can fetch it using..
var wishlistsOrders = _orderRepository.Load(_customerContext.CurrentContactId, string.Empty);
But above code does not returns me the cart we saved as "wishlist".
it return all the objects in "wishlistsOrders " as cart.name="Default".
In this way we are not able to display the updated wishlist at current time becoz we can anly display cart with name as "wishlist".
How can I avoid the cache as when I save my cart or delete it in repository.
Is there any workaround which I can use to avoid loading my updated repository from cache?.
It will be a great input.
Thanks!
Upgrading to 11.8.2 should be much easier solution than having to work around the cache system (which is, pretty internal, and should not be touched )
hello ,
When I tried updating Eoiserver commerce , I had below exception.
Solved many dependencies exceptions but didn't found a way to resolve this.
This should be in new thread instead. Which is the version of EPiServer.Shell in bin folder?
Isn't that self-explanatory? EPiServer.Commerce.UI.CustomerService, Version=12.11.0.0 requires at least EPiServer.Shell 11.7. When you upgrade Commerce it should also update other dependencies.
yes, but the thing is we didnt updated any of the dlls to 12.11 and there are many other dlls who want to execute episerver.shell 11.2
Then why do you have EPiServer.Commerce.UI.CustomerService, Version=12.11.0.0 in your bin folder?
Not sure though , how i have 12.11 as EPiServer.Commerce.UI.CustomerService in my bin.
Thanks Quan !!
I deleted bin folder and updated the database and it worked.
Hello ,
We successfuly updated the version to 11.8.2 but the problem still persists.
that's odd. I would suggest to contact developer support for further assistance. Based on the information you provided, then the bug fix in that version should have fixed it (you should probably upgrade to 11.8.5 which is the last version of 11.x anyway), so there might be something that was not mentioned/discovered
Hi Quan
I'm working with Epi Commerce 12+, and am running into a similar caching issue described above. Here's my scenario :
There is an approval process involved in our order processing system, where the cart should not be converted into a purchase order until its finally approved. But once a user had submitted one cart for approval, they should be able to create another cart, while the first is still pending. Now, i know Episerver does not allow multiple carts per user, but I read in another of your posts, where this can be achived by having a different cart name. So, i'm using that approach and when a cart is submitted for approval, I modify the cart name by appending some value to it. This works fine and saves correctly and I can see changes in commerce manager. However, the user still sees the last submitted cart as his active shopping cart, even though i have checks in place to look for cart name and other fields, when loading active cart. When i debugged this part, it seems like its loading from cache as same order group id that I just updated name on, shows as original name. If I clear browser cache or recycle app pool, I no longer see an active shopping cart and can create again.
Is there a way to remove just this specific cache object? Or can you recommend an alternate approach to deal with this?
Thanks!
I'd suggest to create another thread. But as you already posted in this thread, here it goes
How does you load the cart?
Hey Quan
I load cart by name, and then do additional checks on status, to see if i got the right cart. In this particular scenario, when I submit first cart, i change name to default name + id. Then once the page posts back, it tries to load active shopping cart, at which point I call Load cart by default name. This technically should return null, as i already updated name on existing cart, but since this stuff is cached and cache is not cleaned when cart name is changed, it loads the first cart, even though the name doesn't match.
Hello,
We have a process that changes the order data via a stored procedure. The issue we are running into is that when we then load up the order via the order repository, the order is pulling from a cached version that does not have the changes the store procecure executed. Through my research, I havent found a way yet to load up the order fresh and not from cache. Is there a way to do this?
Thank you.