--upgrade scripts from nopCommerce 2.10 to nopCommerce 2.20 --new locale resources declare @resources xml --a resource will be delete if its value is empty set @resources=' ''Products by tag'' page. Products per page Set the page size for products on ''Products by tag'' page. Picture Number of days that the return request is available Set a certain number of days that the Return Request Link will be available in the customer area. For example if the store owner allows returns within 30 days after purchase, then they would set this to 30. When the customer logs into the website and looks at "My Account" any orders completed more than 30 days ago would not show a Return Request button. Number of downloads: {0} Reset Click to reset download count Category template Choose a category template. This template defines how this category (and it''s products) will be displayed. Manufacturer template Choose a manufacturer template. This template defines how this manufacturer (and it''s products) will be displayed. Current wishlists Require other product variants are added to the cart Check if this product variant requires that other product variants are added to the cart. Required product variant IDs Specify comma separated list of required product variant IDs. NOTE: Ensure that there are no circular references (for example, A requires B, and B requires A). Automatically add these product variants to the cart Check to automatically add this product variants to the cart. This product requires the following product is added to the cart: {0} Bulk edit product variants Name SKU Price Old price Published Store closed Check to close the store. Uncheck to re-open. The credentials provided is incorrect Delete selected Public store Clear cache Restart application Logged in as: {0} Logout? Complete payment This order is not yet paid for. To pay now click the "Complete payment" button. Country ''Street address'' enabled Set if ''Street address'' is enabled. ''Street address 2'' enabled Set if ''Street address 2'' is enabled. ''Zip / postal code'' enabled Set if ''Zip / postal code'' is enabled. ''City'' enabled Set if ''City'' is enabled. ''Country'' enabled Set if ''Country'' is enabled. ''State/province'' enabled Set if ''State/province'' is enabled. ''Company'' enabled Set if ''Company'' is enabled. ''Phone number'' enabled Set if ''Phone number'' is enabled. ''Fax number'' enabled Set if ''Fax number'' is enabled. Address Address 2 Zip / postal code City State / province Phone Fax Your Address Your Contact Information Address The address. Address 2 The address 2. Zip / postal code The zip / postal code. City The city. Country The country. State / province The state / province. Phone The phone. Fax The fax. Select a billing address from your address book or enter a new address. Select a shipping address from your address book or enter a new address. Shipping method Payment method Payment information Confirm order Submitting order information... Confirm Loading next step... Back Show a share button Check to show share button on product details page. Max length of product review title is {0} chars Right-to-left Check to enable right-to-left support for this language. The active theme should support RTL (have appropriate CSS style file). And it affects only public store. Exchange rate must be greater than 0. {0} ({1} vote(s) - {2}%) Ignore tier prices (sitewide) Check to ignore tier prices (sitewide). It can significantly improve performance. Ignore discounts (sitewide) Check to ignore discounts (sitewide). It can significantly improve performance. Ignore featured products (sitewide) Check to ignore featured products (sitewide). It can significantly improve performance. Enable canonical URLs The goal of the canonicalization process is to transform a URL into a canonical URL so it is possible to determine if two syntactically different URLs may be equivalent. No products were found that matched your criteria. ' CREATE TABLE #LocaleStringResourceTmp ( [ResourceName] [nvarchar](200) NOT NULL, [ResourceValue] [nvarchar](max) NOT NULL ) INSERT INTO #LocaleStringResourceTmp (ResourceName, ResourceValue) SELECT nref.value('@Name', 'nvarchar(200)'), nref.value('Value[1]', 'nvarchar(MAX)') FROM @resources.nodes('//Language/LocaleResource') AS R(nref) --do it for each existing language DECLARE @ExistingLanguageID int DECLARE cur_existinglanguage CURSOR FOR SELECT [ID] FROM [Language] OPEN cur_existinglanguage FETCH NEXT FROM cur_existinglanguage INTO @ExistingLanguageID WHILE @@FETCH_STATUS = 0 BEGIN DECLARE @ResourceName nvarchar(200) DECLARE @ResourceValue nvarchar(MAX) DECLARE cur_localeresource CURSOR FOR SELECT ResourceName, ResourceValue FROM #LocaleStringResourceTmp OPEN cur_localeresource FETCH NEXT FROM cur_localeresource INTO @ResourceName, @ResourceValue WHILE @@FETCH_STATUS = 0 BEGIN IF (EXISTS (SELECT 1 FROM [LocaleStringResource] WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName)) BEGIN UPDATE [LocaleStringResource] SET [ResourceValue]=@ResourceValue WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName END ELSE BEGIN INSERT INTO [LocaleStringResource] ( [LanguageID], [ResourceName], [ResourceValue] ) VALUES ( @ExistingLanguageID, @ResourceName, @ResourceValue ) END IF (@ResourceValue is null or @ResourceValue = '') BEGIN DELETE [LocaleStringResource] WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName END FETCH NEXT FROM cur_localeresource INTO @ResourceName, @ResourceValue END CLOSE cur_localeresource DEALLOCATE cur_localeresource --fetch next language identifier FETCH NEXT FROM cur_existinglanguage INTO @ExistingLanguageID END CLOSE cur_existinglanguage DEALLOCATE cur_existinglanguage DROP TABLE #LocaleStringResourceTmp GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'seosettings.allowunicodecharsinurls') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'seosettings.allowunicodecharsinurls', N'true') END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'securitysettings.hideadminmenuitemsbasedonpermissions') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'securitysettings.hideadminmenuitemsbasedonpermissions', N'false') END GO --missed 'Manage Plugins' permission record IF NOT EXISTS ( SELECT 1 FROM [dbo].[PermissionRecord] WHERE [SystemName] = N'ManagePlugins') BEGIN INSERT [dbo].[PermissionRecord] ([Name], [SystemName], [Category]) VALUES (N'Manage Plugins', N'ManagePlugins', N'Configuration') DECLARE @PermissionRecordId INT SET @PermissionRecordId = @@IDENTITY --add it to admin role be default DECLARE @AdminCustomerRoleId int SELECT @AdminCustomerRoleId = Id FROM [CustomerRole] WHERE IsSystemRole=1 and [SystemName] = N'Administrators' INSERT [dbo].[PermissionRecord_Role_Mapping] ([PermissionRecord_Id], [CustomerRole_Id]) VALUES (@PermissionRecordId, @AdminCustomerRoleId) END GO --ProductsByTags page size IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'catalogsettings.productsbytagpagesize') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'catalogsettings.productsbytagpagesize', N'4') END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'adminareasettings.displayproductpictures') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'adminareasettings.displayproductpictures', N'true') END GO --home page product box size IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'catalogsettings.usesmallproductboxonhomepage') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'catalogsettings.usesmallproductboxonhomepage', N'true') END GO --return requsts IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'ordersettings.numberofdaysreturnrequestavailable') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'ordersettings.numberofdaysreturnrequestavailable', N'365') END GO --Category templates IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CategoryTemplate]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1) BEGIN CREATE TABLE [dbo].[CategoryTemplate]( [Id] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](400) NOT NULL, [ViewPath] [nvarchar](400) NOT NULL, [DisplayOrder] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) END GO IF NOT EXISTS ( SELECT 1 FROM [dbo].[CategoryTemplate] WHERE [Name] = N'Products in Grid or Lines') BEGIN INSERT [dbo].[CategoryTemplate] ([Name], [ViewPath], [DisplayOrder]) VALUES (N'Products in Grid or Lines', N'CategoryTemplate.ProductsInGridOrLines', 1) END GO IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Category]') and NAME='CategoryTemplateId') BEGIN ALTER TABLE [dbo].[Category] ADD [CategoryTemplateId] int NULL END GO UPDATE [dbo].[Category] SET [CategoryTemplateId]=1 WHERE [CategoryTemplateId] is null GO ALTER TABLE [dbo].[Category] ALTER COLUMN [CategoryTemplateId] int NOT NULL GO --Manufacturer templates IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ManufacturerTemplate]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1) BEGIN CREATE TABLE [dbo].[ManufacturerTemplate]( [Id] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](400) NOT NULL, [ViewPath] [nvarchar](400) NOT NULL, [DisplayOrder] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) END GO IF NOT EXISTS ( SELECT 1 FROM [dbo].[ManufacturerTemplate] WHERE [Name] = N'Products in Grid or Lines') BEGIN INSERT [dbo].[ManufacturerTemplate] ([Name], [ViewPath], [DisplayOrder]) VALUES (N'Products in Grid or Lines', N'ManufacturerTemplate.ProductsInGridOrLines', 1) END GO IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Manufacturer]') and NAME='ManufacturerTemplateId') BEGIN ALTER TABLE [dbo].[Manufacturer] ADD [ManufacturerTemplateId] int NULL END GO UPDATE [dbo].[Manufacturer] SET [ManufacturerTemplateId]=1 WHERE [ManufacturerTemplateId] is null GO ALTER TABLE [dbo].[Manufacturer] ALTER COLUMN [ManufacturerTemplateId] int NOT NULL GO --new 'RewardPointsWereAdded' or 'Order' entity IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Order]') and NAME='RewardPointsWereAdded') BEGIN ALTER TABLE [dbo].[Order] ADD [RewardPointsWereAdded] bit NULL END GO UPDATE [dbo].[Order] SET [RewardPointsWereAdded]=0 WHERE [RewardPointsWereAdded] is null GO ALTER TABLE [dbo].[Order] ALTER COLUMN [RewardPointsWereAdded] bit NOT NULL GO --Products can require that other products are added to the cart IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[ProductVariant]') and NAME='RequireOtherProducts') BEGIN ALTER TABLE [dbo].[ProductVariant] ADD [RequireOtherProducts] bit NULL END GO UPDATE [dbo].[ProductVariant] SET [RequireOtherProducts]=0 WHERE [RequireOtherProducts] is null GO ALTER TABLE [dbo].[ProductVariant] ALTER COLUMN [RequireOtherProducts] bit NOT NULL GO IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[ProductVariant]') and NAME='RequiredProductVariantIds') BEGIN ALTER TABLE [dbo].[ProductVariant] ADD [RequiredProductVariantIds] nvarchar(1000) NULL END GO IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[ProductVariant]') and NAME='AutomaticallyAddRequiredProductVariants') BEGIN ALTER TABLE [dbo].[ProductVariant] ADD [AutomaticallyAddRequiredProductVariants] bit NULL END GO UPDATE [dbo].[ProductVariant] SET [AutomaticallyAddRequiredProductVariants]=0 WHERE [AutomaticallyAddRequiredProductVariants] is null GO ALTER TABLE [dbo].[ProductVariant] ALTER COLUMN [AutomaticallyAddRequiredProductVariants] bit NOT NULL GO --email accounts and queued emails issue fix IF EXISTS (SELECT 1 FROM sys.objects WHERE name = 'QueuedEmail_EmailAccount' AND parent_object_id = Object_id('QueuedEmail') AND Objectproperty(object_id,N'IsForeignKey') = 1) ALTER TABLE dbo.QueuedEmail DROP CONSTRAINT QueuedEmail_EmailAccount GO ALTER TABLE [dbo].[QueuedEmail] WITH CHECK ADD CONSTRAINT [QueuedEmail_EmailAccount] FOREIGN KEY([EmailAccountId]) REFERENCES [dbo].[EmailAccount] ([Id]) ON DELETE CASCADE GO --store closed option IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'storeinformationsettings.storeclosed') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'storeinformationsettings.storeclosed', N'false') END GO UPDATE [dbo].[Currency] SET [CurrencyCode]=N'RUB' WHERE [CurrencyCode]=N'RUR' GO --a value indicating whether customers are allowed to repost (complete) payments for redirection payment methods IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'paymentsettings.allowrepostingpayments') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'paymentsettings.allowrepostingpayments', N'true') END GO UPDATE [dbo].[CustomerAttribute] SET [Key]=N'CountryId' WHERE [Key]=N'Location' GO --SEO friendly image name. IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Picture]') and NAME='SeoFilename') BEGIN ALTER TABLE [dbo].[Picture] ADD [SeoFilename] nvarchar(300) NULL END GO --Show a share button IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'catalogsettings.showsharebutton') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'catalogsettings.showsharebutton', N'true') END GO --RTL support IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Language]') and NAME='Rtl') BEGIN ALTER TABLE [dbo].[Language] ADD [Rtl] bit NULL END GO UPDATE [dbo].[Language] SET [Rtl]=0 WHERE [Rtl] is null GO ALTER TABLE [dbo].[Language] ALTER COLUMN [Rtl] bit NOT NULL GO --stored procedures support IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'commonsettings.usestoredproceduresifsupported') BEGIN INSERT [Setting] ([Name], [Value]) VALUES (N'commonsettings.usestoredproceduresifsupported', N'true') END GO