Skip to content

Commit

Permalink
#2262 Added a warning that the same combination already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanovM committed Aug 30, 2017
1 parent c46a9d6 commit 8b5ff1a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3345,6 +3345,9 @@
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.AttributeCombinations.AddTitle">
<Value>Select new combination and enter details below</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.AttributeCombinations.AlreadyExists">
<Value>The same combination already exists</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Description">
<Value>Note that some attribute control types that support custom user input (e.g. file upload, textboxes, date picker) are useless with attribute combinations</Value>
</LocaleResource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4629,6 +4629,12 @@ public virtual IActionResult AddAttributeCombinationPopup(int productId, AddProd

warnings.AddRange(_shoppingCartService.GetShoppingCartItemAttributeWarnings(_workContext.CurrentCustomer,
ShoppingCartType.ShoppingCart, product, 1, attributesXml, true));

//check whether the same attribute combination already exists
var existingCombination = _productAttributeParser.FindProductAttributeCombination(product, attributesXml);
if (existingCombination != null)
warnings.Add(_localizationService.GetResource("Admin.Catalog.Products.ProductAttributes.AttributeCombinations.AlreadyExists"));

if (!warnings.Any())
{
//save combination
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@
<div class="panel-group">
<div class="panel panel-default panel-popup">
<div class="panel-body">
@if (Model.Warnings.Count > 0)
@foreach (var warning in Model.Warnings)
{
<div class="alert alert-warning alert-dismissible">
@foreach (var warning in Model.Warnings)
{
@warning
}
@warning
</div>
}

Expand Down
3 changes: 3 additions & 0 deletions upgradescripts/3.90-4.00 (under development)/upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ set @resources='
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.AdminArea.UseRichEditorInMessageTemplates.Hint">
<Value>Indicates whether to use rich editor on message templates and campaigns details pages.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.AttributeCombinations.AlreadyExists">
<Value>The same combination already exists</Value>
</LocaleResource>
</Language>
'

Expand Down

0 comments on commit 8b5ff1a

Please sign in to comment.