Esempio n. 1
0
        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            _amazonContext.Install();
            var settings = new AffiliateAmazonSettings
            {
                Version  = "2013-08-01",
                Endpoint = "webservices.amazon.com",
                Service  = "AWSECommerceService"
            };

            _schedualTaskService.InsertTask(new Nop.Core.Domain.Tasks.ScheduleTask()
            {
                Enabled     = true,
                Name        = "Product Update",
                Seconds     = 86400,
                StopOnError = false,
                Type        = "Nop.Plugin.Affiliate.Amazon.AffiliateAmazonTask, Nop.Plugin.Affiliate.Amazon"
            });
            _settingService.SaveSetting(settings);
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon", "Amazon");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Sync", "Sync");

            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Setting", "Setting");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Service", "Service Name");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.AssociateTag", "Associate Tag");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.AWSAccessKeyID", "AWS Access Key ID");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.AWSSecretKey", "AWS Secret Key");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Endpoint", "Endpoint");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Version", "Version");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Durations", "Durations");

            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Imported", "Imported");

            //Category
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category", "Category");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.CategoryID", "Category ID");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.BrowseNodeID", "Browse Node ID");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.Name", "Name");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.ParentBrowseNodeId", "Parent Browse Node ID");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.IsCategoryRoot", "Is Category Root");



            //Product
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Product", "Product");

            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item", "Item");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.ASIN", "ASIN");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.ParentASIN", "Parent ASIN");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.DetailUrl", "Detail Url");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.Images", "Images");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.Title", "Title");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.Price", "Price");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Item.CurrenceCode", "Currence Code");

            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.CategoryName", "Category Name");
            this.AddOrUpdatePluginLocaleResource("Nop.Plugin.Affiliate.Amazon.Category.CompareType", "Type");

            base.Install();
        }
Esempio n. 2
0
        private AffAmazonContext()
        {
            var settingService = EngineContext.Current.Resolve <ISettingService>();
            AffiliateAmazonSettings amazonSettings = settingService.LoadSetting <AffiliateAmazonSettings>();

            if (amazonSettings != null)
            {
                accounts = new List <AffAmazonAccount>();
                var list = !string.IsNullOrEmpty(amazonSettings.Accounts) && !string.IsNullOrWhiteSpace(amazonSettings.Accounts) ? JsonConvert.DeserializeObject <List <AffiliateAmazonAccount> >(amazonSettings.Accounts) : new List <AffiliateAmazonAccount>();
                if (list != null)
                {
                    list.ForEach(x =>
                    {
                        if (x.IsActive)
                        {
                            var account = new AffAmazonAccount
                            {
                                AccessKeyID  = x.AccessKeyID,
                                AssociateTag = x.AssociateTag,
                                SecretKey    = x.SecretKey,
                            };
                            accounts.Add(account);
                        }
                    });
                }
                service   = amazonSettings.Service;
                endpoint  = amazonSettings.Endpoint;
                version   = amazonSettings.Version;
                durations = amazonSettings.Durations;
                var context = HttpContext.Current;
                folder = amazonSettings.Folder;
            }
        }
Esempio n. 3
0
 public AffiliateAmazonPlugin(AmazonObjectContext amazonContext, ISettingService settingService, AffiliateAmazonSettings amazonSettings, ILocalizationService localizationService, IScheduleTaskService schedualTaskService)
 {
     this._amazonContext       = amazonContext;
     this._settingService      = settingService;
     this._amazonSettings      = amazonSettings;
     this._localizationService = localizationService;
     this._schedualTaskService = schedualTaskService;
 }