Пример #1
0
        /// <summary>
        /// Add cookie value for the compared products
        /// </summary>
        /// <param name="comparedProductIds">Collection of compared products identifiers</param>
        protected async Task AddCompareProductsCookie(IEnumerable <int> comparedProductIds)
        {
            //delete current cookie if exists
            var cookieName = $"{NopCookieDefaults.Prefix}{NopCookieDefaults.ComparedProductsCookie}";
            await _jsService.EraseCookie(cookieName);

            //create cookie value
            var comparedProductIdsCookie = string.Join(",", comparedProductIds);

            //create cookie options
            var cookieExpires = 24 * 10; //TODO make configurable
            await _jsService.SetCookie(cookieName, comparedProductIdsCookie, cookieExpires);
        }