public ActionResult Configure()
        {
            var model = new FeedFroogleModel();

            //picture
            model.ProductPictureSize = _froogleSettings.ProductPictureSize;
            //stores
            model.StoreId = _froogleSettings.StoreId;
            model.AvailableStores.Add(new SelectListItem()
            {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            foreach (var s in _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem()
                {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //currencies
            model.CurrencyId = _froogleSettings.CurrencyId;
            foreach (var c in _currencyService.GetAllCurrencies())
            {
                model.AvailableCurrencies.Add(new SelectListItem()
                {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //Google categories
            model.DefaultGoogleCategory = _froogleSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem()
            {
                Text = "Select a category", Value = ""
            });
            foreach (var gc in _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem()
                {
                    Text = gc, Value = gc
                });
            }

            //file paths
            foreach (var store in _storeService.GetAllStores())
            {
                var localFilePath = System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "content\\files\\exportimport", store.Id + "-" + _froogleSettings.StaticFileName);
                if (System.IO.File.Exists(localFilePath))
                {
                    model.GeneratedFiles.Add(new FeedFroogleModel.GeneratedFileModel()
                    {
                        StoreName = store.Name,
                        FileUrl   = string.Format("{0}content/files/exportimport/{1}-{2}", _webHelper.GetStoreLocation(false), store.Id, _froogleSettings.StaticFileName)
                    });
                }
            }

            return(View("~/Plugins/Feed.Froogle/Views/FeedFroogle/Configure.cshtml", model));
        }
        public ActionResult Configure()
        {
            var model = new FeedFroogleModel();

            //Picture
            model.ProductPictureSize = _froogleSettings.ProductPictureSize;
            //Currency
            model.CurrencyId = _froogleSettings.CurrencyId;
            foreach (var c in _currencyService.GetAllCurrencies(false))
            {
                model.AvailableCurrencies.Add(new SelectListItem()
                {
                    Text  = c.Name,
                    Value = c.Id.ToString()
                });
            }
            //Google category
            model.DefaultGoogleCategory = _froogleSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem()
            {
                Text  = "Select a category",
                Value = ""
            });
            foreach (var gc in _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem()
                {
                    Text  = gc,
                    Value = gc
                });
            }
            //FTP settings
            model.FtpHostname = _froogleSettings.FtpHostname;
            model.FtpFilename = _froogleSettings.FtpFilename;
            model.FtpUsername = _froogleSettings.FtpUsername;
            model.FtpPassword = _froogleSettings.FtpPassword;

            //task
            ScheduleTask task = FindScheduledTask();

            if (task != null)
            {
                model.GenerateStaticFileEachMinutes = task.Seconds / 60;
                model.TaskEnabled = task.Enabled;
            }
            //file path
            if (System.IO.File.Exists(System.IO.Path.Combine(HttpRuntime.AppDomainAppPath, "content\\files\\exportimport", _froogleSettings.StaticFileName)))
            {
                model.StaticFilePath = string.Format("{0}content/files/exportimport/{1}", _webHelper.GetStoreLocation(false), _froogleSettings.StaticFileName);
            }

            return(View("Nop.Plugin.Feed.Froogle.Views.FeedFroogle.Configure", model));
        }
        public IActionResult Configure()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return(AccessDeniedView());
            }

            var model = new FeedGoogleShoppingModel();

            model.ProductPictureSize         = _googleShoppingSettings.ProductPictureSize;
            model.PassShippingInfoWeight     = _googleShoppingSettings.PassShippingInfoWeight;
            model.PassShippingInfoDimensions = _googleShoppingSettings.PassShippingInfoDimensions;
            model.PricesConsiderPromotions   = _googleShoppingSettings.PricesConsiderPromotions;
            //stores
            model.StoreId = _googleShoppingSettings.StoreId;
            model.AvailableStores.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = "0"
            });
            foreach (var s in _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //currencies
            model.CurrencyId = _googleShoppingSettings.CurrencyId;
            foreach (var c in _currencyService.GetAllCurrencies())
            {
                model.AvailableCurrencies.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //Google categories
            model.DefaultGoogleCategory = _googleShoppingSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem {
                Text = "Select a category", Value = ""
            });
            foreach (var gc in _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem {
                    Text = gc, Value = gc
                });
            }

            //file paths
            foreach (var store in _storeService.GetAllStores())
            {
                var localFilePath = System.IO.Path.Combine(_hostingEnvironment.WebRootPath, "files\\exportimport", store.Id + "-" + _googleShoppingSettings.StaticFileName);
                if (System.IO.File.Exists(localFilePath))
                {
                    model.GeneratedFiles.Add(new FeedGoogleShoppingModel.GeneratedFileModel
                    {
                        StoreName = store.Name,
                        FileUrl   = $"{_webHelper.GetStoreLocation(false)}files/exportimport/{store.Id}-{_googleShoppingSettings.StaticFileName}"
                    });
                }
            }

            return(View("~/Plugins/Feed.GoogleShopping/Views/Configure.cshtml", model));
        }
        public async Task <IActionResult> Configure()
        {
            var model = new FeedGoogleShoppingModel();

            model.ProductPictureSize         = _GoogleShoppingSettings.ProductPictureSize;
            model.PassShippingInfoWeight     = _GoogleShoppingSettings.PassShippingInfoWeight;
            model.PassShippingInfoDimensions = _GoogleShoppingSettings.PassShippingInfoDimensions;
            model.PricesConsiderPromotions   = _GoogleShoppingSettings.PricesConsiderPromotions;
            //stores
            model.StoreId = _GoogleShoppingSettings.StoreId;
            model.AvailableStores.Add(new SelectListItem {
                Text = _localizationService.GetResource("Admin.Common.All"), Value = ""
            });
            foreach (var s in await _storeService.GetAllStores())
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //currencies
            model.CurrencyId = _GoogleShoppingSettings.CurrencyId;
            foreach (var c in await _currencyService.GetAllCurrencies())
            {
                model.AvailableCurrencies.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //Google categories
            model.DefaultGoogleCategory = _GoogleShoppingSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem {
                Text = "Select a category", Value = ""
            });
            foreach (var gc in await _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem {
                    Text = gc, Value = gc
                });
            }

            //file paths
            foreach (var store in await _storeService.GetAllStores())
            {
                var appPath       = CommonHelper.MapPath("wwwroot/content/files/exportimport");
                var localFilePath = System.IO.Path.Combine(appPath, store.Id + "-" + _GoogleShoppingSettings.StaticFileName);
                if (System.IO.File.Exists(localFilePath))
                {
                    model.GeneratedFiles.Add(new FeedGoogleShoppingModel.GeneratedFileModel
                    {
                        StoreName = store.Name,
                        FileUrl   = string.Format("{0}content/files/exportimport/{1}-{2}", _webHelper.GetStoreLocation(false), store.Id, _GoogleShoppingSettings.StaticFileName)
                    });
                }
            }

            return(View("~/Plugins/Feed.GoogleShopping/Views/FeedGoogleShopping/Configure.cshtml", model));
        }
        public ActionResult Configure()
        {
            var model = new FeedFroogleModel();

            //Picture
            model.ProductPictureSize = _froogleSettings.ProductPictureSize;
            //Currency
            model.CurrencyId = _froogleSettings.CurrencyId;
            foreach (var c in _currencyService.GetAllCurrencies(false))
            {
                model.AvailableCurrencies.Add(new SelectListItem()
                {
                    Text  = c.Name,
                    Value = c.Id.ToString()
                });
            }
            //Google category
            model.DefaultGoogleCategory = _froogleSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem()
            {
                Text  = "Select a category",
                Value = ""
            });
            foreach (var gc in _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem()
                {
                    Text  = gc,
                    Value = gc
                });
            }
            //FTP settings
            model.FtpHostname = _froogleSettings.FtpHostname;
            model.FtpFilename = _froogleSettings.FtpFilename;
            model.FtpUsername = _froogleSettings.FtpUsername;
            model.FtpPassword = _froogleSettings.FtpPassword;

            return(View("Nop.Plugin.Feed.Froogle.Views.FeedFroogle.Configure", model));
        }
Exemple #6
0
        public IActionResult Configure()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return(AccessDeniedView());
            }

            //load settings for a chosen store scope
            var storeScope             = _storeContext.ActiveStoreScopeConfiguration;
            var googleShoppingSettings = _settingService.LoadSetting <GoogleShoppingSettings>(storeScope);

            var model = new FeedGoogleShoppingModel();

            model.ProductPictureSize         = googleShoppingSettings.ProductPictureSize;
            model.PassShippingInfoWeight     = googleShoppingSettings.PassShippingInfoWeight;
            model.PassShippingInfoDimensions = googleShoppingSettings.PassShippingInfoDimensions;
            model.PricesConsiderPromotions   = googleShoppingSettings.PricesConsiderPromotions;

            //currencies
            model.CurrencyId = googleShoppingSettings.CurrencyId;
            foreach (var c in _currencyService.GetAllCurrencies())
            {
                model.AvailableCurrencies.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //Google categories
            model.DefaultGoogleCategory = googleShoppingSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem {
                Text = "Select a category", Value = ""
            });
            foreach (var gc in _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem {
                    Text = gc, Value = gc
                });
            }

            //file paths
            foreach (var store in _storeService.GetAllStores())
            {
                var localFilePath = System.IO.Path.Combine(_hostingEnvironment.WebRootPath, "files\\exportimport", store.Id + "-" + googleShoppingSettings.StaticFileName);
                if (System.IO.File.Exists(localFilePath))
                {
                    model.GeneratedFiles.Add(new FeedGoogleShoppingModel.GeneratedFileModel
                    {
                        StoreName = store.Name,
                        FileUrl   = $"{_webHelper.GetStoreLocation(false)}files/exportimport/{store.Id}-{googleShoppingSettings.StaticFileName}"
                    });
                }
            }

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.CurrencyId_OverrideForStore                 = _settingService.SettingExists(googleShoppingSettings, x => x.CurrencyId, storeScope);
                model.DefaultGoogleCategory_OverrideForStore      = _settingService.SettingExists(googleShoppingSettings, x => x.DefaultGoogleCategory, storeScope);
                model.PassShippingInfoDimensions_OverrideForStore = _settingService.SettingExists(googleShoppingSettings, x => x.PassShippingInfoDimensions, storeScope);
                model.PassShippingInfoWeight_OverrideForStore     = _settingService.SettingExists(googleShoppingSettings, x => x.PassShippingInfoWeight, storeScope);
                model.PricesConsiderPromotions_OverrideForStore   = _settingService.SettingExists(googleShoppingSettings, x => x.PricesConsiderPromotions, storeScope);
                model.ProductPictureSize_OverrideForStore         = _settingService.SettingExists(googleShoppingSettings, x => x.ProductPictureSize, storeScope);
            }

            return(View("~/Plugins/Feed.GoogleShopping/Views/Configure.cshtml", model));
        }
Exemple #7
0
        /// <summary>
        /// Prepare FeedGoogleShoppingModel
        /// </summary>
        /// <param name="model">Model</param>
        private void PrepareModel(FeedGoogleShoppingModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePlugins))
            {
                return;
            }

            //load settings for a chosen store scope
            var storeScope             = _storeContext.ActiveStoreScopeConfiguration;
            var googleShoppingSettings = _settingService.LoadSetting <GoogleShoppingSettings>(storeScope);

            model.ProductPictureSize         = googleShoppingSettings.ProductPictureSize;
            model.PassShippingInfoWeight     = googleShoppingSettings.PassShippingInfoWeight;
            model.PassShippingInfoDimensions = googleShoppingSettings.PassShippingInfoDimensions;
            model.PricesConsiderPromotions   = googleShoppingSettings.PricesConsiderPromotions;

            //currencies
            model.CurrencyId = googleShoppingSettings.CurrencyId;
            foreach (var c in _currencyService.GetAllCurrencies())
            {
                model.AvailableCurrencies.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //Google categories
            model.DefaultGoogleCategory = googleShoppingSettings.DefaultGoogleCategory;
            model.AvailableGoogleCategories.Add(new SelectListItem {
                Text = "Select a category", Value = ""
            });
            foreach (var gc in _googleService.GetTaxonomyList())
            {
                model.AvailableGoogleCategories.Add(new SelectListItem {
                    Text = gc, Value = gc
                });
            }

            model.HideGeneralBlock         = _genericAttributeService.GetAttribute <bool>(_workContext.CurrentCustomer, GoogleShoppingDefaults.HideGeneralBlock);
            model.HideProductSettingsBlock = _genericAttributeService.GetAttribute <bool>(_workContext.CurrentCustomer, GoogleShoppingDefaults.HideProductSettingsBlock);

            //prepare nested search models
            model.GoogleProductSearchModel.SetGridPageSize();

            //file paths
            foreach (var store in _storeService.GetAllStores())
            {
                var localFilePath = System.IO.Path.Combine(_hostingEnvironment.WebRootPath, "files\\exportimport", store.Id + "-" + googleShoppingSettings.StaticFileName);
                if (System.IO.File.Exists(localFilePath))
                {
                    model.GeneratedFiles.Add(new GeneratedFileModel
                    {
                        StoreName = store.Name,
                        FileUrl   = $"{_webHelper.GetStoreLocation(false)}files/exportimport/{store.Id}-{googleShoppingSettings.StaticFileName}"
                    });
                }
            }

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.CurrencyId_OverrideForStore                 = _settingService.SettingExists(googleShoppingSettings, x => x.CurrencyId, storeScope);
                model.DefaultGoogleCategory_OverrideForStore      = _settingService.SettingExists(googleShoppingSettings, x => x.DefaultGoogleCategory, storeScope);
                model.PassShippingInfoDimensions_OverrideForStore = _settingService.SettingExists(googleShoppingSettings, x => x.PassShippingInfoDimensions, storeScope);
                model.PassShippingInfoWeight_OverrideForStore     = _settingService.SettingExists(googleShoppingSettings, x => x.PassShippingInfoWeight, storeScope);
                model.PricesConsiderPromotions_OverrideForStore   = _settingService.SettingExists(googleShoppingSettings, x => x.PricesConsiderPromotions, storeScope);
                model.ProductPictureSize_OverrideForStore         = _settingService.SettingExists(googleShoppingSettings, x => x.ProductPictureSize, storeScope);
            }
        }