This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class Searcher | |
| { | |
| public static List<SearchResult> DoSearch(string searchTerm) | |
| { | |
| var searchIndex = ContentSearchManager.GetIndex("MySearchIndex"); // Get the search index | |
| var searchPredicate = GetSearchPredicate(searchTerm); // Build the search predicate | |
| using (var searchContext = searchIndex.CreateSearchContext()) // Get a context of the search index | |
| { | |
| var searchResults = searchContext.GetQueryable<SearchModel>().Where(searchPredicate); // Search the index for items which match the predicate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
| <sitecore> | |
| <settings> | |
| <setting name="Analytics.PerformLookup"> | |
| <patch:attribute name="value">false</patch:attribute> | |
| </setting> | |
| </settings> | |
| </sitecore> | |
| </configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <reporting> | |
| <dataProvider> | |
| <datasources> | |
| <add key="item"> | |
| <FiltersFactory> | |
| <param desc="definitionDatabaseName">web</param> | |
| </FiltersFactory> | |
| </add> | |
| <add key="collection"> | |
| <FiltersFactory> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Raffle | |
| { | |
| public int RaffleId { get; set; } | |
| public virtual List<Ticket> Tickets { get; set; } | |
| } | |
| public class Ticket | |
| { | |
| [Key, Column(Order = 0)] | |
| [DatabaseGenerated(DatabaseGeneratedOption.None)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static readonly Guid ProductDefinitionGuid = new Guid("{9B19A3A0-287B-4DA4-B45E-018BD94F2718}"); // Product (template in SC content tree) | |
| private static readonly Guid ProductVariantDefinitionGuid = new Guid("{70D1C14E-15FA-F05C-28D9-2E6DEAAD2A27}"); // Product Variant (template in SC content tree) | |
| private static readonly PriceGroup AuPriceGroup = PriceGroup.SingleOrDefault(x => x.Name == "AU 10 pct"); | |
| // Model to create a product | |
| public class CreateProductModel | |
| { | |
| public string Sku { get; set; } | |
| public string Name { get; set; } | |
| public bool AllowOrdering { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Set a custom property on a product | |
| /// </summary> | |
| /// <param name="product">Product</param> | |
| /// <param name="propertyName">Property name</param> | |
| /// <param name="propertyValue">Property value</param> | |
| public static void SetCustomProperty(Product product, string propertyName, string propertyValue) | |
| { | |
| var property = product[propertyName]; | |
| property.Value = propertyValue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Gets all categories | |
| /// </summary> | |
| /// <returns>All categories</returns> | |
| public static List<Category> GetCategories() | |
| { | |
| return Catalog.Categories.ToList(); | |
| } | |
| /// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Get a catalogue | |
| /// </summary> | |
| /// <param name="catalogueName">name of the catalogue</param> | |
| /// <returns>Product catalogue</returns> | |
| public static ProductCatalog GetCatalogue(string catalogueName) | |
| { | |
| List<ProductCatalog> catalogs = UCommerce.Api.CatalogLibrary.GetAllCatalogs(); | |
| return catalogs.FirstOrDefault(productCatalog => productCatalog.Name == catalogueName); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace MyProject.Jobs | |
| { | |
| public string param {get; set;} | |
| public class DataSync | |
| { | |
| public void DoSync() | |
| { | |
| // code goes here | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace MyProject.Jobs | |
| { | |
| public class DataSync | |
| { | |
| public void DoSync() | |
| { | |
| // code goes here | |
| } | |
| } | |
| } |