--upgrade scripts from nopCommerce 4.10 to 4.20 --new locale resources declare @resources xml --a resource will be deleted if its value is empty set @resources=' Check to disable "Billing address" step during checkout. Billing address will be pre-filled and saved using the default registration data (this option cannot be used with guest checkout enabled). Also ensure that appropriate address fields that cannot be pre-filled are not required (or disabled). If a customer doesn''t have a billing address, then the billing address step will be displayed. {0} ago Ignore additional shipping charge for pick up in store Check if you want ignore additional shipping charge for pick up in store. Use response compression Enable to compress response (gzip by default). You can disable it if you have an active IIS Dynamic Compression Module configured at the server level. The entered text will be replaced by ''{0}'', since it is already used as a SEO-friendly name for another page or contains invalid characters If you''re using this gateway ensure that your primary store currency is supported by PayPal.

To use PDT, you must activate PDT and Auto Return in your PayPal account profile. You must also acquire a PDT identity token, which is used in all PDT communication you send to PayPal. Follow these steps to configure your account for PDT:

1. Log in to your PayPal account (click here to create your account).
2. Click the Profile button.
3. Click the Profile and Settings button.
4. Select the My selling tools item on left panel.
5. Click Website Preferences Update in the Selling online section.
6. Under Auto Return for Website Payments, click the On radio button.
7. For the Return URL, enter the URL on your site that will receive the transaction ID posted by PayPal after a customer payment ({0}).
8. Under Payment Data Transfer, click the On radio button and get your PDT identity token.
9. Click Save.

]]>
To configure authentication with Facebook, please follow these steps:

  1. Navigate to the Facebook for Developers page and sign in. If you don''t already have a Facebook account, use the Sign up for Facebook link on the login page to create one.
  2. Tap the + Add a New App button in the upper right corner to create a new App ID. (If this is your first app with Facebook, the text of the button will be Create a New App.)
  3. Fill out the form and tap the Create App ID button.
  4. The Product Setup page is displayed, letting you select the features for your new app. Click Get Started on Facebook Login.
  5. Click the Settings link in the menu at the left, you are presented with the Client OAuth Settings page with some defaults already set.
  6. Enter "{0:s}signin-facebook" into the Valid OAuth Redirect URIs field.
  7. Click Save Changes.
  8. Click the Dashboard link in the left navigation.
  9. Copy your App ID and App secret below.


]]>
or Information Ok Failed to retrieve states. Failed to retrieve specification options. Failed to load requirements info. Please refresh the page. Failed to add reward points. Failed to save requirement Failed to generate code. Failed to load statistics. Failed to load statistics. Failed to update dimension. Failed to update weight. Failed to add order note. Upload picture first. Failed to add product picture. Error while generating attribute combinations. Failed to save download object. Failed to update currency. Failed to save discount requirements. Error while saving. Successfully saved. Failed to add record. Coupon code ({0}) is activated! The discount will be applied to your order. This coupon code ({0}) is invalid or no longer available. Password must have at least one digit Specify that passwords must have at least one digit. Password must have at least one lowercase Specify that password must have at least one lowercase. Password must have at least one non alphanumeric character Specify that password must have at least one non alphanumeric character. Password must have at least one uppercase Specify that passwords must have at least one uppercase. Password is required. must have at least one digit]]> must have at least one lowercase]]> must have at least one special character (e.g. #?!@$%^&*-)]]> must have at least one uppercase]]> must have at least {0} characters]]> Password must meet the following rules:

    {0}{1}{2}{3}{4}
]]>
[{0}{1}{2}] This customer is inactive You cannot use this discount coupon because the validation conditions are not met Export/Import products with "limited to stores" Check if products should be exported/imported with "limited to stores" property. Stores with the following names and/or IDs don''t exist: {0} : activate to sort column ascending : activate to sort column descending No data available in table _START_-_END_ of _TOTAL_ items No records (filtered from _MAX_ total entries) , Show _MENU_ items Loading... First Last Next Previous Processing... Search: No matching records found ]]> Select location Group tier prices for distinct shopping cart items Allows to offer special prices when customers buy bigger amounts of a particular product. For example, when a customer could have two shopping cart items for the same products (different product attributes). You have {0} invalid address(es) Action to be taken when your current stock quantity falls below (reaches) the ''Minimum stock quantity''. Activation of the action will occur only after an order is placed. Display Mappings Display Mappings Display Database doesn''t contain the ''{0}'' category You cannot add current group product to related ones. This group product was ignored while adding. Show on forgot password page Check to show CAPTCHA on forgot password page when restore password. Price End date The end date for the search. Start date The start date for the search. Product Search by a specific product. Billing country Filter by billing country. Store Search by a specific store. Page size options Page size options ''Products by tag'' page size options Search page. Page size options Page size options Include in sitemap Check to include this blog post in the sitemap. Sitemap includes blog posts Check if you want to include blog posts in sitemap. Sitemap includes topics Check if you want to include topics in sitemap. Blog posts Sitemap includes news items Check if you want to include news items in sitemap. News These settings do not apply to sitemap.xml, only for your site map. You can configure generation for sitemap.xml on all settings page

]]>
Log user profile changes Check to log user profile changes (if this feature is enabled in your store). User changed profile The "{0}" scheduled task failed with the "{1}" error (Task type: "{2}". Store name: "{3}". Task run address: "{4}"). A scheduled task canceled. Timeout expired. Show on home page Check if you want to show a category on home page. Show on home page Check to display this product on your store''s home page. Recommended for your most popular products. Display "Home page" Check if "Home page" menu item should be displayed in the top menu. Show on home page Show on home page Check if you want to show poll on the home page. Home page Featured products All Installed Not installed Html minification Allows you to minify HTML pages as well as compress them, thereby increasing the download speed. Please note that after applying this setting, you need to restart the application. Minification Proxy connection failed Proxy connection is OK Search subcategories Check to search in subcategories. Page size options should not have duplicate items. Page size options should have unique items. Page size options should have unique items. Display Use sandbox Check to use sandbox (testing environment). Saturday Delivery enabled Check to get rates for Saturday Delivery options. Warnings page]]> Username "Pick Up in Store" enabled A value indicating whether "Pick Up in Store" option is enabled during checkout. Please ensure that you have at least one active pickup point provider. Ignore additional shipping charge for pick up in store Check if you want ignore additional shipping charge for pick up in store. Vendor note can not be empty. Store A store name in which this setting is applied. Enter the locale resource name. Enter the locale resource value. Enter the dimension name. Enter the dimension system keyword. Specify the dimension ratio. The display order of this dimension. 1 represents the top of the list. Enter the weight name. Enter the weight system keyword. Specify the weight ratio. The display order of this weight. 1 represents the top of the list. Enter the poll answer name. The display order of this poll answer. 1 represents the top of the list. Enter the setting name. Enter the setting value. Enter the tax category name. The display order of this tax category. 1 represents the top of the list. Enter the template name. The display order of this template. 1 represents the top of the list. Enter the template view path. Enter the template name. The display order of this template. 1 represents the top of the list. Enter the template view path. Enter the template name. The display order of this template. 1 represents the top of the list. Enter the template view path. Specify ignored product types for this template. Enter the template name. The display order of this template. 1 represents the top of the list. Enter the template view path. Good Not bad but also not excellent Not good Redis enabled Use Redis to store Data Protection Keys Use Redis for Caching Use Redis to store Plugins Info Azure Blob Storage enabled Indicates whether Redis is enabled. Indicates whether Redis is used to store Data Protection Keys. Indicates whether Redis is used for Caching. Indicates whether Redis is used to store Plugins Info. Indicates whether Azure Blob Storage is enabled. Static cache manager name Indicating the current static cache manager name. Languages selector Tax selector Attribute name Attribute value Not enough rights to manage customer roles. Check to display tax and shipping information in product boxes (catalog pages). This option is required in Germany. Check to display tax and shipping information in the footer. This option is required in Germany. Check to display tax and shipping information on product details pages. This option is required in Germany. Check to display tax and shipping information on the order details page. This option is required in Germany. Check to display tax and shipping information on the shopping cart page. This option is required in Germany. Check to display tax and shipping information on the wishlist page. This option is required in Germany. The following plugins depend on the "{0}" plugin and must be uninstalled beforehand: "{1}" The "{0}" plugin depends on the following plugins which must be installed beforehand: "{1}" Favicon and app icons are small pictures associated with a particular website or web page. They are displayed by the browser in the tab before the page title, and as a picture next to a bookmark, in tabs and in other interface elements. You can see an example of the favicon and app icons archive in /icons/samples in the root of the site. Could not find file {0}. This file is required. It contains the code for the page head element. Upload icons archive Upload archive with favicon and app icons for different operating systems and devices. You can see an example of the favicon and app icons archive in /icons/samples in the root of the site. Your favicon and app icons path is "icons/icons_{0}" Favicon and app icons have been uploaded Favicon and app icons Restart application to apply changes Discard changes Applying changes on plugins... Discarding changes on plugins... Changes will be apply after restart application The plugin "{0}" not deleted The plugin "{0}" not installed The plugin "{0}" not uninstalled the ''{0}'' plugin required the ''{1}'' assembly The ''{0}'' assembly has collision, application loaded the ''{1}'' assembly, but {2} Uploaded a new favicon and app icons archive for store (ID = ''{0}'')
' 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 UPDATE [Topic] SET [IncludeInFooterColumn1] = 0 WHERE [SystemName] = 'VendorTermsOfService' GO ALTER TABLE [Topic] ALTER COLUMN [Title] nvarchar(max) NULL GO -- #3236 IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[BlogPost]') and NAME='IncludeInSitemap') BEGIN ALTER TABLE [BlogPost] ADD [IncludeInSitemap] bit NULL END GO UPDATE [BlogPost] SET [IncludeInSitemap] = 0 WHERE [IncludeInSitemap] IS NULL GO ALTER TABLE [BlogPost] ALTER COLUMN [IncludeInSitemap] bit NOT NULL GO -- update the "ProductLoadAllPaged" stored procedure ALTER PROCEDURE [ProductLoadAllPaged] ( @CategoryIds nvarchar(MAX) = null, --a list of category IDs (comma-separated list). e.g. 1,2,3 @ManufacturerId int = 0, @StoreId int = 0, @VendorId int = 0, @WarehouseId int = 0, @ProductTypeId int = null, --product type identifier, null - load all products @VisibleIndividuallyOnly bit = 0, --0 - load all products , 1 - "visible indivially" only @MarkedAsNewOnly bit = 0, --0 - load all products , 1 - "marked as new" only @ProductTagId int = 0, @FeaturedProducts bit = null, --0 featured only , 1 not featured only, null - load all products @PriceMin decimal(18, 4) = null, @PriceMax decimal(18, 4) = null, @Keywords nvarchar(4000) = null, @SearchDescriptions bit = 0, --a value indicating whether to search by a specified "keyword" in product descriptions @SearchManufacturerPartNumber bit = 0, -- a value indicating whether to search by a specified "keyword" in manufacturer part number @SearchSku bit = 0, --a value indicating whether to search by a specified "keyword" in product SKU @SearchProductTags bit = 0, --a value indicating whether to search by a specified "keyword" in product tags @UseFullTextSearch bit = 0, @FullTextMode int = 0, --0 - using CONTAINS with , 5 - using CONTAINS and OR with , 10 - using CONTAINS and AND with @FilteredSpecs nvarchar(MAX) = null, --filter by specification attribute options (comma-separated list of IDs). e.g. 14,15,16 @LanguageId int = 0, @OrderBy int = 0, --0 - position, 5 - Name: A to Z, 6 - Name: Z to A, 10 - Price: Low to High, 11 - Price: High to Low, 15 - creation date @AllowedCustomerRoleIds nvarchar(MAX) = null, --a list of customer role IDs (comma-separated list) for which a product should be shown (if a subject to ACL) @PageIndex int = 0, @PageSize int = 2147483644, @ShowHidden bit = 0, @OverridePublished bit = null, --null - process "Published" property according to "showHidden" parameter, true - load only "Published" products, false - load only "Unpublished" products @LoadFilterableSpecificationAttributeOptionIds bit = 0, --a value indicating whether we should load the specification attribute option identifiers applied to loaded products (all pages) @FilterableSpecificationAttributeOptionIds nvarchar(MAX) = null OUTPUT, --the specification attribute option identifiers applied to loaded products (all pages). returned as a comma separated list of identifiers @TotalRecords int = null OUTPUT ) AS BEGIN /* Products that filtered by keywords */ CREATE TABLE #KeywordProducts ( [ProductId] int NOT NULL ) DECLARE @SearchKeywords bit, @OriginalKeywords nvarchar(4000), @sql nvarchar(max), @sql_orderby nvarchar(max) SET NOCOUNT ON --filter by keywords SET @Keywords = isnull(@Keywords, '') SET @Keywords = rtrim(ltrim(@Keywords)) SET @OriginalKeywords = @Keywords IF ISNULL(@Keywords, '') != '' BEGIN SET @SearchKeywords = 1 IF @UseFullTextSearch = 1 BEGIN --remove wrong chars (' ") SET @Keywords = REPLACE(@Keywords, '''', '') SET @Keywords = REPLACE(@Keywords, '"', '') --full-text search IF @FullTextMode = 0 BEGIN --0 - using CONTAINS with SET @Keywords = ' "' + @Keywords + '*" ' END ELSE BEGIN --5 - using CONTAINS and OR with --10 - using CONTAINS and AND with --clean multiple spaces WHILE CHARINDEX(' ', @Keywords) > 0 SET @Keywords = REPLACE(@Keywords, ' ', ' ') DECLARE @concat_term nvarchar(100) IF @FullTextMode = 5 --5 - using CONTAINS and OR with BEGIN SET @concat_term = 'OR' END IF @FullTextMode = 10 --10 - using CONTAINS and AND with BEGIN SET @concat_term = 'AND' END --now let's build search string declare @fulltext_keywords nvarchar(4000) set @fulltext_keywords = N'' declare @index int set @index = CHARINDEX(' ', @Keywords, 0) -- if index = 0, then only one field was passed IF(@index = 0) set @fulltext_keywords = ' "' + @Keywords + '*" ' ELSE BEGIN DECLARE @first BIT SET @first = 1 WHILE @index > 0 BEGIN IF (@first = 0) SET @fulltext_keywords = @fulltext_keywords + ' ' + @concat_term + ' ' ELSE SET @first = 0 SET @fulltext_keywords = @fulltext_keywords + '"' + SUBSTRING(@Keywords, 1, @index - 1) + '*"' SET @Keywords = SUBSTRING(@Keywords, @index + 1, LEN(@Keywords) - @index) SET @index = CHARINDEX(' ', @Keywords, 0) end -- add the last field IF LEN(@fulltext_keywords) > 0 SET @fulltext_keywords = @fulltext_keywords + ' ' + @concat_term + ' ' + '"' + SUBSTRING(@Keywords, 1, LEN(@Keywords)) + '*"' END SET @Keywords = @fulltext_keywords END END ELSE BEGIN --usual search by PATINDEX SET @Keywords = '%' + @Keywords + '%' END --PRINT @Keywords --product name SET @sql = ' INSERT INTO #KeywordProducts ([ProductId]) SELECT p.Id FROM Product p with (NOLOCK) WHERE ' IF @UseFullTextSearch = 1 SET @sql = @sql + 'CONTAINS(p.[Name], @Keywords) ' ELSE SET @sql = @sql + 'PATINDEX(@Keywords, p.[Name]) > 0 ' --localized product name SET @sql = @sql + ' UNION SELECT lp.EntityId FROM LocalizedProperty lp with (NOLOCK) WHERE lp.LocaleKeyGroup = N''Product'' AND lp.LanguageId = ' + ISNULL(CAST(@LanguageId AS nvarchar(max)), '0') + ' AND lp.LocaleKey = N''Name''' IF @UseFullTextSearch = 1 SET @sql = @sql + ' AND CONTAINS(lp.[LocaleValue], @Keywords) ' ELSE SET @sql = @sql + ' AND PATINDEX(@Keywords, lp.[LocaleValue]) > 0 ' IF @SearchDescriptions = 1 BEGIN --product short description SET @sql = @sql + ' UNION SELECT p.Id FROM Product p with (NOLOCK) WHERE ' IF @UseFullTextSearch = 1 SET @sql = @sql + 'CONTAINS(p.[ShortDescription], @Keywords) ' ELSE SET @sql = @sql + 'PATINDEX(@Keywords, p.[ShortDescription]) > 0 ' --product full description SET @sql = @sql + ' UNION SELECT p.Id FROM Product p with (NOLOCK) WHERE ' IF @UseFullTextSearch = 1 SET @sql = @sql + 'CONTAINS(p.[FullDescription], @Keywords) ' ELSE SET @sql = @sql + 'PATINDEX(@Keywords, p.[FullDescription]) > 0 ' --localized product short description SET @sql = @sql + ' UNION SELECT lp.EntityId FROM LocalizedProperty lp with (NOLOCK) WHERE lp.LocaleKeyGroup = N''Product'' AND lp.LanguageId = ' + ISNULL(CAST(@LanguageId AS nvarchar(max)), '0') + ' AND lp.LocaleKey = N''ShortDescription''' IF @UseFullTextSearch = 1 SET @sql = @sql + ' AND CONTAINS(lp.[LocaleValue], @Keywords) ' ELSE SET @sql = @sql + ' AND PATINDEX(@Keywords, lp.[LocaleValue]) > 0 ' --localized product full description SET @sql = @sql + ' UNION SELECT lp.EntityId FROM LocalizedProperty lp with (NOLOCK) WHERE lp.LocaleKeyGroup = N''Product'' AND lp.LanguageId = ' + ISNULL(CAST(@LanguageId AS nvarchar(max)), '0') + ' AND lp.LocaleKey = N''FullDescription''' IF @UseFullTextSearch = 1 SET @sql = @sql + ' AND CONTAINS(lp.[LocaleValue], @Keywords) ' ELSE SET @sql = @sql + ' AND PATINDEX(@Keywords, lp.[LocaleValue]) > 0 ' END --manufacturer part number (exact match) IF @SearchManufacturerPartNumber = 1 BEGIN SET @sql = @sql + ' UNION SELECT p.Id FROM Product p with (NOLOCK) WHERE p.[ManufacturerPartNumber] = @OriginalKeywords ' END --SKU (exact match) IF @SearchSku = 1 BEGIN SET @sql = @sql + ' UNION SELECT p.Id FROM Product p with (NOLOCK) WHERE p.[Sku] = @OriginalKeywords ' END IF @SearchProductTags = 1 BEGIN --product tags (exact match) SET @sql = @sql + ' UNION SELECT pptm.Product_Id FROM Product_ProductTag_Mapping pptm with(NOLOCK) INNER JOIN ProductTag pt with(NOLOCK) ON pt.Id = pptm.ProductTag_Id WHERE pt.[Name] = @OriginalKeywords ' --localized product tags SET @sql = @sql + ' UNION SELECT pptm.Product_Id FROM LocalizedProperty lp with (NOLOCK) INNER JOIN Product_ProductTag_Mapping pptm with(NOLOCK) ON lp.EntityId = pptm.ProductTag_Id WHERE lp.LocaleKeyGroup = N''ProductTag'' AND lp.LanguageId = ' + ISNULL(CAST(@LanguageId AS nvarchar(max)), '0') + ' AND lp.LocaleKey = N''Name'' AND lp.[LocaleValue] = @OriginalKeywords ' END --PRINT (@sql) EXEC sp_executesql @sql, N'@Keywords nvarchar(4000), @OriginalKeywords nvarchar(4000)', @Keywords, @OriginalKeywords END ELSE BEGIN SET @SearchKeywords = 0 END --filter by category IDs SET @CategoryIds = isnull(@CategoryIds, '') CREATE TABLE #FilteredCategoryIds ( CategoryId int not null ) INSERT INTO #FilteredCategoryIds (CategoryId) SELECT CAST(data as int) FROM [nop_splitstring_to_table](@CategoryIds, ',') DECLARE @CategoryIdsCount int SET @CategoryIdsCount = (SELECT COUNT(1) FROM #FilteredCategoryIds) --filter by customer role IDs (access control list) SET @AllowedCustomerRoleIds = isnull(@AllowedCustomerRoleIds, '') CREATE TABLE #FilteredCustomerRoleIds ( CustomerRoleId int not null ) INSERT INTO #FilteredCustomerRoleIds (CustomerRoleId) SELECT CAST(data as int) FROM [nop_splitstring_to_table](@AllowedCustomerRoleIds, ',') DECLARE @FilteredCustomerRoleIdsCount int SET @FilteredCustomerRoleIdsCount = (SELECT COUNT(1) FROM #FilteredCustomerRoleIds) --paging DECLARE @PageLowerBound int DECLARE @PageUpperBound int DECLARE @RowsToReturn int SET @RowsToReturn = @PageSize * (@PageIndex + 1) SET @PageLowerBound = @PageSize * @PageIndex SET @PageUpperBound = @PageLowerBound + @PageSize + 1 CREATE TABLE #DisplayOrderTmp ( [Id] int IDENTITY (1, 1) NOT NULL, [ProductId] int NOT NULL ) SET @sql = ' SELECT p.Id FROM Product p with (NOLOCK)' IF @CategoryIdsCount > 0 BEGIN SET @sql = @sql + ' INNER JOIN Product_Category_Mapping pcm with (NOLOCK) ON p.Id = pcm.ProductId' END IF @ManufacturerId > 0 BEGIN SET @sql = @sql + ' INNER JOIN Product_Manufacturer_Mapping pmm with (NOLOCK) ON p.Id = pmm.ProductId' END IF ISNULL(@ProductTagId, 0) != 0 BEGIN SET @sql = @sql + ' INNER JOIN Product_ProductTag_Mapping pptm with (NOLOCK) ON p.Id = pptm.Product_Id' END --searching by keywords IF @SearchKeywords = 1 BEGIN SET @sql = @sql + ' JOIN #KeywordProducts kp ON p.Id = kp.ProductId' END SET @sql = @sql + ' WHERE p.Deleted = 0' --filter by category IF @CategoryIdsCount > 0 BEGIN SET @sql = @sql + ' AND pcm.CategoryId IN (' SET @sql = @sql + + CAST(@CategoryIds AS nvarchar(max)) SET @sql = @sql + ')' IF @FeaturedProducts IS NOT NULL BEGIN SET @sql = @sql + ' AND pcm.IsFeaturedProduct = ' + CAST(@FeaturedProducts AS nvarchar(max)) END END --filter by manufacturer IF @ManufacturerId > 0 BEGIN SET @sql = @sql + ' AND pmm.ManufacturerId = ' + CAST(@ManufacturerId AS nvarchar(max)) IF @FeaturedProducts IS NOT NULL BEGIN SET @sql = @sql + ' AND pmm.IsFeaturedProduct = ' + CAST(@FeaturedProducts AS nvarchar(max)) END END --filter by vendor IF @VendorId > 0 BEGIN SET @sql = @sql + ' AND p.VendorId = ' + CAST(@VendorId AS nvarchar(max)) END --filter by warehouse IF @WarehouseId > 0 BEGIN --we should also ensure that 'ManageInventoryMethodId' is set to 'ManageStock' (1) --but we skip it in order to prevent hard-coded values (e.g. 1) and for better performance SET @sql = @sql + ' AND ( (p.UseMultipleWarehouses = 0 AND p.WarehouseId = ' + CAST(@WarehouseId AS nvarchar(max)) + ') OR (p.UseMultipleWarehouses > 0 AND EXISTS (SELECT 1 FROM ProductWarehouseInventory [pwi] WHERE [pwi].WarehouseId = ' + CAST(@WarehouseId AS nvarchar(max)) + ' AND [pwi].ProductId = p.Id)) )' END --filter by product type IF @ProductTypeId is not null BEGIN SET @sql = @sql + ' AND p.ProductTypeId = ' + CAST(@ProductTypeId AS nvarchar(max)) END --filter by "visible individually" IF @VisibleIndividuallyOnly = 1 BEGIN SET @sql = @sql + ' AND p.VisibleIndividually = 1' END --filter by "marked as new" IF @MarkedAsNewOnly = 1 BEGIN SET @sql = @sql + ' AND p.MarkAsNew = 1 AND (getutcdate() BETWEEN ISNULL(p.MarkAsNewStartDateTimeUtc, ''1/1/1900'') and ISNULL(p.MarkAsNewEndDateTimeUtc, ''1/1/2999''))' END --filter by product tag IF ISNULL(@ProductTagId, 0) != 0 BEGIN SET @sql = @sql + ' AND pptm.ProductTag_Id = ' + CAST(@ProductTagId AS nvarchar(max)) END --"Published" property IF (@OverridePublished is null) BEGIN --process according to "showHidden" IF @ShowHidden = 0 BEGIN SET @sql = @sql + ' AND p.Published = 1' END END ELSE IF (@OverridePublished = 1) BEGIN --published only SET @sql = @sql + ' AND p.Published = 1' END ELSE IF (@OverridePublished = 0) BEGIN --unpublished only SET @sql = @sql + ' AND p.Published = 0' END --show hidden IF @ShowHidden = 0 BEGIN SET @sql = @sql + ' AND p.Deleted = 0 AND (getutcdate() BETWEEN ISNULL(p.AvailableStartDateTimeUtc, ''1/1/1900'') and ISNULL(p.AvailableEndDateTimeUtc, ''1/1/2999''))' END --min price IF @PriceMin is not null BEGIN SET @sql = @sql + ' AND (p.Price >= ' + CAST(@PriceMin AS nvarchar(max)) + ')' END --max price IF @PriceMax is not null BEGIN SET @sql = @sql + ' AND (p.Price <= ' + CAST(@PriceMax AS nvarchar(max)) + ')' END --show hidden and ACL IF @ShowHidden = 0 and @FilteredCustomerRoleIdsCount > 0 BEGIN SET @sql = @sql + ' AND (p.SubjectToAcl = 0 OR EXISTS ( SELECT 1 FROM #FilteredCustomerRoleIds [fcr] WHERE [fcr].CustomerRoleId IN ( SELECT [acl].CustomerRoleId FROM [AclRecord] acl with (NOLOCK) WHERE [acl].EntityId = p.Id AND [acl].EntityName = ''Product'' ) ))' END --filter by store IF @StoreId > 0 BEGIN SET @sql = @sql + ' AND (p.LimitedToStores = 0 OR EXISTS ( SELECT 1 FROM [StoreMapping] sm with (NOLOCK) WHERE [sm].EntityId = p.Id AND [sm].EntityName = ''Product'' and [sm].StoreId=' + CAST(@StoreId AS nvarchar(max)) + ' ))' END --prepare filterable specification attribute option identifier (if requested) IF @LoadFilterableSpecificationAttributeOptionIds = 1 BEGIN CREATE TABLE #FilterableSpecs ( [SpecificationAttributeOptionId] int NOT NULL ) DECLARE @sql_filterableSpecs nvarchar(max) SET @sql_filterableSpecs = ' INSERT INTO #FilterableSpecs ([SpecificationAttributeOptionId]) SELECT DISTINCT [psam].SpecificationAttributeOptionId FROM [Product_SpecificationAttribute_Mapping] [psam] WITH (NOLOCK) WHERE [psam].[AllowFiltering] = 1 AND [psam].[ProductId] IN (' + @sql + ')' EXEC sp_executesql @sql_filterableSpecs --build comma separated list of filterable identifiers SELECT @FilterableSpecificationAttributeOptionIds = COALESCE(@FilterableSpecificationAttributeOptionIds + ',' , '') + CAST(SpecificationAttributeOptionId as nvarchar(4000)) FROM #FilterableSpecs DROP TABLE #FilterableSpecs END --filter by specification attribution options SET @FilteredSpecs = isnull(@FilteredSpecs, '') CREATE TABLE #FilteredSpecs ( SpecificationAttributeOptionId int not null ) INSERT INTO #FilteredSpecs (SpecificationAttributeOptionId) SELECT CAST(data as int) FROM [nop_splitstring_to_table](@FilteredSpecs, ',') CREATE TABLE #FilteredSpecsWithAttributes ( SpecificationAttributeId int not null, SpecificationAttributeOptionId int not null ) INSERT INTO #FilteredSpecsWithAttributes (SpecificationAttributeId, SpecificationAttributeOptionId) SELECT sao.SpecificationAttributeId, fs.SpecificationAttributeOptionId FROM #FilteredSpecs fs INNER JOIN SpecificationAttributeOption sao ON sao.Id = fs.SpecificationAttributeOptionId ORDER BY sao.SpecificationAttributeId DECLARE @SpecAttributesCount int SET @SpecAttributesCount = (SELECT COUNT(1) FROM #FilteredSpecsWithAttributes) IF @SpecAttributesCount > 0 BEGIN --do it for each specified specification option DECLARE @SpecificationAttributeOptionId int DECLARE @SpecificationAttributeId int DECLARE @LastSpecificationAttributeId int SET @LastSpecificationAttributeId = 0 DECLARE cur_SpecificationAttributeOption CURSOR FOR SELECT SpecificationAttributeId, SpecificationAttributeOptionId FROM #FilteredSpecsWithAttributes OPEN cur_SpecificationAttributeOption FOREACH: FETCH NEXT FROM cur_SpecificationAttributeOption INTO @SpecificationAttributeId, @SpecificationAttributeOptionId IF (@LastSpecificationAttributeId <> 0 AND @SpecificationAttributeId <> @LastSpecificationAttributeId OR @@FETCH_STATUS <> 0) SET @sql = @sql + ' AND p.Id in (select psam.ProductId from [Product_SpecificationAttribute_Mapping] psam with (NOLOCK) where psam.AllowFiltering = 1 and psam.SpecificationAttributeOptionId IN (SELECT SpecificationAttributeOptionId FROM #FilteredSpecsWithAttributes WHERE SpecificationAttributeId = ' + CAST(@LastSpecificationAttributeId AS nvarchar(max)) + '))' SET @LastSpecificationAttributeId = @SpecificationAttributeId IF @@FETCH_STATUS = 0 GOTO FOREACH CLOSE cur_SpecificationAttributeOption DEALLOCATE cur_SpecificationAttributeOption END --sorting SET @sql_orderby = '' IF @OrderBy = 5 /* Name: A to Z */ SET @sql_orderby = ' p.[Name] ASC' ELSE IF @OrderBy = 6 /* Name: Z to A */ SET @sql_orderby = ' p.[Name] DESC' ELSE IF @OrderBy = 10 /* Price: Low to High */ SET @sql_orderby = ' p.[Price] ASC' ELSE IF @OrderBy = 11 /* Price: High to Low */ SET @sql_orderby = ' p.[Price] DESC' ELSE IF @OrderBy = 15 /* creation date */ SET @sql_orderby = ' p.[CreatedOnUtc] DESC' ELSE /* default sorting, 0 (position) */ BEGIN --category position (display order) IF @CategoryIdsCount > 0 SET @sql_orderby = ' pcm.DisplayOrder ASC' --manufacturer position (display order) IF @ManufacturerId > 0 BEGIN IF LEN(@sql_orderby) > 0 SET @sql_orderby = @sql_orderby + ', ' SET @sql_orderby = @sql_orderby + ' pmm.DisplayOrder ASC' END --name IF LEN(@sql_orderby) > 0 SET @sql_orderby = @sql_orderby + ', ' SET @sql_orderby = @sql_orderby + ' p.[Name] ASC' END SET @sql = @sql + ' ORDER BY' + @sql_orderby SET @sql = ' INSERT INTO #DisplayOrderTmp ([ProductId])' + @sql --PRINT (@sql) EXEC sp_executesql @sql DROP TABLE #FilteredCategoryIds DROP TABLE #FilteredSpecs DROP TABLE #FilteredSpecsWithAttributes DROP TABLE #FilteredCustomerRoleIds DROP TABLE #KeywordProducts CREATE TABLE #PageIndex ( [IndexId] int IDENTITY (1, 1) NOT NULL, [ProductId] int NOT NULL ) INSERT INTO #PageIndex ([ProductId]) SELECT ProductId FROM #DisplayOrderTmp GROUP BY ProductId ORDER BY min([Id]) --total records SET @TotalRecords = @@rowcount DROP TABLE #DisplayOrderTmp --return products SELECT TOP (@RowsToReturn) p.* FROM #PageIndex [pi] INNER JOIN Product p with (NOLOCK) on p.Id = [pi].[ProductId] WHERE [pi].IndexId > @PageLowerBound AND [pi].IndexId < @PageUpperBound ORDER BY [pi].IndexId DROP TABLE #PageIndex END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'shippingsettings.ignoreadditionalshippingchargeforpickupinstore') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'shippingsettings.ignoreadditionalshippingchargeforpickupinstore', N'true', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'adminareasettings.usericheditorforcustomeremails') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'adminareasettings.usericheditorforcustomeremails', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'messagessettings.usepopupnotifications') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'messagessettings.usepopupnotifications', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'customersettings.passwordrequirelowercase') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'customersettings.passwordrequirelowercase', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'customersettings.passwordrequireuppercase') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'customersettings.passwordrequireuppercase', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'customersettings.passwordrequirenonalphanumeric') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'customersettings.passwordrequirenonalphanumeric', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'customersettings.passwordrequiredigit') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'customersettings.passwordrequiredigit', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'catalogsettings.exportimportproductuselimitedtostores') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'catalogsettings.exportimportproductuselimitedtostores', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'catalogsettings.useajaxloadmenu') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'catalogsettings.useajaxloadmenu', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludetopics') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapsettings.sitemapincludetopics', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludeblogposts') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapsettings.sitemapincludeblogposts', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludenews') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapsettings.sitemapincludenews', N'false', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlenabled') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlenabled', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludeblogposts') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludeblogposts', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludecategories') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludecategories', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludecustomurls') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludecustomurls', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludemanufacturers') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludemanufacturers', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludeproducts') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludeproducts', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludeproducttags') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludeproducttags', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludetopics') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludetopics', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapxmlincludenews') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'sitemapxmlsettings.sitemapxmlincludenews', N'True', 0) END GO --update old settings (#3236) IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapenabled') BEGIN UPDATE [Setting] SET [Name] = 'sitemapsettings.sitemapenabled' WHERE [Name] = 'commonsettings.sitemapenabled' END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludecategories') BEGIN UPDATE [Setting] SET [Name] = 'sitemapsettings.sitemapincludecategories' WHERE [Name] = 'commonsettings.sitemapincludecategories' END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludemanufacturers') BEGIN UPDATE [Setting] SET [Name] = 'sitemapsettings.sitemapincludemanufacturers' WHERE [Name] = 'commonsettings.sitemapincludemanufacturers' END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludeproducts') BEGIN UPDATE [Setting] SET [Name] = 'sitemapsettings.sitemapincludeproducts' WHERE [Name] = 'commonsettings.sitemapincludeproducts' END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemapincludeproducttags') BEGIN UPDATE [Setting] SET [Name] = 'sitemapsettings.sitemapincludeproducttags' WHERE [Name] = 'commonsettings.sitemapincludeproducttags' END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapsettings.sitemappagesize') BEGIN UPDATE [Setting] SET [Name] = 'sitemapsettings.sitemappagesize' WHERE [Name] = 'commonsettings.sitemappagesize' END GO IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'sitemapxmlsettings.sitemapcustomurls') BEGIN UPDATE [Setting] SET [Name] = 'sitemapxmlsettings.sitemapcustomurls' WHERE [Name] = 'commonsettings.sitemapcustomurls' END GO --updating of indexes in the Picture table for reduced table size after upgrade nopCommerce from 4.00 to 4.10 version ALTER INDEX ALL ON [Picture] REBUILD GO --new activity log type IF NOT EXISTS (SELECT 1 FROM [ActivityLogType] WHERE [Name] = N'Upload a favicon and app icons archive') BEGIN INSERT [ActivityLogType] ( [SystemKeyword], [Name], [Enabled]) VALUES ( N'UploadIconsArchive', N'Upload a favicon and app icons archive', 1) END GO --new ground shipping description UPDATE [ShippingMethod] SET [Description] = 'Shipping by land transport' WHERE [Name] = 'Ground' GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'producteditorsettings.onecolumnproductpage' GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'producteditorsettings.createdon' GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'producteditorsettings.updatedon' GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'producteditorsettings.id' GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'adminareasettings.usenestedsetting' GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'commonsettings.minificationenabled') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'commonsettings.minificationenabled', N'True', 0) END GO --update setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'commonsettings.enablehtmlminification') BEGIN UPDATE [Setting] SET [Name] = 'commonsettings.enablehtmlminification' WHERE [Name] = 'commonsettings.minificationenabled' END GO --update the "ProductTagCountLoadAll" stored procedure ALTER PROCEDURE [ProductTagCountLoadAll] ( @StoreId int, @AllowedCustomerRoleIds nvarchar(MAX) = null --a list of customer role IDs (comma-separated list) for which a product should be shown (if a subject to ACL) ) AS BEGIN SET NOCOUNT ON --filter by customer role IDs (access control list) SET @AllowedCustomerRoleIds = isnull(@AllowedCustomerRoleIds, '') CREATE TABLE #FilteredCustomerRoleIds ( CustomerRoleId int not null ) INSERT INTO #FilteredCustomerRoleIds (CustomerRoleId) SELECT CAST(data as int) FROM [nop_splitstring_to_table](@AllowedCustomerRoleIds, ',') DECLARE @FilteredCustomerRoleIdsCount int SET @FilteredCustomerRoleIdsCount = (SELECT COUNT(1) FROM #FilteredCustomerRoleIds) SELECT pt.Id as [ProductTagId], COUNT(p.Id) as [ProductCount] FROM ProductTag pt with (NOLOCK) LEFT JOIN Product_ProductTag_Mapping pptm with (NOLOCK) ON pt.[Id] = pptm.[ProductTag_Id] LEFT JOIN Product p with (NOLOCK) ON pptm.[Product_Id] = p.[Id] WHERE p.[Deleted] = 0 AND p.Published = 1 AND (@StoreId = 0 or (p.LimitedToStores = 0 OR EXISTS ( SELECT 1 FROM [StoreMapping] sm with (NOLOCK) WHERE [sm].EntityId = p.Id AND [sm].EntityName = 'Product' and [sm].StoreId=@StoreId ))) AND (@FilteredCustomerRoleIdsCount = 0 or (p.SubjectToAcl = 0 OR EXISTS ( SELECT 1 FROM #FilteredCustomerRoleIds [fcr] WHERE [fcr].CustomerRoleId IN ( SELECT [acl].CustomerRoleId FROM [AclRecord] acl with (NOLOCK) WHERE [acl].EntityId = p.Id AND [acl].EntityName = 'Product' )) )) GROUP BY pt.Id ORDER BY pt.Id END GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'storeinformationsettings.googlepluslink' GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'gdprsettings.loguserprofilechanges') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'gdprsettings.loguserprofilechanges', N'True', 0) END GO --alter column ALTER TABLE [Setting] ALTER COLUMN [Value] [nvarchar](max) NOT NULL GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'mediasettings.useabsoluteimagepath') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'mediasettings.useabsoluteimagepath', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'commonsettings.scheduletaskruntimeout') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'commonsettings.scheduletaskruntimeout', N'', 0) END GO --rename columns EXEC sp_RENAME 'Category.ShowOnHomePage' , 'ShowOnHomepage', 'COLUMN' GO EXEC sp_RENAME 'Poll.ShowOnHomePage' , 'ShowOnHomepage', 'COLUMN' GO EXEC sp_RENAME 'Product.ShowOnHomePage' , 'ShowOnHomepage', 'COLUMN' GO --update setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'commonsettings.enablejsbundling') BEGIN UPDATE [Setting] SET [Name] = 'commonsettings.enablejsbundling' WHERE [Name] = 'seosettings.enablejsbundling' END GO --update setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'commonsettings.enablecssbundling') BEGIN UPDATE [Setting] SET [Name] = 'commonsettings.enablecssbundling' WHERE [Name] = 'seosettings.enablecssbundling' END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'paymentsettings.regenerateorderguidinterval') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'paymentsettings.regenerateorderguidinterval', N'180', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.enabled') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.enabled', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.address') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.address', N'', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.port') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.port', N'', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.username') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.username', N'', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.password') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.password', N'', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.bypassonlocal') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.bypassonlocal', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'proxysettings.preauthenticate') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'proxysettings.preauthenticate', N'True', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'upssettings.usesandbox') BEGIN IF EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'upssettings.url' AND [Value] LIKE '%wwwcie.ups.com%') INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'upssettings.usesandbox', N'True', 0) ELSE INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'upssettings.usesandbox', N'False', 0) END GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'upssettings.saturdaydeliveryenabled') BEGIN IF EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'upssettings.carrierservicesoffered' AND [Value] LIKE '%[sa]%') INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'upssettings.saturdaydeliveryenabled', N'True', 0) ELSE INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'upssettings.saturdaydeliveryenabled', N'False', 0) END GO --delete setting DELETE FROM [Setting] WHERE [Name] = N'upssettings.url' GO --new setting IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [Name] = N'squarepaymentsettings.refreshtoken') BEGIN INSERT [Setting] ([Name], [Value], [StoreId]) VALUES (N'squarepaymentsettings.refreshtoken', N'00000000-0000-0000-0000-000000000000', 0) END GO --rename column IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[Order]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1) AND EXISTS (SELECT 1 FROM sys.columns WHERE object_id = OBJECT_ID(N'[Order]') and NAME='PickUpInStore') BEGIN EXEC sp_RENAME '[Order].[PickUpInStore]', 'PickupInStore', 'COLUMN' END GO --update setting UPDATE [Setting] SET [Value] = '7' WHERE [Name] = 'adminareasettings.popupgridpagesize' GO --update setting UPDATE [Setting] SET [Value] = '7, 15, 20, 50, 100' WHERE [Name] = 'adminareasettings.gridpagesizes' GO --new column IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id = object_id('[Picture]') AND NAME = 'VirtualPath') BEGIN ALTER TABLE [Picture] ADD VirtualPath nvarchar(MAX) NULL END GO --update datetime fields to change type IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ActivityLog' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_ActivityLog_CreatedOnUtc] ON [ActivityLog] ALTER TABLE [ActivityLog] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL CREATE NONCLUSTERED INDEX [IX_ActivityLog_CreatedOnUtc] ON [ActivityLog] ([CreatedOnUtc] DESC) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Address' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_ActivityLog_CreatedOnUtc] ON [ActivityLog] ALTER TABLE [Address] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL CREATE NONCLUSTERED INDEX [IX_ActivityLog_CreatedOnUtc] ON [ActivityLog] ([CreatedOnUtc] DESC) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Address' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Address] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'BackInStockSubscription' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [BackInStockSubscription] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'BlogComment' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [BlogComment] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'BlogPost' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [BlogPost] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Campaign' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Campaign] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Category' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Category] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Currency' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Currency] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Customer' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_Customer_CreatedOnUtc] ON [Customer] ALTER TABLE [Customer] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL CREATE NONCLUSTERED INDEX [IX_Customer_CreatedOnUtc] ON [Customer] ([CreatedOnUtc] DESC) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CustomerPassword' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [CustomerPassword] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'DiscountUsageHistory' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [DiscountUsageHistory] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Forum' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Forum] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Group' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Group] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Post' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Post] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_PostVote' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_PostVote] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_PrivateMessage' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_PrivateMessage] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Subscription' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Subscription] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Topic' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Topic] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'GdprLog' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [GdprLog] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'GiftCard' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [GiftCard] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'GiftCardUsageHistory' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [GiftCardUsageHistory] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Log' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_Log_CreatedOnUtc] ON [Log] ALTER TABLE [Log] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL CREATE NONCLUSTERED INDEX [IX_Log_CreatedOnUtc] ON [Log] ([CreatedOnUtc] DESC) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Manufacturer' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Manufacturer] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'News' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [News] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'NewsComment' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [NewsComment] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'NewsLetterSubscription' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [NewsLetterSubscription] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Order' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_Order_CreatedOnUtc] ON [Order] ALTER TABLE [Order] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL CREATE NONCLUSTERED INDEX [IX_Order_CreatedOnUtc] ON [Order] ([CreatedOnUtc] DESC) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'OrderNote' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [OrderNote] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'PollVotingRecord' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [PollVotingRecord] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Product] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ProductReview' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ProductReview] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'QueuedEmail' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_QueuedEmail_CreatedOnUtc] ON [QueuedEmail] ALTER TABLE [QueuedEmail] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL CREATE NONCLUSTERED INDEX [IX_QueuedEmail_CreatedOnUtc] ON [QueuedEmail] ([CreatedOnUtc] DESC) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RecurringPayment' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [RecurringPayment] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RecurringPaymentHistory' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [RecurringPaymentHistory] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ReturnRequest' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ReturnRequest] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RewardPointsHistory' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [RewardPointsHistory] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Shipment' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Shipment] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ShoppingCartItem' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ShoppingCartItem] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'StockQuantityHistory' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [StockQuantityHistory] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'VendorNote' AND COLUMN_NAME = 'CreatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [VendorNote] ALTER column [CreatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'BlogPost' AND COLUMN_NAME = 'StartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [BlogPost] ALTER column [StartDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'BlogPost' AND COLUMN_NAME = 'EndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [BlogPost] ALTER column [EndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Campaign' AND COLUMN_NAME = 'DontSendBeforeDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Campaign] ALTER column [DontSendBeforeDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Category' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Category] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Currency' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Currency] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Forum' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Forum] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Group' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Group] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Post' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Post] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Topic' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Topic] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Manufacturer' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Manufacturer] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Product] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ReturnRequest' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ReturnRequest] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ShoppingCartItem' AND COLUMN_NAME = 'UpdatedOnUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ShoppingCartItem] ALTER column [UpdatedOnUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Customer' AND COLUMN_NAME = 'CannotLoginUntilDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Customer] ALTER column [CannotLoginUntilDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Customer' AND COLUMN_NAME = 'LastLoginDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Customer] ALTER column [LastLoginDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Customer' AND COLUMN_NAME = 'LastActivityDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Customer] ALTER column [LastActivityDateUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Discount' AND COLUMN_NAME = 'StartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Discount] ALTER column [StartDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Discount' AND COLUMN_NAME = 'EndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Discount] ALTER column [EndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Forum' AND COLUMN_NAME = 'LastPostTime' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Forum] ALTER column [LastPostTime] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Forums_Topic' AND COLUMN_NAME = 'LastPostTime' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Forums_Topic] ALTER column [LastPostTime] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'News' AND COLUMN_NAME = 'StartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [News] ALTER column [StartDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'News' AND COLUMN_NAME = 'EndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [News] ALTER column [EndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Order' AND COLUMN_NAME = 'PaidDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Order] ALTER column [PaidDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'OrderItem' AND COLUMN_NAME = 'RentalStartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [OrderItem] ALTER column [RentalStartDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'OrderItem' AND COLUMN_NAME = 'RentalEndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [OrderItem] ALTER column [RentalEndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Poll' AND COLUMN_NAME = 'StartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Poll] ALTER column [StartDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Poll' AND COLUMN_NAME = 'EndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Poll] ALTER column [EndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'PreOrderAvailabilityStartDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Product] ALTER column [PreOrderAvailabilityStartDateTimeUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'MarkAsNewStartDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Product] ALTER column [MarkAsNewStartDateTimeUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'MarkAsNewEndDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Product] ALTER column [MarkAsNewEndDateTimeUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'AvailableStartDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_Product_PriceDatesEtc] ON [Product] DROP INDEX [IX_Product_VisibleIndividually_Published_Deleted_Extended] ON [Product] ALTER TABLE [Product] ALTER column [AvailableStartDateTimeUtc] [datetime2](7) NULL CREATE NONCLUSTERED INDEX [IX_Product_PriceDatesEtc] ON [Product] ([Price] ASC, [AvailableStartDateTimeUtc] ASC, [AvailableEndDateTimeUtc] ASC, [Published] ASC, [Deleted] ASC) CREATE NONCLUSTERED INDEX [IX_Product_VisibleIndividually_Published_Deleted_Extended] ON [Product] ([VisibleIndividually],[Published],[Deleted]) INCLUDE ([Id],[AvailableStartDateTimeUtc],[AvailableEndDateTimeUtc]) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Product' AND COLUMN_NAME = 'AvailableEndDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_Product_PriceDatesEtc] ON [Product] DROP INDEX [IX_Product_VisibleIndividually_Published_Deleted_Extended] ON [Product] ALTER TABLE [Product] ALTER column [AvailableEndDateTimeUtc] [datetime2](7) NULL CREATE NONCLUSTERED INDEX [IX_Product_PriceDatesEtc] ON [Product] ([Price] ASC, [AvailableStartDateTimeUtc] ASC, [AvailableEndDateTimeUtc] ASC, [Published] ASC, [Deleted] ASC) CREATE NONCLUSTERED INDEX [IX_Product_VisibleIndividually_Published_Deleted_Extended] ON [Product] ([VisibleIndividually],[Published],[Deleted]) INCLUDE ([Id],[AvailableStartDateTimeUtc],[AvailableEndDateTimeUtc]) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'QueuedEmail' AND COLUMN_NAME = 'DontSendBeforeDateUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_QueuedEmail_SentOnUtc_DontSendBeforeDateUtc_Extended] ON [QueuedEmail] ALTER TABLE [QueuedEmail] ALTER column [DontSendBeforeDateUtc] [datetime2](7) NULL CREATE NONCLUSTERED INDEX [IX_QueuedEmail_SentOnUtc_DontSendBeforeDateUtc_Extended] ON [QueuedEmail] ([SentOnUtc], [DontSendBeforeDateUtc]) INCLUDE ([SentTries]) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'QueuedEmail' AND COLUMN_NAME = 'SentOnUtc' and DATA_TYPE = 'datetime') BEGIN DROP INDEX [IX_QueuedEmail_SentOnUtc_DontSendBeforeDateUtc_Extended] ON [QueuedEmail] ALTER TABLE [QueuedEmail] ALTER column [SentOnUtc] [datetime2](7) NULL CREATE NONCLUSTERED INDEX [IX_QueuedEmail_SentOnUtc_DontSendBeforeDateUtc_Extended] ON [QueuedEmail] ([SentOnUtc], [DontSendBeforeDateUtc]) INCLUDE ([SentTries]) END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RecurringPayment' AND COLUMN_NAME = 'StartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [RecurringPayment] ALTER column [StartDateUtc] [datetime2](7) NOT NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RewardPointsHistory' AND COLUMN_NAME = 'EndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [RewardPointsHistory] ALTER column [EndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ScheduleTask' AND COLUMN_NAME = 'LastStartUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ScheduleTask] ALTER column [LastStartUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ScheduleTask' AND COLUMN_NAME = 'LastEndUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ScheduleTask] ALTER column [LastEndUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ScheduleTask' AND COLUMN_NAME = 'LastSuccessUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ScheduleTask] ALTER column [LastSuccessUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Shipment' AND COLUMN_NAME = 'ShippedDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Shipment] ALTER column [ShippedDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Shipment' AND COLUMN_NAME = 'DeliveryDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [Shipment] ALTER column [DeliveryDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ShoppingCartItem' AND COLUMN_NAME = 'RentalStartDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ShoppingCartItem] ALTER column [RentalStartDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'ShoppingCartItem' AND COLUMN_NAME = 'RentalEndDateUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [ShoppingCartItem] ALTER column [RentalEndDateUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TierPrice' AND COLUMN_NAME = 'StartDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [TierPrice] ALTER column [StartDateTimeUtc] [datetime2](7) NULL END GO IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'TierPrice' AND COLUMN_NAME = 'EndDateTimeUtc' and DATA_TYPE = 'datetime') BEGIN ALTER TABLE [TierPrice] ALTER column [EndDateTimeUtc] [datetime2](7) NULL END GO -- alter procedure ALTER PROCEDURE [FullText_Enable] AS BEGIN --create catalog EXEC(' IF NOT EXISTS (SELECT 1 FROM sys.fulltext_catalogs WHERE [name] = ''nopCommerceFullTextCatalog'') CREATE FULLTEXT CATALOG [nopCommerceFullTextCatalog] AS DEFAULT') DECLARE @SQL nvarchar(500); DECLARE @index_name nvarchar(1000) DECLARE @ParmDefinition nvarchar(500); SELECT @SQL = N'SELECT @index_name_out = i.name FROM sys.tables AS tbl INNER JOIN sys.indexes AS i ON (i.index_id > 0 and i.is_hypothetical = 0) AND (i.object_id=tbl.object_id) WHERE (i.is_unique=1 and i.is_disabled=0) and (tbl.name=@table_name)' SELECT @ParmDefinition = N'@table_name varchar(100), @index_name_out nvarchar(1000) OUTPUT' EXEC sp_executesql @SQL, @ParmDefinition, @table_name = 'Product', @index_name_out=@index_name OUTPUT --create indexes DECLARE @create_index_text nvarchar(4000) SET @create_index_text = ' IF NOT EXISTS (SELECT 1 FROM sys.fulltext_indexes WHERE object_id = object_id(''[Product]'')) CREATE FULLTEXT INDEX ON [Product]([Name], [ShortDescription], [FullDescription]) KEY INDEX [' + @index_name + '] ON [nopCommerceFullTextCatalog] WITH CHANGE_TRACKING AUTO' EXEC(@create_index_text) EXEC sp_executesql @SQL, @ParmDefinition, @table_name = 'LocalizedProperty', @index_name_out=@index_name OUTPUT SET @create_index_text = ' IF NOT EXISTS (SELECT 1 FROM sys.fulltext_indexes WHERE object_id = object_id(''[LocalizedProperty]'')) CREATE FULLTEXT INDEX ON [LocalizedProperty]([LocaleValue]) KEY INDEX [' + @index_name + '] ON [nopCommerceFullTextCatalog] WITH CHANGE_TRACKING AUTO' EXEC(@create_index_text) EXEC sp_executesql @SQL, @ParmDefinition, @table_name = 'ProductTag', @index_name_out=@index_name OUTPUT SET @create_index_text = ' IF NOT EXISTS (SELECT 1 FROM sys.fulltext_indexes WHERE object_id = object_id(''[ProductTag]'')) CREATE FULLTEXT INDEX ON [ProductTag]([Name]) KEY INDEX [' + @index_name + '] ON [nopCommerceFullTextCatalog] WITH CHANGE_TRACKING AUTO' EXEC(@create_index_text) END GO -- alter procedure ALTER PROCEDURE [CategoryLoadAllPaged] ( @ShowHidden BIT = 0, @Name NVARCHAR(MAX) = NULL, @StoreId INT = 0, @CustomerRoleIds NVARCHAR(MAX) = NULL, @PageIndex INT = 0, @PageSize INT = 2147483644, @TotalRecords INT = NULL OUTPUT ) AS BEGIN SET NOCOUNT ON --filter by customer role IDs (access control list) SET @CustomerRoleIds = ISNULL(@CustomerRoleIds, '') CREATE TABLE #FilteredCustomerRoleIds ( CustomerRoleId INT NOT NULL ) INSERT INTO #FilteredCustomerRoleIds (CustomerRoleId) SELECT CAST(data AS INT) FROM [nop_splitstring_to_table](@CustomerRoleIds, ',') DECLARE @FilteredCustomerRoleIdsCount INT = (SELECT COUNT(1) FROM #FilteredCustomerRoleIds) --ordered categories CREATE TABLE #OrderedCategoryIds ( [Id] int IDENTITY (1, 1) NOT NULL, [CategoryId] int NOT NULL ) --get max length of DisplayOrder and Id columns (used for padding Order column) DECLARE @lengthId INT = (SELECT LEN(MAX(Id)) FROM [Category]) DECLARE @lengthOrder INT = (SELECT LEN(MAX(DisplayOrder)) FROM [Category]) --get category tree ;WITH [CategoryTree] AS (SELECT [Category].[Id] AS [Id], (select RIGHT(REPLICATE('0', @lengthOrder)+ RTRIM(CAST([Category].[DisplayOrder] AS NVARCHAR(MAX))), @lengthOrder)) + '-' + (select RIGHT(REPLICATE('0', @lengthId)+ RTRIM(CAST([Category].[Id] AS NVARCHAR(MAX))), @lengthId)) AS [Order] FROM [Category] WHERE [Category].[ParentCategoryId] = 0 UNION ALL SELECT [Category].[Id] AS [Id], [CategoryTree].[Order] + '|' + (select RIGHT(REPLICATE('0', @lengthOrder)+ RTRIM(CAST([Category].[DisplayOrder] AS NVARCHAR(MAX))), @lengthOrder)) + '-' + (select RIGHT(REPLICATE('0', @lengthId)+ RTRIM(CAST([Category].[Id] AS NVARCHAR(MAX))), @lengthId)) AS [Order] FROM [Category] INNER JOIN [CategoryTree] ON [CategoryTree].[Id] = [Category].[ParentCategoryId]) INSERT INTO #OrderedCategoryIds ([CategoryId]) SELECT [Category].[Id] FROM [CategoryTree] RIGHT JOIN [Category] ON [CategoryTree].[Id] = [Category].[Id] --filter results WHERE [Category].[Deleted] = 0 AND (@ShowHidden = 1 OR [Category].[Published] = 1) AND (@Name IS NULL OR @Name = '' OR [Category].[Name] LIKE ('%' + @Name + '%')) AND (@ShowHidden = 1 OR @FilteredCustomerRoleIdsCount = 0 OR [Category].[SubjectToAcl] = 0 OR EXISTS (SELECT 1 FROM #FilteredCustomerRoleIds [roles] WHERE [roles].[CustomerRoleId] IN (SELECT [acl].[CustomerRoleId] FROM [AclRecord] acl WITH (NOLOCK) WHERE [acl].[EntityId] = [Category].[Id] AND [acl].[EntityName] = 'Category') ) ) AND (@StoreId = 0 OR [Category].[LimitedToStores] = 0 OR EXISTS (SELECT 1 FROM [StoreMapping] sm WITH (NOLOCK) WHERE [sm].[EntityId] = [Category].[Id] AND [sm].[EntityName] = 'Category' AND [sm].[StoreId] = @StoreId ) ) ORDER BY ISNULL([CategoryTree].[Order], 1) --total records SET @TotalRecords = @@ROWCOUNT --paging SELECT [Category].* FROM #OrderedCategoryIds AS [Result] INNER JOIN [Category] ON [Result].[CategoryId] = [Category].[Id] WHERE ([Result].[Id] > @PageSize * @PageIndex AND [Result].[Id] <= @PageSize * (@PageIndex + 1)) ORDER BY [Result].[Id] DROP TABLE #FilteredCustomerRoleIds DROP TABLE #OrderedCategoryIds END -- delete unused functions IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[nop_getnotnullnotempty]') AND type = N'FN') BEGIN DROP FUNCTION [nop_getnotnullnotempty] END GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[nop_getprimarykey_indexname]') AND type = N'FN') BEGIN DROP FUNCTION [nop_getprimarykey_indexname] END GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[nop_padright]') AND type = N'FN') BEGIN DROP FUNCTION [nop_padright] END GO