/// <summary> /// Install plugin /// </summary> public override void Install() { //settings var settings = new FixedOrByWeightSettings { LimitMethodsToCreated = false, ShippingByWeightEnabled = false }; _settingService.SaveSetting(settings); //database objects _objectContext.Install(); //locales this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.ShippingByWeight", "By Weight"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fixed", "Fixed Rate"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Rate", "Rate"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Store", "Store"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Store.Hint", "If an asterisk is selected, then this shipping rate will apply to all stores."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Warehouse", "Warehouse"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Warehouse.Hint", "If an asterisk is selected, then this shipping rate will apply to all warehouses."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Country", "Country"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Country.Hint", "If an asterisk is selected, then this shipping rate will apply to all customers, regardless of the country."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.StateProvince", "State / province"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.StateProvince.Hint", "If an asterisk is selected, then this shipping rate will apply to all customers from the given country, regardless of the state."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Zip", "Zip"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.Zip.Hint", "Zip / postal code. If zip is empty, then this shipping rate will apply to all customers from the given country or state, regardless of the zip code."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod", "Shipping method"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.ShippingMethod.Hint", "Choose shipping method"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.From", "Order weight from"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.From.Hint", "Order weight from."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.To", "Order weight to"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.To.Hint", "Order weight to."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost", "Additional fixed cost"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.AdditionalFixedCost.Hint", "Specify an additional fixed cost per shopping cart for this option. Set to 0 if you don't want an additional fixed cost to be applied."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit", "Lower weight limit"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LowerWeightLimit.Hint", "Lower weight limit. This field can be used for \"per extra weight unit\" scenarios."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal", "Charge percentage (of subtotal)"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.PercentageRateOfSubtotal.Hint", "Charge percentage (of subtotal)."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit", "Rate per weight unit"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.RatePerWeightUnit.Hint", "Rate per weight unit."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LimitMethodsToCreated", "Limit shipping methods to configured ones"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.LimitMethodsToCreated.Hint", "If you check this option, then your customers will be limited to shipping options configured here. Otherwise, they'll be able to choose any existing shipping options even they've not configured here (zero shipping fee in this case)."); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Fields.DataHtml", "Data"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.AddRecord", "Add record"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Formula", "Formula to calculate rates"); this.AddOrUpdatePluginLocaleResource("Plugins.Shipping.FixedOrByWeight.Formula.Value", "[additional fixed cost] + ([order total weight] - [lower weight limit]) * [rate per weight unit] + [order subtotal] * [charge percentage]"); base.Install(); }
public FixedOrByWeightComputationMethod(ISettingService settingService, IShippingService shippingService, FixedOrByWeightSettings fixedOrByWeightSettings, IShippingByWeightService shippingByWeightService, IStoreContext storeContext, IPriceCalculationService priceCalculationService, ShippingByWeightObjectContext objectContext) { this._settingService = settingService; this._shippingService = shippingService; this._fixedOrByWeightSettings = fixedOrByWeightSettings; this._shippingByWeightService = shippingByWeightService; this._storeContext = storeContext; this._priceCalculationService = priceCalculationService; this._objectContext = objectContext; }
public FixedOrByWeightComputationMethod(FixedOrByWeightSettings fixedOrByWeightSettings, IPriceCalculationService priceCalculationService, IProductAttributeParser productAttributeParser, IProductService productService, ISettingService settingService, IShippingByWeightService shippingByWeightService, IShippingService shippingService, IStoreContext storeContext, IWebHelper webHelper, ShippingByWeightObjectContext objectContext) { this._fixedOrByWeightSettings = fixedOrByWeightSettings; this._priceCalculationService = priceCalculationService; this._productAttributeParser = productAttributeParser; this._productService = productService; this._settingService = settingService; this._shippingByWeightService = shippingByWeightService; this._shippingService = shippingService; this._storeContext = storeContext; this._webHelper = webHelper; this._objectContext = objectContext; }