Merge branch '4.80' of https://git.aycode.com/Adam/Mango.Nop.Plugins into 4.80
This commit is contained in:
commit
805c5e2299
|
|
@ -587,7 +587,18 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
|||
throw new Exception($"{errorText}");
|
||||
}
|
||||
|
||||
var orderItem = await CreateOrderItem(product, order, orderProductItem, isMeasurable, unitPricesIncludeDiscounts, customer, store);
|
||||
if(orderProductItem.Price != product.Price)
|
||||
{
|
||||
//manual price change
|
||||
unitPricesIncludeDiscounts = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitPricesIncludeDiscounts = true;
|
||||
}
|
||||
|
||||
|
||||
var orderItem = await CreateOrderItem(product, order, orderProductItem, isMeasurable, unitPricesIncludeDiscounts, customer, store);
|
||||
|
||||
await _orderService.InsertOrderItemAsync(orderItem);
|
||||
await _productService.AdjustInventoryAsync(product, -orderItem.Quantity, orderItem.AttributesXml, string.Format(await _localizationService.GetResourceAsync("Admin.StockQuantityHistory.Messages.PlaceOrder"), order.Id));
|
||||
|
|
@ -622,13 +633,23 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
|||
|
||||
store ??= await _storeContext.GetCurrentStoreAsync();
|
||||
customer ??= await _workContext.GetCurrentCustomerAsync();
|
||||
|
||||
var priceCalculation = await _priceCalculationService.GetFinalPriceAsync(product, customer, store, includeDiscounts: unitPricesIncludeDiscounts);
|
||||
var unitPriceInclTaxValue = priceCalculation.finalPrice;
|
||||
|
||||
// Calculate tax
|
||||
//var (unitPriceInclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPrice, true, customer);
|
||||
var (unitPriceExclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPriceInclTaxValue, false, customer);
|
||||
decimal unitPriceInclTaxValue = 0;
|
||||
|
||||
if (unitPricesIncludeDiscounts)
|
||||
{
|
||||
var priceCalculation = await _priceCalculationService.GetFinalPriceAsync(product, customer, store, includeDiscounts: unitPricesIncludeDiscounts);
|
||||
unitPriceInclTaxValue = priceCalculation.finalPrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitPriceInclTaxValue = orderProductItem.Price;
|
||||
}
|
||||
|
||||
|
||||
// Calculate tax
|
||||
//var (unitPriceInclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPrice, true, customer);
|
||||
var (unitPriceExclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPriceInclTaxValue, false, customer);
|
||||
|
||||
return new OrderItem
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue