Our Nopcommerce site has two store configurations and each store has a different domain.
I need to implement a scheduled task for each store and this task calls a 3rd party API. The 3rd party API validates the caller URL, so I need each scheduled task to call the API using each Store's respective URL.
TaskA should call the API from siteA.com TaskB should call the API from siteB.com
Has anybody done this for a multi store nopcommerce site? Thanks
What we can do is use the task as a proxy, to call another Action.
So in your task:
1) Loop through all the stores 2) For each store, calls the specific URL, like "http://yourstore.com/mycontroller/myasction". 3) MyController.MyAction() in return will do the actual API calls.
is there proper way to get store context on the scheduled task?
for now it seems not able to get proper store context id even task ran like https://mystoreB.com/scheduletask/runtask
and we get the exception:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: storeId at Nop.Services.Stores.StoreMappingService.InsertStoreMapping[T](T entity, Int32 storeId) in nopCommerce_4.10_Source\Libraries\Nop.Services\Stores\StoreMappingService.cs:line 131 at Nop.Plugin.ProductFeeder.Services.UpdateStoreTask.Execute()
in your invoke method, You need to first get all store from store entity (table) then in for loop call your service with parameter -store id and store related endpoint.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.