|
30 | 30 | using SmartStore.Services.Security; |
31 | 31 | using SmartStore.Services.Shipping; |
32 | 32 | using SmartStore.Services.Tax; |
| 33 | +using SmartStore.Services.Seo; |
33 | 34 |
|
34 | 35 | namespace SmartStore.Services.Orders |
35 | 36 | { |
@@ -1082,6 +1083,37 @@ public virtual PlaceOrderResult PlaceOrder(ProcessPaymentRequest processPaymentR |
1082 | 1083 | LicenseDownloadId = 0, |
1083 | 1084 | ItemWeight = itemWeight, |
1084 | 1085 | }; |
| 1086 | + |
| 1087 | + if (sc.Product.ProductType == ProductType.BundledProduct && sc.ChildItems != null) |
| 1088 | + { |
| 1089 | + var listBundleData = new List<ProductBundleData>(); |
| 1090 | + |
| 1091 | + foreach (var childItem in sc.ChildItems) |
| 1092 | + { |
| 1093 | + string bundleItemName = childItem.BundleItem.GetLocalized(x => x.Name); |
| 1094 | + |
| 1095 | + var bundleData = new ProductBundleData() |
| 1096 | + { |
| 1097 | + Sku = childItem.Product.Sku, |
| 1098 | + ProductName = (bundleItemName ?? childItem.Product.GetLocalized(x => x.Name)), |
| 1099 | + ProductSeName = childItem.Product.GetSeName(), |
| 1100 | + VisibleIndividually = childItem.Product.VisibleIndividually, |
| 1101 | + Quantity = childItem.BundleItem.Quantity, |
| 1102 | + DisplayOrder = childItem.BundleItem.DisplayOrder |
| 1103 | + }; |
| 1104 | + |
| 1105 | + bundleData.AttributesInfo = _productAttributeFormatter.FormatAttributes(childItem.Product, childItem.AttributesXml, order.Customer, |
| 1106 | + renderPrices: false, renderGiftCardAttributes: false, allowHyperlinks: false); |
| 1107 | + |
| 1108 | + decimal bundleItemSubTotalWithDiscountBase = _taxService.GetProductPrice(childItem.Product, _priceCalculationService.GetSubTotal(childItem, true), out taxRate); |
| 1109 | + bundleData.PriceWithDiscount = _currencyService.ConvertFromPrimaryStoreCurrency(bundleItemSubTotalWithDiscountBase, _workContext.WorkingCurrency); |
| 1110 | + |
| 1111 | + listBundleData.Add(bundleData); |
| 1112 | + } |
| 1113 | + |
| 1114 | + orderItem.SetBundleData(listBundleData); |
| 1115 | + } |
| 1116 | + |
1085 | 1117 | order.OrderItems.Add(orderItem); |
1086 | 1118 | _orderService.UpdateOrder(order); |
1087 | 1119 |
|
@@ -1146,7 +1178,8 @@ public virtual PlaceOrderResult PlaceOrder(ProcessPaymentRequest processPaymentR |
1146 | 1178 | DownloadCount = 0, |
1147 | 1179 | IsDownloadActivated = false, |
1148 | 1180 | LicenseDownloadId = 0, |
1149 | | - ItemWeight = orderItem.ItemWeight |
| 1181 | + ItemWeight = orderItem.ItemWeight, |
| 1182 | + BundleData = orderItem.BundleData |
1150 | 1183 | }; |
1151 | 1184 | order.OrderItems.Add(newOrderItem); |
1152 | 1185 | _orderService.UpdateOrder(order); |
|
0 commit comments