/// <summary>
        /// Registers an event specifying that the product details page has been visited.
        /// </summary>
        /// <param name="storefront">The storefront.</param>
        /// <param name="productId">the product id.</param>
        /// <param name="productName">Name of the product.</param>
        /// <param name="parentCategoryId">The parent category identifier.</param>
        /// <param name="parentCategoryName">the parent category name.</param>
        /// <returns>
        /// A <see cref="CatalogResult" /> specifying the result of the service request.
        /// </returns>
        public CatalogResult VisitedProductDetailsPage([NotNull] CommerceStorefront storefront, [NotNull] string productId, string productName, string parentCategoryId, string parentCategoryName)
        {
            Assert.ArgumentNotNull(storefront, "storefront");

            var request = new VisitedProductDetailsPageRequest(storefront.ShopName, productId, productName, parentCategoryId, parentCategoryName);

            return(this.CatalogServiceProvider.VisitedProductDetailsPage(request));
        }
Exemplo n.º 2
0
        public void VisitedProductDetailsPage(string shopName, string productId, string productName)
        {
            Assert.IsNotNullOrEmpty(productId, nameof(productId));
            Assert.IsNotNullOrEmpty(productName, nameof(productName));
            var request = new VisitedProductDetailsPageRequest(shopName, productId, productName, null, null);

            this.catalogServiceProvider.VisitedProductDetailsPage(request);
        }
Exemplo n.º 3
0
        public CatalogResult VisitedProductDetailsPage(string productId, string productName, string parentCategoryId, string parentCategoryName)
        {
            if (StorefrontContext.Current == null)
            {
                throw new InvalidOperationException("Cannot be called without a valid storefront context.");
            }

            var request = new VisitedProductDetailsPageRequest(StorefrontContext.Current.ShopName, productId, productName, parentCategoryId, parentCategoryName);

            return(CatalogServiceProvider.VisitedProductDetailsPage(request));
        }
        /// <summary>
        /// Visiteds the product details page.
        /// </summary>
        /// <param name="storefront">The storefront.</param>
        /// <returns>
        /// The manager response
        /// </returns>
        public virtual ManagerResponse <CatalogResult, bool> VisitedProductDetailsPage([NotNull] CommerceStorefront storefront)
        {
            Assert.ArgumentNotNull(storefront, "storefront");

            string productId          = CatalogUrlManager.ExtractItemIdFromCurrentUrl();
            string parentCategoryName = CatalogUrlManager.ExtractCategoryNameFromCurrentUrl();
            var    request            = new VisitedProductDetailsPageRequest(storefront.ShopName, productId, productId, parentCategoryName, parentCategoryName);

            var result = this.CatalogServiceProvider.VisitedProductDetailsPage(request);

            if (!result.Success)
            {
                Helpers.LogSystemMessages(result.SystemMessages, result);
            }

            return(new ManagerResponse <CatalogResult, bool>(result, result.Success));
        }
        /// <summary>
        /// Visiteds the product details page.
        /// </summary>
        /// <param name="storefront">The storefront.</param>
        /// <returns>
        /// The manager response
        /// </returns>
        public virtual ManagerResponse <CatalogResult, bool> VisitedProductDetailsPage([NotNull] CommerceStorefront storefront)
        {
            Assert.ArgumentNotNull(storefront, "storefront");

            string productId          = CatalogUrlManager.ExtractItemIdFromCurrentUrl();
            string parentCategoryName = CatalogUrlManager.ExtractCategoryNameFromCurrentUrl();
            var    request            = new VisitedProductDetailsPageRequest(storefront.ShopName, productId, productId, parentCategoryName, parentCategoryName);

            var result = this._catalogServiceProvider.VisitedProductDetailsPage(request);

            if (!result.Success)
            {
                _logger.LogInfo(string.Join(Environment.NewLine, result.SystemMessages.Select(m => m.Message)), this);
            }

            return(new ManagerResponse <CatalogResult, bool>(result, result.Success));
        }