Skip to content

Commit

Permalink
Ability to assign catalog price per currency #959 - Price adjustment …
Browse files Browse the repository at this point in the history
…on the product combination will not be supported
  • Loading branch information
KrzysztofPajak committed Nov 3, 2020
1 parent d968a76 commit b9a5d9b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Grand.Services/Catalog/PriceCalculationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ async Task<ProductPriceForCaching> PrepareModel()
if (combination != null)
{
if (combination.OverriddenPrice.HasValue)
finalPrice = combination.OverriddenPrice.Value;
finalPrice = await _currencyService.ConvertFromPrimaryStoreCurrency(combination.OverriddenPrice.Value, currency);
if (combination.TierPrices.Any())
{
var storeId = _storeContext.CurrentStore.Id;
Expand All @@ -557,7 +557,7 @@ async Task<ProductPriceForCaching> PrepareModel()
customer.CustomerRoles.Where(role => role.Active).Select(role => role.Id).Contains(x.CustomerRoleId)).ToList();
var tierPrice = actualTierPrices.LastOrDefault(price => quantity >= price.Quantity);
if (tierPrice != null)
finalPrice = tierPrice.Price;
finalPrice = await _currencyService.ConvertFromPrimaryStoreCurrency(tierPrice.Price, currency);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public ProductAttributeCombinationProfile()
{
CreateMap<ProductAttributeCombination, ProductAttributeCombinationModel>()
.ForMember(dest => dest.UseMultipleWarehouses, mo => mo.Ignore())
.ForMember(dest => dest.PrimaryStoreCurrencyCode, mo => mo.Ignore())
.ForMember(dest => dest.WarehouseInventoryModels, mo => mo.Ignore());
CreateMap<ProductAttributeCombinationModel, ProductAttributeCombination>()
.ForMember(dest => dest.WarehouseInventory, mo => mo.Ignore())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public ProductAttributeCombinationModel()
[GrandResourceDisplayName("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice")]
[UIHint("DecimalNullable")]
public decimal? OverriddenPrice { get; set; }
public string PrimaryStoreCurrencyCode { get; set; }

[GrandResourceDisplayName("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.NotifyAdminForQuantityBelow")]
public int NotifyAdminForQuantityBelow { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Grand.Web/Areas/Admin/Services/ProductViewModelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public virtual async Task PrepareAddProductAttributeCombinationModel(ProductAttr
DisplayOrder = picture.DisplayOrder
});
}
model.PrimaryStoreCurrencyCode = (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId))?.CurrencyCode;
}

public virtual async Task PrepareTierPriceModel(ProductModel.TierPriceModel model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
<div class="form-group">
<admin-label asp-for="OverriddenPrice" class="col-sm-3 control-label" />
<div class="col-md-9 col-sm-9">
<admin-input asp-for="OverriddenPrice" />
<admin-input asp-for="OverriddenPrice" /> [@Model.PrimaryStoreCurrencyCode]
<span asp-validation-for="OverriddenPrice"></span>
</div>
</div>
Expand Down Expand Up @@ -242,7 +242,7 @@
{
<div class="panel panel-default">
<div class="panel-heading">
@T("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.TierPrices")
@T("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.TierPrices") [@Model.PrimaryStoreCurrencyCode]
</div>
<div class="panel-body">
<div id="tierprices-grid"></div>
Expand Down

0 comments on commit b9a5d9b

Please sign in to comment.