Example #1
0
        public ManagerResponse <CatalogResult, bool> SortOrderApplied(string sortKey, SortDirection?sortDirection)
        {
            var connectSortDirection = SortDirection.Ascending;

            if (sortDirection.HasValue)
            {
                switch (sortDirection.Value)
                {
                case SortDirection.Ascending:
                    connectSortDirection = SortDirection.Ascending;
                    break;

                case SortDirection.Descending:
                    connectSortDirection = SortDirection.Descending;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            if (StorefrontContext.Current == null)
            {
                throw new InvalidOperationException("Cannot be called without a valid storefront context.");
            }

            var request = new ProductSortingRequest(StorefrontContext.Current.ShopName, sortKey, connectSortDirection == SortDirection.Ascending ? Sitecore.Commerce.Entities.Catalog.SortDirection.Ascending : Sitecore.Commerce.Entities.Catalog.SortDirection.Descending);
            var result  = CatalogServiceProvider.ProductSorting(request);

            result.WriteToSitecoreLog();

            return(new ManagerResponse <CatalogResult, bool>(result, result.Success));
        }
 public AnalyticsManager(
     ILogService <CommonLog> logService,
     IConnectServiceProvider connectServiceProvider) : base(logService)
 {
     Assert.ArgumentNotNull(connectServiceProvider, nameof(connectServiceProvider));
     this.catalogServiceProvider = connectServiceProvider.GetCatalogServiceProvider();
 }
Example #3
0
 public CatalogManager(CatalogServiceProvider catalogServiceProvider, GlobalizationServiceProvider globalizationServiceProvider, PricingManager pricingManager, InventoryManager inventoryManager, CatalogItemContext catalogItemContext, ICommerceSearchManager commerceSearchManager, StorefrontContext storefrontContext)
 {
     CatalogServiceProvider       = catalogServiceProvider;
     GlobalizationServiceProvider = globalizationServiceProvider;
     PricingManager        = pricingManager;
     InventoryManager      = inventoryManager;
     CatalogItemContext    = catalogItemContext;
     CommerceSearchManager = commerceSearchManager;
     StorefrontContext     = storefrontContext;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CatalogManager" /> class.
        /// </summary>
        /// <param name="catalogServiceProvider">The catalog service provider.</param>
        /// <param name="pricingManager">The pricing manager.</param>
        /// <param name="inventoryManager">The inventory manager.</param>
        public CatalogManager([NotNull] CatalogServiceProvider catalogServiceProvider, [NotNull] PricingManager pricingManager, [NotNull] InventoryManager inventoryManager)
        {
            Assert.ArgumentNotNull(catalogServiceProvider, "catalogServiceProvider");
            Assert.ArgumentNotNull(pricingManager, "pricingManager");
            Assert.ArgumentNotNull(inventoryManager, "inventoryManager");

            this.CatalogServiceProvider = catalogServiceProvider;
            this.PricingManager         = pricingManager;
            this.InventoryManager       = inventoryManager;
        }
Example #5
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));
        }
Example #6
0
        public ManagerResponse <CatalogResult, bool> FacetApplied(string facet, bool isApplied)
        {
            if (StorefrontContext.Current == null)
            {
                throw new InvalidOperationException("Cannot be called without a valid storefront context.");
            }

            var request = new FacetAppliedRequest(StorefrontContext.Current.ShopName, facet, isApplied);
            var result  = CatalogServiceProvider.FacetApplied(request);

            result.WriteToSitecoreLog();

            return(new ManagerResponse <CatalogResult, bool>(result, result.Success));
        }
Example #7
0
        public ManagerResponse <CatalogResult, bool> RegisterSearchEvent(string searchKeyword, int numberOfHits)
        {
            Assert.ArgumentNotNullOrEmpty(searchKeyword, nameof(searchKeyword));

            if (StorefrontContext.Current == null)
            {
                throw new InvalidOperationException("Cannot be called without a valid storefront context.");
            }

            var request = new SearchInitiatedRequest(StorefrontContext.Current.ShopName, searchKeyword, numberOfHits);
            var result  = CatalogServiceProvider.SearchInitiated(request);

            result.WriteToSitecoreLog();

            return(new ManagerResponse <CatalogResult, bool>(result, result.Success));
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CatalogService"/> class.
        /// </summary>
        /// <param name="catalogServiceProvider">The catalog service provider.</param>
        public CatalogService([NotNull] CatalogServiceProvider catalogServiceProvider)
        {
            Assert.IsNotNull(catalogServiceProvider, "catalogServiceProvider");

            this._catalogServiceProvider = catalogServiceProvider;
        }
Example #9
0
 public AnalyticsManager(IConnectServiceProvider connectServiceProvider)
 {
     Assert.ArgumentNotNull(connectServiceProvider, nameof(connectServiceProvider));
     this.catalogServiceProvider = connectServiceProvider.GetCatalogServiceProvider();
 }