示例#1
0
        public SmartSearchPlugin(ISettingService settingService
                                 , IProductService productService, ICategoryService categoryService
                                 , IRepository <Order> orderRepository, IPictureService pictureService
                                 , IScheduleTaskService scheduleTaskService, SmartSearchSettings smartSearchSettings
                                 , ILogger logger
                                 , ICacheManager cacheManager
                                 , ILocalizationService localizationService
                                 , MediaSettings mediaSettings
                                 , IWorkContext workContext
                                 , IStoreContext storeContext
                                 , IWebHelper webHelper)
        {
            _settingsService     = settingService;
            _productService      = productService;
            _categoryService     = categoryService;
            _orderRepository     = orderRepository;
            _pictureService      = pictureService;
            _scheduleTaskService = scheduleTaskService;
            _smartSearchSettings = smartSearchSettings;
            _logger = logger;

            _cacheManager        = cacheManager;
            _localizationService = localizationService;
            _mediaSettings       = mediaSettings;
            _workContext         = workContext;
            _storeContext        = storeContext;
            _webHelper           = webHelper;
        }
示例#2
0
        public override void Install()
        {
            #region Create Localization String Resources
            this.AddOrUpdatePluginLocaleResource("ShoppingCart.Options", "Options");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.AppendDateToFileName", "Append DateTime to FileName:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.AppendDateToFileName.hint", "Appends date and time to the end of the SmartSearch feed file name");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FilePath", "FilePath:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FilePath.hint", "SmartSearch feed file path");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FileName", "FileName:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FileName.hint", "SmartSearch feed file name");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.SmartSearchKey", "SmartSearch Key:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.SmartSearchKey.hint", "Key for SmartSearch");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.SmartSearchUrl", "SmartSearch URL:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.SmartSearchUrl.hint", "Base url for SmartSearch. Example: http://www.smartsearch.com");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.ImageSize", "Image size:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.ImageSize.hint", "Scaled image size for product images displayed in search results");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.IconImageSize", "Icon image size:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.IconImageSize.hint", "Scaled image size for product icon images displayed in search results. This is also used the image size that is used in auto complete");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FtpAddress", "FTP Address:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FtpAddress.hint", "The FTP address where the Smart Search feed will be sent.");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FtpPort", "FTP Port:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.FtpPort.hint", "The Port for the FTP address where the Smart Search feed will be sent");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.Username", "FTP Username:"******"Plugins.Search.SmartSearch.Username.hint", "FTP account username");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.Password", "FTP Password:"******"Plugins.Search.SmartSearch.Password.hint", "FTP account password");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.AutoFtp", "Enable Auto FTP:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.AutoFtp.hint", "Allows the smart search feed to be sent to the smart search server during the automated task execution");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.Enabled", "Enabled:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.Enabled.hint", "Enable or disable plugin");

            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.ConfigurationStatus", "Configuration status:");
            this.AddOrUpdatePluginLocaleResource("Plugins.Search.SmartSearch.ConfigurationStatus.hint", "Specifies if communicating with Hosted SmartSearch");

            const string searchSortingEnum = "Enums.Moco.Plugin.Search.SmartSearch.Models.SearchSortingEnum.{0}";
            this.AddOrUpdatePluginLocaleResource(string.Format(searchSortingEnum, "Relevance"), "Relevance");
            this.AddOrUpdatePluginLocaleResource(string.Format(searchSortingEnum, "HighestRated"), "Highest Rated");
            this.AddOrUpdatePluginLocaleResource(string.Format(searchSortingEnum, "BestSellers"), "Best Sellers");
            this.AddOrUpdatePluginLocaleResource(string.Format(searchSortingEnum, "NewArrivals"), "New Arrivals");
            this.AddOrUpdatePluginLocaleResource(string.Format(searchSortingEnum, "LowestPrice"), "Lowest Price");
            this.AddOrUpdatePluginLocaleResource(string.Format(searchSortingEnum, "HighestPrice"), "Highest Price");

            #endregion

            #region Create Settings
            var settings = new SmartSearchSettings()
            {
                AppendDateToFileName = false,
                FileName             = "ssFeed.xml",
                //	FilePath = Path.Combine(HttpRuntime.AppDomainAppPath, @"Content\files\"),
                SmartSearchUrl = "",
                SmartSearchKey = String.Empty,
                ImageSize      = 415,
                ImageIconSize  = 150,
                FtpAddress     = String.Empty,
                FtpPort        = 21,
                Username       = "******",
                Password       = String.Empty,
            };
            _settingsService.SaveSetting(settings);
            #endregion

            #region Install Scheduled Tasks

            /* Not Needed
             * var task = FindScheduledTask();
             * if (task == null)
             * {
             *      task = new ScheduleTask
             *      {
             *              Name = "Smart Search Automation",
             *              //each 60 minutes
             *              Seconds = 3200,
             *              Type = "Moco.Plugin.Search.SmartSearch.SmartSearchTask, Moco.Plugin.Search.SmartSearch",
             *              //The task should be Enabled in the configuration view,, but for testing, it is enabled during installation
             *              Enabled = true,
             *              StopOnError = false,
             *      };
             *      _scheduleTaskService.InsertTask(task);
             * }
             * */
            #endregion

            base.Install();
        }