Skip to content

Commit 27fe459

Browse files
committed
smartstore#320 Unavailable attribute combinations: better UI indication
1 parent af0c8a4 commit 27fe459

5 files changed

Lines changed: 21 additions & 9 deletions

File tree

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Updated BundleTransformer to the latest version 1.8.25
1414
* Added JavaScriptEngineSwitcher.Msie (disabled by default). Useful in scenarios where target server has problems calling the V8 native libs.
1515
* Updated some 3rd party libraries to their latest versions
16+
* #320 Unavailable attribute combinations: better UI indication
1617

1718
###Bugfixes###
1819
* UI notifications get displayed repeatedly

src/Libraries/SmartStore.Services/Catalog/ProductAttributeService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ orderby pvac.Id
457457

458458
var query =
459459
from pvac in _productVariantAttributeCombinationRepository.Table
460-
where pvac.ProductId == productId && pvac.Price != null
460+
where pvac.ProductId == productId && pvac.Price != null && pvac.IsActive
461461
orderby pvac.Price ascending
462462
select pvac.Price;
463463

src/Presentation/SmartStore.Web/Administration/Models/Catalog/ProductVariantAttributeCombinationModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public ProductVariantAttributeCombinationModel()
6262
public int? BasePriceBaseAmount { get; set; }
6363

6464
[SmartResourceDisplayName("Common.IsActive")]
65-
public bool IsActive { get; set; }
65+
public bool IsActive { get; set; }
6666

6767
public IList<ProductVariantAttributeModel> ProductVariantAttributes { get; set; }
6868

src/Presentation/SmartStore.Web/Controllers/CatalogController.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,17 +1545,25 @@ protected ProductDetailsModel PrepareProductDetailModel(ProductDetailsModel mode
15451545
else if (isAssociatedProduct)
15461546
model.ThumbDimensions = _mediaSettings.AssociatedProductPictureSize;
15471547

1548-
1549-
var deliveryTime = _deliveryTimeService.GetDeliveryTimeById(product.DeliveryTimeId.GetValueOrDefault());
1550-
if (deliveryTime != null) {
1551-
model.DeliveryTimeName = deliveryTime.GetLocalized(x => x.Name);
1552-
model.DeliveryTimeHexValue = deliveryTime.ColorHexValue;
1553-
}
1548+
if (model.IsAvailable)
1549+
{
1550+
var deliveryTime = _deliveryTimeService.GetDeliveryTimeById(product.DeliveryTimeId.GetValueOrDefault());
1551+
if (deliveryTime != null)
1552+
{
1553+
model.DeliveryTimeName = deliveryTime.GetLocalized(x => x.Name);
1554+
model.DeliveryTimeHexValue = deliveryTime.ColorHexValue;
1555+
}
1556+
}
15541557

15551558
model.DisplayDeliveryTime = _catalogSettings.ShowDeliveryTimesInProductDetail;
15561559
model.IsShipEnabled = product.IsShipEnabled;
15571560
model.DisplayDeliveryTimeAccordingToStock = product.DisplayDeliveryTimeAccordingToStock();
15581561

1562+
if (model.DeliveryTimeName.IsNullOrEmpty() && model.DisplayDeliveryTime)
1563+
{
1564+
model.DeliveryTimeName = T("ShoppingCart.NotAvailable");
1565+
}
1566+
15591567
//back in stock subscriptions)
15601568
if (product.ManageInventoryMethod == ManageInventoryMethod.ManageStock &&
15611569
product.BackorderMode == BackorderMode.NoBackorders &&

src/Presentation/SmartStore.Web/Scripts/public.product-detail.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@
9191

9292
//delivery time
9393
var deliveryTime = priceBlock.find(".delivery-time");
94-
deliveryTime.find(".delivery-time-color").css("background-color", data.Delivery.Color).attr("title", data.Delivery.Name);
9594
deliveryTime.find(".delivery-time-value").html(data.Delivery.Name);
95+
deliveryTime.find(".delivery-time-color")
96+
.css("background-color", data.Delivery.Color)
97+
.attr("title", data.Delivery.Name)
98+
.toggle(data.Stock.Availability.Available);
9699

97100
//attributes
98101
var attributesBlock = $(context).find('.attributes').addBack();

0 commit comments

Comments
 (0)