Accessing order entities from productvariant in Nop.Core

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 anni tempo fa
I need to add up all orders of a certant status when getting data from productvariant.cs.. I know I can handle this in Nop.Services but is there a way to access this directly from productvariant.cs in Nop.Core?

Basically what im doing is changing the "get" for StockQuantity so if the product variant is of a certant ManageInventoryMethod, I get the qty from our backend system(got this covered) and then subtract all the OrderProductVariants where the order status is not complete..

Is this possible?
11 anni tempo fa
It really belongs in Nop.Services.  Just implement a new function there and avoid the headache.
11 anni tempo fa
The problem is suppose there is a service that returns a list of OrderProductVariants.. In the method that uses the OrderProductVariants it uses OrderProductVariant.ProductVariant.StockQuantity.. I wouldnt be able to change the value of StockQuantity to my "computed value"..
11 anni tempo fa
Why can't you change that reference from StockQuantity to your GetRealStockQuantity() function?
11 anni tempo fa
Because I would have to change that everywhere that stockquantity is used, including anywhere new that its used in future versions of NopCommerce..
11 anni tempo fa
Ok, how about this.  You run a scheduled process every N hours to refresh the StockQuantity for those items to what your Back Office process says + open orders.  You could possibly be off by a few but at least the data is only a few hours old.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.