Guides

MerchelloHelper

Instantiating

// new instance of the MerchelloHelper with data modifiers enabled
var merchello = new MerchelloHelper();

// new instance of the MerchelloHelper without data modifiers enabled
var merchello = new MerchelloHelper(false);

Properties

NameDescription
QueryGets an instance of the ICachedQueryProvider
ValidationGets an instance of the IValidationHelper

ICachedQueryProvider Properties

📘

Examine backed queries

Generally speaking CachedQueryProviders in Merchello have to workflows.

  1. Single entity queries like GetByKey will first check the respective Merchello Examine index for the existence of the GUID key passed and return value directly from the index if found. If the value is not found, the full graph object query is performed against the database and the value is re-indexed if found then returned.

  2. Queries that return a collection, like Search( ... ) will first query the database for a Page which then searches the Examine index using the GetByKey method described above.

Query.Customer Methods

var merchello = new MerchelloHelper();

var customerQuery = merchello.Query.Customer;
NameDescription
GetByKeyGets an CustomerDisplay by it's key
GetFromCollection(Guid, Int64, Int64, String, SortDirection)Gets customers from a collection. Returns QueryResultDisplay
GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)Gets customers in the collection filtered by a search term. Returns QueryResultDisplay
GetNotInCollection(Guid, Int64, Int64, String, SortDirection)Gets customers not in the collection. Returns QueryResultDisplay
GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)Gets customers not in the collection filtered by a search term. Returns QueryResultDisplay
Search(Int64, Int64, String, SortDirection)Searches all customers. Returns QueryResultDisplay
Search(String, Int64, Int64, String, SortDirection)Searches all customers filtered by a search term. Returns QueryResultDisplay
Search(DateTime, DateTime, Int64, Int64, String, SortDirection)Searches customers that have customer dates within a specified date range. Returns QueryResultDisplay

Query.Invoice Methods

var merchello = new MerchelloHelper();

var invoiceQuery = merchello.Query.Invoice;
NameDescription
GetByCustomerKeyGets the collection of all customer invoices
GetByKeyGets an InvoiceDisplay by it's key
GetFromCollection(Guid, Int64, Int64, String, SortDirection)Gets entities from a collection.
GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)Gets entities in the collection filtered by a search term
GetNotInCollection(Guid, Int64, Int64, String, SortDirection)Gets entities not in the collection.
GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)Gets entities not in the collection filtered by a search term.
Search(Int64, Int64, String, SortDirection)Searches all invoices
Search(String, Int64, Int64, String, SortDirection)Searches all invoices by a term
Search(DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)Searches invoices that have invoice dates within a specified date range
Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection, Boolean)Searches invoices that have invoice dates within a specified date range with an export value
Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection, Boolean)Searches invoices that have invoice dates within a specified date range with a particular invoice status
Search(String, DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)Searches invoices that have invoice dates within a specified date range and a specific term
Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection, Boolean)Searches invoices that have invoice dates within a specified date range with a particular invoice status and export value
SearchByCustomer(Guid, Int64, Int64, String, SortDirection)Searches for invoices associated with a customer
SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)Searches for invoices associated with a customer and invoice status
SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)Searches for invoices by invoice status.
SearchByInvoiceStatus(Guid, Boolean, Int64, Int64, String, SortDirection)Searches for invoices by invoice status and exported value

Query.Order Methods

var merchello = new MerchelloHelper();

var orderQuery = merchello.Query.Order;
NameDescription
GetByInvoiceKeyGets a collection of orders by the invoice key.
GetByInvoiceKeyGets an OrderDisplay by it's key.
Search(Int64, Int64, String, SortDirection)Searches all orders
Search(DateTime, DateTime, Int64, Int64, String, SortDirection)Searches orders that have order dates within a specified date range
Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection)Searches orders that have order dates within a specified date range with an export value
Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection)Searches order that have order dates within a specified date range with a particular order status
Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection)Searches orders that have order dates within a specified date range with a particular order status and export value
SearchByOrderStatus(Guid, Int64, Int64, String, SortDirection)Searches for orders by order status.
SearchByOrderStatus(Guid, Boolean, Int64, Int64, String, SortDirection)Searches for orders by order status and exported value

Query.Product Methods

// with data modifiers
var merchello = new MerchelloHelper();

// or 

// without data modifiers
var merchello = new MerchelloHelper(false);

var productQuery = merchello.Query.Product;
NameDescription

Public Methods

TypedProductContent(string key)Gets IProductContent by it's unique key (as string)
TypedProductContent(Guid key)Gets IProductContent by it's unique key
TypedProductContentBySlug(string slug)Gets IProductContent by it's slug
TypeProductContentBySku(string sku)Gets IProductContent by sku
TypedProductContentFromCollection(Guid collectionKey)Gets a collection IProductContent from a product collection.
GetProductVariantWithAttributes(Guid productKey, Guid[] attributeKeys)Get a product variant from a product by it's collection of attributes
GetValidProductVariants(Guid productKey, Guid[] attributeKeys)Gets a list of valid variants based on partial attribute selection