public B2BCheckoutService(ITransactionService transactionService, ICommerceContext commerceContext, VisitorTrackingContext trackingContext, ColonyContext colonyContext, HttpContextBase context) { _transactionService = transactionService; _commerceContext = commerceContext; _colonyContext = colonyContext; _trackingContext = trackingContext; _context = context; this.DataCashId = AppSettingsHelper.GetSafeValue("DatacashID", string.Empty); this.DataCashPassword = AppSettingsHelper.GetSafeValue("DatacashPassword", string.Empty); this.DataCashPageSetId = AppSettingsHelper.GetSafeValue("DataCashPageSetId", 1); }
public VisitorsRepository(VisitorTrackingContext context) { _context = context; }
public override ActionResult Detail() { if (ColonyContext.Response.UrlExtension != null) { if ((ColonyContext.Response.UrlParts.Count > 1 && ColonyContext.Response.UrlParts[1] == "paint") || (ColonyContext.Response.UrlParts.Count == 1 && ColonyContext.Response.UrlExtensionParts[0] == "paint")) { ViewBag.IsPaint = true; var maxRelated = AppSettingsHelper.GetSafeValue <long>("MaxRelatedProducts", 50); var maxRecentlyViewedProducts = AppSettingsHelper.GetSafeValue("MaxRecentlyViewedProducts", 10); var viewModel = GetProductViewModelForProductDetail("paint/" + ColonyContext.Response.UrlExtension); if (viewModel != null) { if (viewModel.SelectedSku.IsOptionProduct != null) { if (viewModel.SelectedSku.IsOptionProduct.Equals("Y", StringComparison.OrdinalIgnoreCase)) { var parentSku = viewModel.Skus.FirstOrDefault(x => x.Sku.Id == viewModel.SelectedSku.ParentSkuId); if (parentSku != null) { var redirectUrl = new UriBuilder(ColonyContext.Response.Uri.AbsoluteUri); var query = HttpUtility.ParseQueryString(ColonyContext.Response.Uri.Query); query.Remove("code"); query.Add("code", parentSku.Sku.Code); redirectUrl.Query = query.ToString(); return(Redirect(redirectUrl.ToString())); } return(null); } } //else return null; var trackingEvent = ProductViewedTrackedEvent.Instance; trackingEvent.TrackedEntity = viewModel.Product; VisitorTrackingContext.TrackEvent(trackingEvent, Request.Url.AbsoluteUri); _productsService.AddRecentlyViewedProduct(VisitorTrackingContext.CurrentVisitor.Id, viewModel.Product); var breadcrumbDisplay = ""; if (viewModel.SelectedSku.Attributes["Descriptive Colour"] != null) { breadcrumbDisplay = viewModel.SelectedSku.Attributes["Descriptive Colour"]; } else { breadcrumbDisplay = "Paint"; } if (ViewBag.IsPaint) { ShopHelpers.SetBreadcrumbForProduct(viewModel.Product, breadcrumbDisplay); } else { ShopHelpers.SetBreadcrumbForProduct(viewModel.Product); } if (ColonyContext.Response.Breadcrumbs.Count >= 3) { ColonyContext.Response.Breadcrumbs.RemoveAt(ColonyContext.Response.Breadcrumbs.Count - 3); } Response.AddHeader("Cache-Control", "Cache-Control:public, max-age=1800"); return(PartialView("Detail", viewModel)); } return(null); } } return(base.Detail()); }