@@ -59,6 +59,8 @@ public partial class ProductController : PublicControllerBase
5959 private readonly LocalizationSettings _localizationSettings ;
6060 private readonly CaptchaSettings _captchaSettings ;
6161 private readonly CatalogHelper _helper ;
62+ private readonly IDownloadService _downloadService ;
63+ private readonly ILocalizationService _localizationService ;
6264
6365 #endregion
6466
@@ -90,7 +92,9 @@ public ProductController(
9092 ShoppingCartSettings shoppingCartSettings ,
9193 LocalizationSettings localizationSettings ,
9294 CaptchaSettings captchaSettings ,
93- CatalogHelper helper )
95+ CatalogHelper helper ,
96+ IDownloadService downloadService ,
97+ ILocalizationService localizationService )
9498 {
9599 this . _services = services ;
96100 this . _manufacturerService = manufacturerService ;
@@ -118,6 +122,8 @@ public ProductController(
118122 this . _localizationSettings = localizationSettings ;
119123 this . _captchaSettings = captchaSettings ;
120124 this . _helper = helper ;
125+ this . _downloadService = downloadService ;
126+ this . _localizationService = localizationService ;
121127
122128 T = NullLocalizer . Instance ;
123129 }
@@ -662,62 +668,73 @@ public ActionResult UpdateProductDetails(int productId, string itemType, int bun
662668 }
663669 }
664670
671+ var attributes = _productAttributeService . GetProductVariantAttributesByProductId ( productId ) ;
672+ var warnings = new List < string > ( ) ;
673+ string attributeXml = form . CreateSelectedAttributesXml ( productId , attributes , _productAttributeParser ,
674+ _localizationService , _downloadService , _catalogSettings , this . Request , warnings , true ) ;
675+
665676 #region data object
666- object data = new
667- {
668- Delivery = new
669- {
670- Id = 0 ,
671- Name = m . DeliveryTimeName ,
672- Color = m . DeliveryTimeHexValue ,
673- DisplayAccordingToStock = m . DisplayDeliveryTimeAccordingToStock
674- } ,
675- Measure = new
676- {
677- Weight = new { Value = m . WeightValue , Text = m . Weight } ,
678- Height = new { Value = product . Height , Text = m . Height } ,
679- Width = new { Value = product . Width , Text = m . Width } ,
680- Length = new { Value = product . Length , Text = m . Length }
681- } ,
682- Number = new
683- {
684- Sku = new { Value = m . Sku , Show = m . ShowSku } ,
685- Gtin = new { Value = m . Gtin , Show = m . ShowGtin } ,
686- Mpn = new { Value = m . ManufacturerPartNumber , Show = m . ShowManufacturerPartNumber }
687- } ,
688- Price = new
689- {
690- Base = new
691- {
692- Enabled = m . IsBasePriceEnabled ,
693- Info = m . BasePriceInfo
694- } ,
695- Old = new
696- {
697- Value = decimal . Zero ,
698- Text = m . ProductPrice . OldPrice
699- } ,
700- WithoutDiscount = new
701- {
702- Value = m . ProductPrice . PriceValue ,
703- Text = m . ProductPrice . Price
704- } ,
705- WithDiscount = new
706- {
707- Value = m . ProductPrice . PriceWithDiscountValue ,
708- Text = m . ProductPrice . PriceWithDiscount
709- }
710- } ,
711- Stock = new
712- {
713- Quantity = new { Value = product . StockQuantity , Show = product . DisplayStockQuantity } ,
714- Availability = new { Text = m . StockAvailability , Show = product . DisplayStockAvailability , Available = m . IsAvailable }
715- } ,
716-
717- DynamicThumblUrl = dynamicThumbUrl ,
718- GalleryStartIndex = galleryStartIndex ,
719- GalleryHtml = galleryHtml
720- } ;
677+ object data = new
678+ {
679+ Delivery = new
680+ {
681+ Id = 0 ,
682+ Name = m . DeliveryTimeName ,
683+ Color = m . DeliveryTimeHexValue ,
684+ DisplayAccordingToStock = m . DisplayDeliveryTimeAccordingToStock
685+ } ,
686+ Measure = new
687+ {
688+ Weight = new { Value = m . WeightValue , Text = m . Weight } ,
689+ Height = new { Value = product . Height , Text = m . Height } ,
690+ Width = new { Value = product . Width , Text = m . Width } ,
691+ Length = new { Value = product . Length , Text = m . Length }
692+ } ,
693+ Number = new
694+ {
695+ Sku = new { Value = m . Sku , Show = m . ShowSku } ,
696+ Gtin = new { Value = m . Gtin , Show = m . ShowGtin } ,
697+ Mpn = new { Value = m . ManufacturerPartNumber , Show = m . ShowManufacturerPartNumber }
698+ } ,
699+ Price = new
700+ {
701+ Base = new
702+ {
703+ Enabled = m . IsBasePriceEnabled ,
704+ Info = m . BasePriceInfo
705+ } ,
706+ Old = new
707+ {
708+ Value = decimal . Zero ,
709+ Text = m . ProductPrice . OldPrice
710+ } ,
711+ WithoutDiscount = new
712+ {
713+ Value = m . ProductPrice . PriceValue ,
714+ Text = m . ProductPrice . Price
715+ } ,
716+ WithDiscount = new
717+ {
718+ Value = m . ProductPrice . PriceWithDiscountValue ,
719+ Text = m . ProductPrice . PriceWithDiscount
720+ }
721+ } ,
722+ Stock = new
723+ {
724+ Quantity = new {
725+ Value = product . StockQuantity ,
726+ Show = _shoppingCartService . AreAllAttributesForCombinationSelected ( attributeXml , product ) ? product . DisplayStockQuantity : false
727+ } ,
728+ Availability = new {
729+ Text = m . StockAvailability ,
730+ Show = _shoppingCartService . AreAllAttributesForCombinationSelected ( attributeXml , product ) ? product . DisplayStockAvailability : false ,
731+ Available = m . IsAvailable }
732+ } ,
733+
734+ DynamicThumblUrl = dynamicThumbUrl ,
735+ GalleryStartIndex = galleryStartIndex ,
736+ GalleryHtml = galleryHtml
737+ } ;
721738 #endregion
722739
723740 return new JsonResult { Data = data } ;
0 commit comments