Total Posts:
425
Karma:
3039
Joined:
3/21/2012
Location:
Brazil
Hi! Im creating a new plugin. In a specific controller's method, Im trying to get the storeid by _storeContext.CurrentStore.Id. But the result is always the same storeId. When I access the stores by URL, I see them correctly, only my plugin is getting the wrong storeid. Can you help? Ivan.
Total Posts:
766
Karma:
16050
Joined:
12/24/2012
Location:
Vietnam
Let me check it. How do you get "_storeContext"?
Total Posts:
425
Karma:
3039
Joined:
3/21/2012
Location:
Brazil
Adding it to private readonly fields, then controller´s constructor. like everywhere.
Total Posts:
425
Karma:
3039
Joined:
3/21/2012
Location:
Brazil
No.. same wrong store id.
Total Posts:
425
Karma:
3039
Joined:
3/21/2012
Location:
Brazil
I overrode the EfRepository<Product> GetById method in my plugin. There I need get the store Id, and Im using EngineContext.Current.Resolve<IStoreContext>() like you suggested. But it is the data layer, maybe there, the store context doesnt exist, so it could the cause of this problem. What do you think?
Total Posts:
425
Karma:
3039
Joined:
3/21/2012
Location:
Brazil
Solved. The store id was correct. The EF was cheating me auto updating the database. See: https://www.nopcommerce.com/boards/t/35250/override-productservice.aspx#142667 Thanks!!