|
5 | 5 | using System.Web.Mvc; |
6 | 6 | using SmartStore.Core; |
7 | 7 | using SmartStore.Core.Domain; |
| 8 | +using SmartStore.Core.Domain.Catalog; |
8 | 9 | using SmartStore.Core.Domain.Orders; |
9 | 10 | using SmartStore.Plugin.Widgets.GoogleAnalytics.Models; |
10 | 11 | using SmartStore.Services.Catalog; |
@@ -213,14 +214,14 @@ private string GetEcommerceScript(Order order) |
213 | 214 | string analyticsEcommerceDetailScript = googleAnalyticsSettings.EcommerceDetailScript; |
214 | 215 | //get category |
215 | 216 | string categ = ""; |
216 | | - var defaultProductCategory = _categoryService.GetProductCategoriesByProductId(item.ProductVariant.ProductId).FirstOrDefault(); |
| 217 | + var defaultProductCategory = _categoryService.GetProductCategoriesByProductId(item.ProductId).FirstOrDefault(); |
217 | 218 | if (defaultProductCategory != null) |
218 | 219 | categ = defaultProductCategory.Category.Name; |
219 | 220 | analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{ORDERID}", order.GetOrderNumber()); |
220 | 221 | //The SKU code is a required parameter for every item that is added to the transaction |
221 | | - item.ProductVariant.MergeWithCombination(item.AttributesXml); |
222 | | - analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTSKU}", FixIllegalJavaScriptChars(item.ProductVariant.Sku)); |
223 | | - analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTNAME}", FixIllegalJavaScriptChars(item.ProductVariant.FullProductName)); |
| 222 | + ((IProduct)item.Product).MergeWithCombination(item.AttributesXml); |
| 223 | + analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTSKU}", FixIllegalJavaScriptChars(item.Product.Sku)); |
| 224 | + analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{PRODUCTNAME}", FixIllegalJavaScriptChars(item.Product.Name)); |
224 | 225 | analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{CATEGORYNAME}", FixIllegalJavaScriptChars(categ)); |
225 | 226 | analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{UNITPRICE}", item.UnitPriceInclTax.ToString("0.00", usCulture)); |
226 | 227 | analyticsEcommerceDetailScript = analyticsEcommerceDetailScript.Replace("{QUANTITY}", item.Quantity.ToString()); |
|
0 commit comments