forked from nopSolutions/nopCommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade.sql
2289 lines (2034 loc) · 77.6 KB
/
upgrade.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--upgrade scripts from nopCommerce 3.60 to 3.70
--new locale resources
declare @resources xml
--a resource will be deleted if its value is empty
set @resources='
<Language>
<LocaleResource Name="Products.MinimumQuantityNotification">
<Value>This product has a minimum quantity of {0}</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.DisplayTaxShippingInfoShoppingCart">
<Value>Display tax/shipping info (shopping cart)</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.DisplayTaxShippingInfoShoppingCart.Hint">
<Value>Check to display tax and shipping info on the shopping cart page. This option is used in Germany.</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.TaxShipping.ExclTax">
<Value><![CDATA[All prices are entered excluding tax. Excluding <a href="{0}">shipping</a>]]></Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.TaxShipping.InclTax">
<Value><![CDATA[All prices are entered including tax. Excluding <a href="{0}">shipping</a>]]></Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.ProductReviews.DeleteSelected">
<Value>Delete selected</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.News.Comments.DeleteSelected">
<Value>Delete selected</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.Blog.Comments.DeleteSelected">
<Value>Delete selected</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Stores.Fields.DefaultLanguage">
<Value>Default language</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Stores.Fields.DefaultLanguage.Hint">
<Value>This property allows a store owner to specify a default language for a store. If not specified, then the default language display order will be used.</Value>
</LocaleResource>
<LocaleResource Name="Admin.SalesReport.Bestsellers.Vendor">
<Value>Vendor</Value>
</LocaleResource>
<LocaleResource Name="Admin.SalesReport.Bestsellers.Vendor.Hint">
<Value>Search by a specific vendor.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.OverriddenGiftCardAmount">
<Value>Overridden gift card amount</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.OverriddenGiftCardAmount.Hint">
<Value>Enter gift card amount that can be used after purchase. If not specified, then product price will be used.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.CustomerUser.DateOfBirthMinimumAge">
<Value>Customer minimum age</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.CustomerUser.DateOfBirthMinimumAge.Hint">
<Value>Enter minimum allowed age. Leave empty if customers of all ages are allowed.</Value>
</LocaleResource>
<LocaleResource Name="Account.Fields.DateOfBirth.MinimumAge">
<Value>You have to be {0}</Value>
</LocaleResource>
<LocaleResource Name="Plugins.Shipping.AustraliaPost.Fields.HideDeliveryInformation">
<Value>Hide delivery information</Value>
</LocaleResource>
<LocaleResource Name="Plugins.Shipping.AustraliaPost.Fields.HideDeliveryInformation.Hint">
<Value>Check to hide delivery information as description of returned shipping methods.</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.Rental.StartDateShouldBeFuture">
<Value>Rental start date should be the future date</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.Fields.Picture">
<Value>Picture</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.Fields.Picture.Hint">
<Value>The vendor picture.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Media.VendorThumbPictureSize">
<Value>Vendor thumbnail image size</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Media.VendorThumbPictureSize.Hint">
<Value>The default size (pixels) for vendor thumbnail images.</Value>
</LocaleResource>
<LocaleResource Name="Media.Vendor.ImageAlternateTextFormat">
<Value>Picture for vendor {0}</Value>
</LocaleResource>
<LocaleResource Name="Media.Vendor.ImageLinkTitleFormat">
<Value>Show products of vendor {0}</Value>
</LocaleResource>
<LocaleResource Name="Enums.Nop.Core.Domain.Catalog.ProductType.GroupedProduct">
<Value>Grouped (product with variants)</Value>
</LocaleResource>
<LocaleResource Name="Enums.Nop.Core.Domain.Catalog.ProductType.SimpleProduct">
<Value>Simple</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.AssociatedProducts">
<Value>Associated products (variants)</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Vendor.AllowCustomersToApplyForVendorAccount">
<Value>Allow customers to apply for vendor account</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Vendor.AllowCustomersToApplyForVendorAccount.Hint">
<Value>Check to allow customers users to fill a form to become a new vendor. Then a store owner will have to manually approve it.</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount">
<Value>Apply for vendor account</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Email">
<Value>Email</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Email.Hint">
<Value>Enter your email address</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Email.Required">
<Value>Email is required.</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Name">
<Value>Vendor name</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Name.Hint">
<Value>Enter vendor name</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Name.Required">
<Value>Vendor name is required.</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Submitted">
<Value>Your request has been submitted successfully. We''ll contact you soon.</Value>
</LocaleResource>
<LocaleResource Name="PageTitle.Vendors.Apply">
<Value>Apply for vendor account</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.Button">
<Value>Submit</Value>
</LocaleResource>
<LocaleResource Name="Vendors.ApplyAccount.AlreadyApplied">
<Value>You already applied for a vendor account. Please register as a new customer in order to apply for one more vendor account.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.RewardPoints.PointsAccumulatedForAllStores">
<Value>Points accumulated for all stores</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.RewardPoints.PointsAccumulatedForAllStores.Hint">
<Value>Check to accumulate all reward points in one balance for all stores so they can be used in any store. Otherwise, each store has its own rewards points and they can only be used in that store. WARNING: not recommended to change in production environment with several stores already created.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.RewardPoints.Fields.Store">
<Value>Store</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.RewardPoints.Fields.AddRewardPointsStore">
<Value>Store</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.RewardPoints.Fields.AddRewardPointsStore.Hint">
<Value>Choose a store. It''s useful only when you have "Points accumulated for all stores" setting disabled.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.AllowViewUnpublishedProductPage">
<Value>Allow viewing of unpublished product details page</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.AllowViewUnpublishedProductPage.Hint">
<Value>Check to allow viewing of unpublished product details page. This way SEO won''t be affected by search crawlers when a product is temporary unpublished. Please note that a store owner always has access to unpublished products.</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.Discount.CannotBeUsedAnymore">
<Value>Sorry, you''ve used this discount already</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.Discount.CannotBeUsedWithGiftCards">
<Value>Sorry, this discount cannot be used with gift cards in the cart</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.Discount.Expired">
<Value>Sorry, this offer is expired</Value>
</LocaleResource>
<LocaleResource Name="ShoppingCart.Discount.NotStartedYet">
<Value>Sorry, this offer is not started yet</Value>
</LocaleResource>
<LocaleResource Name="Plugins.DiscountRules.HadSpentAmount.NotEnough">
<Value>Sorry, this offer requires more money spent (previously placed orders)</Value>
</LocaleResource>
<LocaleResource Name="Wishlist.AddToCart.Error">
<Value>Some product(s) from wishlist could not be moved to the cart for some reasons.</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.Topics.Acl">
<Value>Access control list</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.Topics.Fields.SubjectToAcl">
<Value>Subject to ACL</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.Topics.Fields.SubjectToAcl.Hint">
<Value>Determines whether the topic is subject to ACL (access control list).</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.Topics.Fields.AclCustomerRoles">
<Value>Customer roles</Value>
</LocaleResource>
<LocaleResource Name="Admin.ContentManagement.Topics.Fields.AclCustomerRoles.Hint">
<Value>Select customer roles for which the topic will be shown.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.BackInStockSubscriptions">
<Value>Back in stock subscriptions</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.BackInStockSubscriptions.Store">
<Value>Store</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.BackInStockSubscriptions.Product">
<Value>Product</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.BackInStockSubscriptions.CreatedOn">
<Value>Subscribed on</Value>
</LocaleResource>
<LocaleResource Name="Search.Button">
<Value>Search</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.EnableCssBundling.Hint">
<Value>Enable to combine (bundle) multiple CSS files into a single file. Do not enable if you''re running nopCommerce in IIS virtual directory. Note that this functionality requires significant server resources (not recommended to use with cheap shared hosting plans).</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.EnableJsBundling.Hint">
<Value>Enable to combine (bundle) multiple JavaScript files into a single file. Note that this functionality requires significant server resources (not recommended to use with cheap shared hosting plans).</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition">
<Value>Condition</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition.ViewLink">
<Value>View/Edit condition</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition.Description">
<Value>Conditional attributes appear if a previous attribute is selected, such as having an option for personalizing clothing with a name and only providing the text input box if the "Personalize" radio button is checked</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition.EnableCondition">
<Value>Enable condition</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition.EnableCondition.Hint">
<Value>Check to specify a condition (depending on other attribute) when this attribute should be enabled (visible).</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition.Attributes">
<Value>Attribute</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.ProductAttributes.Attributes.Condition.Attributes.Hint">
<Value>Choose an attribute.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.DynamicPriceUpdateAjax">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.DynamicPriceUpdateAjax.Hint">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.EnableDynamicPriceUpdate">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.EnableDynamicPriceUpdate.Hint">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.MinOrderSubtotalAmountIncludingTax">
<Value>Calculate ''Min order sub-total amount'' including tax</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.MinOrderSubtotalAmountIncludingTax.Hint">
<Value>Check to calculate ''Min order sub-total amount'' value including tax; otherwise excluding tax.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.MarkAsNew">
<Value>Mark as new</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.MarkAsNew.Hint">
<Value>Check to mark this product as New</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.MarkAsNewStartDateTimeUtc">
<Value>Mark as new. Start date</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.MarkAsNewStartDateTimeUtc.Hint">
<Value>Set Product as New from Date in Coordinated Universal Time (UTC).</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.MarkAsNewEndDateTimeUtc">
<Value>Mark as new. End date</Value>
</LocaleResource>
<LocaleResource Name="Admin.Catalog.Products.Fields.MarkAsNewEndDateTimeUtc.Hint">
<Value>Set Product as New to Date in Coordinated Universal Time (UTC).</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.RecentlyAddedProductsEnabled">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.RecentlyAddedProductsEnabled.Hint">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.RecentlyAddedProductsNumber">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.RecentlyAddedProductsNumber.Hint">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.NewProductsEnabled">
<Value>''New products'' page enabled</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.NewProductsEnabled.Hint">
<Value>Check to enable the ''New products'' page in your store</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.NewProductsNumber">
<Value>Number of products on ''New products'' page</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.NewProductsNumber.Hint">
<Value>The number of products to display when ''New products'' page is enabled.</Value>
</LocaleResource>
<LocaleResource Name="PageTitle.RecentlyAddedProducts">
<Value></Value>
</LocaleResource>
<LocaleResource Name="PageTitle.NewProducts">
<Value>New Products</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.Fields.Newsletter">
<Value>Newsletter</Value>
</LocaleResource>
<LocaleResource Name="Admin.Customers.Customers.Fields.Newsletter.Hint">
<Value>Check to subscribe to newsletter.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Orders.List.BillingLastName">
<Value>Billing last name</Value>
</LocaleResource>
<LocaleResource Name="Admin.Orders.List.BillingLastName.Hint">
<Value>Filter by customer billing last name.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Orders.List.CustomerEmail">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Orders.List.CustomerEmail.Hint">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Orders.List.BillingEmail">
<Value>Billing email address</Value>
</LocaleResource>
<LocaleResource Name="Admin.Orders.List.BillingEmail.Hint">
<Value>Filter by customer billing email address.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Promotions.Discounts.Fields.AppliedToSubCategories">
<Value>Apply to subcategories</Value>
</LocaleResource>
<LocaleResource Name="Admin.Promotions.Discounts.Fields.AppliedToSubCategories.Hint">
<Value>Check to apply discount to subcategories of the selected parent. But please note that it can affect performance if you have a lot of nested subcategories.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.CaptchaShowOnApplyVendorPage">
<Value>Show on apply for vendor account page</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.CaptchaShowOnApplyVendorPage.Hint">
<Value>Check to show CAPTCHA on apply for vendor account page.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons">
<Value>Return request reasons</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Added">
<Value>The new return request reason has been added successfully.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.AddNew">
<Value>Add new return request reason</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.BackToList">
<Value>back to return request reason list</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Deleted">
<Value>The return request reason has been deleted successfully.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.DisplayOrder">
<Value>Display order</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.DisplayOrder.Hint">
<Value>The return request reason display order. 1 represents the first item in the list.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.EditDetails">
<Value>Edit return request reason details</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Hint">
<Value>List of reasons a customer will be able to choose when submitting a return request.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Name.Required">
<Value>Please provide a name.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Name">
<Value>Name</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Name.Hint">
<Value>The return request reason name.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestReasons.Updated">
<Value>The return request reason has been updated successfully.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions">
<Value>Return request actions</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Added">
<Value>The new return request action has been added successfully.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.AddNew">
<Value>Add new return request action</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.BackToList">
<Value>back to return request action list</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Deleted">
<Value>The return request action has been deleted successfully.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.DisplayOrder">
<Value>Display order</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.DisplayOrder.Hint">
<Value>The return request action display order. 1 represents the first item in the list.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.EditDetails">
<Value>Edit return request action details</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Hint">
<Value>List of actions a customer will be able to choose when submitting a return request.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Name.Required">
<Value>Please provide a name.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Name">
<Value>Name</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Name.Hint">
<Value>The return request action name.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Order.ReturnRequestActions.Updated">
<Value>The return request action has been updated successfully.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Common.AddNewRecord">
<Value>Add new record</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.StoreClosedAllowForAdmins">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.GeneralCommon.StoreClosedAllowForAdmins.Hint">
<Value></Value>
</LocaleResource>
<LocaleResource Name="Admin.SalesReport.Bestsellers.Store">
<Value>Store</Value>
</LocaleResource>
<LocaleResource Name="Admin.SalesReport.Bestsellers.Store.Hint">
<Value>Filter report by orders placed in a specific store.</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.DisplayDiscontinuedMessageForUnpublishedProducts">
<Value>Discontinued message for unpublished products</Value>
</LocaleResource>
<LocaleResource Name="Admin.Configuration.Settings.Catalog.DisplayDiscontinuedMessageForUnpublishedProducts.Hint">
<Value>Check to display "a product has been discontinued" message when viewing details pages of unpublished products.</Value>
</LocaleResource>
<LocaleResource Name="Products.Discontinued">
<Value>Sorry - this product is no longer available</Value>
</LocaleResource>
<LocaleResource Name="Common.FileUploader.RemoveDownload">
<Value>Remove</Value>
</LocaleResource>
<LocaleResource Name="Common.FileUploader.DownloadUploadedFile">
<Value>Download</Value>
</LocaleResource>
<LocaleResource Name="Admin.ReturnRequests.Fields.ReasonForReturn.Required">
<Value>Reason for return is required</Value>
</LocaleResource>
<LocaleResource Name="Admin.ReturnRequests.Fields.RequestedAction.Required">
<Value>Requested action is required</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.VendorNotes">
<Value>Vendor notes</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.VendorNotes.AddButton">
<Value>Add vendor note</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.VendorNotes.AddTitle">
<Value>Add vendor note</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.VendorNotes.Fields.CreatedOn">
<Value>Created on</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.VendorNotes.Fields.Note">
<Value>Note</Value>
</LocaleResource>
<LocaleResource Name="Admin.Vendors.VendorNotes.Fields.Note.Hint">
<Value>Enter this vendor note message.</Value>
</LocaleResource>
<LocaleResource Name="RewardPoints.Message.ReturnedForOrder">
<Value>Returned back for order #{0}</Value>
</LocaleResource>
</Language>
'
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 [MessageTemplate]
WHERE [Name] = N'OrderRefunded.CustomerNotification')
BEGIN
INSERT [MessageTemplate] ([Name], [BccEmailAddresses], [Subject], [Body], [IsActive], [EmailAccountId], [LimitedToStores], [AttachedDownloadId])
VALUES (N'OrderRefunded.CustomerNotification', null, N'%Store.Name%. Order #%Order.OrderNumber% refunded', N'<p><a href="%Store.URL%">%Store.Name%</a> <br /><br />Hello %Order.CustomerFullName%, <br />Thanks for buying from <a href="%Store.URL%">%Store.Name%</a>. Order #%Order.OrderNumber% has been has been refunded. Please allow 7-14 days for the refund to be reflected in your account.<br /><br />Amount refunded: %Order.AmountRefunded%<br /><br />Below is the summary of the order. <br /><br />Order Number: %Order.OrderNumber%<br />Order Details: <a href="%Order.OrderURLForCustomer%" target="_blank">%Order.OrderURLForCustomer%</a><br />Date Ordered: %Order.CreatedOn%<br /><br /><br /><br />Billing Address<br />%Order.BillingFirstName% %Order.BillingLastName%<br />%Order.BillingAddress1%<br />%Order.BillingCity% %Order.BillingZipPostalCode%<br />%Order.BillingStateProvince% %Order.BillingCountry%<br /><br /><br /><br />Shipping Address<br />%Order.ShippingFirstName% %Order.ShippingLastName%<br />%Order.ShippingAddress1%<br />%Order.ShippingCity% %Order.ShippingZipPostalCode%<br />%Order.ShippingStateProvince% %Order.ShippingCountry%<br /><br />Shipping Method: %Order.ShippingMethod%<br /><br />%Order.Product(s)%</p>', 0, 0, 0, 0)
END
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'catalogsettings.displaytaxshippinginfoshoppingcart')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'catalogsettings.displaytaxshippinginfoshoppingcart', N'false', 0)
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Store]') and NAME='DefaultLanguageId')
BEGIN
ALTER TABLE [Store]
ADD [DefaultLanguageId] int NULL
END
GO
UPDATE [Store]
SET [DefaultLanguageId] = 0
WHERE [DefaultLanguageId] IS NULL
GO
ALTER TABLE [Store] ALTER COLUMN [DefaultLanguageId] int NOT NULL
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Product]') and NAME='OverriddenGiftCardAmount')
BEGIN
ALTER TABLE [Product]
ADD [OverriddenGiftCardAmount] decimal NULL
END
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'customersettings.dateofbirthminimumage')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'customersettings.dateofbirthminimumage', N'', 0)
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Vendor]') and NAME='PictureId')
BEGIN
ALTER TABLE [Vendor]
ADD [PictureId] int NULL
END
GO
UPDATE [Vendor]
SET [PictureId] = 0
WHERE [PictureId] IS NULL
GO
ALTER TABLE [Vendor] ALTER COLUMN [PictureId] int NOT NULL
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'mediasettings.vendorthumbpicturesize')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'mediasettings.vendorthumbpicturesize', N'450', 0)
END
GO
--rename some product templates
UPDATE [ProductTemplate]
SET [Name] = 'Grouped product (with variants)'
WHERE [ViewPath] = N'ProductTemplate.Grouped'
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'vendorsettings.allowcustomerstoapplyforvendoraccount')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'vendorsettings.allowcustomerstoapplyforvendoraccount', N'false', 0)
END
GO
--new topic
IF NOT EXISTS (
SELECT 1
FROM [dbo].[Topic]
WHERE [SystemName] = N'ApplyVendor')
BEGIN
INSERT [dbo].[Topic] ([SystemName], [TopicTemplateId], [IncludeInSitemap], [AccessibleWhenStoreClosed], [LimitedToStores], [IncludeInFooterColumn1], [IncludeInFooterColumn2], [IncludeInFooterColumn3], [IncludeInTopMenu], [IsPasswordProtected], [DisplayOrder] , [Title], [Body])
VALUES (N'ApplyVendor', 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, N'', N'<p>Put your apply vendor instructions here. You can edit this in the admin site.</p>')
END
GO
--'New vendor account submitted' message template
IF NOT EXISTS (
SELECT 1
FROM [MessageTemplate]
WHERE [Name] = N'VendorAccountApply.StoreOwnerNotification')
BEGIN
INSERT [MessageTemplate] ([Name], [BccEmailAddresses], [Subject], [Body], [IsActive], [EmailAccountId], [LimitedToStores], [AttachedDownloadId])
VALUES (N'VendorAccountApply.StoreOwnerNotification', null, N'%Store.Name%. New vendor account submitted.', N'<p><a href="%Store.URL%">%Store.Name%</a> <br /><br />%Customer.FullName% (%Customer.Email%) has just submitted for a vendor account. Details are below:<br />Vendor name: %Vendor.Name%<br />Vendor email: %Vendor.Email%<br /><br />You can activate it in admin area.</p>', 1, 0, 0, 0)
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[RewardPointsHistory]') and NAME='StoreId')
BEGIN
ALTER TABLE [RewardPointsHistory]
ADD [StoreId] int NULL
END
GO
--just use the first store
--we cannot find original store IDs of some orders
--furthermore, it won't work for points granted for registration (if enabled)
UPDATE [RewardPointsHistory]
SET [StoreId] = (SELECT TOP 1 [Id] from [Store])
WHERE [StoreId] IS NULL
GO
ALTER TABLE [RewardPointsHistory] ALTER COLUMN [StoreId] int NOT NULL
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'rewardpointssettings.pointsaccumulatedforallstores')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'rewardpointssettings.pointsaccumulatedforallstores', N'true', 0)
END
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'catalogsettings.allowviewunpublishedproductpage')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'catalogsettings.allowviewunpublishedproductpage', N'true', 0)
END
GO
--'Order refunded' message template
IF NOT EXISTS (
SELECT 1
FROM [MessageTemplate]
WHERE [Name] = N'OrderRefunded.StoreOwnerNotification')
BEGIN
INSERT [MessageTemplate] ([Name], [BccEmailAddresses], [Subject], [Body], [IsActive], [EmailAccountId], [LimitedToStores], [AttachedDownloadId])
VALUES (N'OrderRefunded.StoreOwnerNotification', null, N'%Store.Name%. Order #%Order.OrderNumber% refunded', N'<p><a href="%Store.URL%">%Store.Name%</a> <br /><br />Order #%Order.OrderNumber% has been just refunded<br /><br />Amount refunded: %Order.AmountRefunded%<br /><br />Date Ordered: %Order.CreatedOn%</p>', 0, 0, 0, 0)
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Topic]') and NAME='SubjectToAcl')
BEGIN
ALTER TABLE [Topic]
ADD [SubjectToAcl] bit NULL
END
GO
UPDATE [Topic]
SET [SubjectToAcl] = 0
WHERE [SubjectToAcl] IS NULL
GO
ALTER TABLE [Topic] ALTER COLUMN [SubjectToAcl] bit NOT NULL
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[ScheduleTask]') and NAME='LeasedByMachineName')
BEGIN
ALTER TABLE [ScheduleTask]
ADD [LeasedByMachineName] nvarchar(MAX) NULL
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[ScheduleTask]') and NAME='LeasedUntilUtc')
BEGIN
ALTER TABLE [ScheduleTask]
ADD [LeasedUntilUtc] datetime NULL
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Product_ProductAttribute_Mapping]') and NAME='ConditionAttributeXml')
BEGIN
ALTER TABLE [Product_ProductAttribute_Mapping]
ADD [ConditionAttributeXml] nvarchar(MAX) NULL
END
GO
--delete setting
DELETE FROM [Setting]
WHERE [name] = N'catalogsettings.dynamicpriceupdateajax'
GO
--delete setting
DELETE FROM [Setting]
WHERE [name] = N'catalogsettings.enabledynamicpriceupdate'
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'catalogsettings.ajaxprocessattributechange')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'catalogsettings.ajaxprocessattributechange', N'true', 0)
END
GO
--new setting
IF NOT EXISTS (SELECT 1 FROM [Setting] WHERE [name] = N'ordersettings.minordersubtotalamountincludingtax')
BEGIN
INSERT [Setting] ([Name], [Value], [StoreId])
VALUES (N'ordersettings.minordersubtotalamountincludingtax', N'false', 0)
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Product]') and NAME='MarkAsNew')
BEGIN
ALTER TABLE [Product]
ADD [MarkAsNew] bit NULL
END
GO
UPDATE [Product]
SET [MarkAsNew] = 0
WHERE [MarkAsNew] IS NULL
GO
ALTER TABLE [Product] ALTER COLUMN [MarkAsNew] bit NOT NULL
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Product]') and NAME='MarkAsNewStartDateTimeUtc')
BEGIN
ALTER TABLE [Product]
ADD [MarkAsNewStartDateTimeUtc] datetime NULL
END
GO
--new column
IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[Product]') and NAME='MarkAsNewEndDateTimeUtc')
BEGIN
ALTER TABLE [Product]
ADD [MarkAsNewEndDateTimeUtc] datetime NULL
END
GO
--a stored procedure update
IF EXISTS (
SELECT *
FROM sys.objects
WHERE object_id = OBJECT_ID(N'[ProductLoadAllPaged]') AND OBJECTPROPERTY(object_id,N'IsProcedure') = 1)
DROP PROCEDURE [ProductLoadAllPaged]
GO
CREATE PROCEDURE [dbo].[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
@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 <prefix_term>, 5 - using CONTAINS and OR with <prefix_term>, 10 - using CONTAINS and AND with <prefix_term>
@FilteredSpecs nvarchar(MAX) = null, --filter by attributes (comma-separated list). 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 subjet 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,
@sql nvarchar(max),
@sql_orderby nvarchar(max)
SET NOCOUNT ON
--filter by keywords
SET @Keywords = isnull(@Keywords, '')
SET @Keywords = rtrim(ltrim(@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 <prefix_term>
SET @Keywords = ' "' + @Keywords + '*" '
END
ELSE
BEGIN
--5 - using CONTAINS and OR with <prefix_term>
--10 - using CONTAINS and AND with <prefix_term>
--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 <prefix_term>
BEGIN
SET @concat_term = 'OR'
END
IF @FullTextMode = 10 --10 - using CONTAINS and AND with <prefix_term>
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 '