{"_id":"56b92aff08d8b20d00bc3b0f","link_url":"","updates":[],"version":"56b92afe08d8b20d00bc3afd","__v":0,"category":"56b92aff08d8b20d00bc3afe","hidden":false,"slug":"overview","user":"564136b9f424a10d001181e1","link_external":false,"project":"56421bcdb48bdf19006a4c97","isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Basic Features\"\n}\n[/block]\nMerchello comes with the following core features, but it's also built so you can expand on it to your needs. Here's what you get right out of the box:\n\n* Products with options and variants\n* Extending Content on products (Attach Umbraco DocTypes)\n* Collection management for product, invoices and customers\n* Flat rate shipping provider (by weight or price) for a single warehouse that can be adjusted by country and region\n* Cash payment provider (for cash, check, cod, pay by phone, etc)\n* Braintree payment provider\n* PayPal payment provider\n* Product and Invoice based taxation\n* Both invoicing and orders, created with each purchase\n* Multiple currencies\n* Discount Coupons (Highly configurable)\n* Reporting\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Where Can I Download It?\"\n}\n[/block]\nMerchello and the FastTrack starter kit can be downloaded from [http://our.umbraco.org](https://our.umbraco.org/projects/collaboration/merchello/).\n\nMerchello **binaries** are available through NuGet.  \n\n[https://www.nuget.org/packages/Merchello.Core/](https://www.nuget.org/packages/Merchello.Core/)\n\nFastTrack **binaries** are available through NuGet. \n\n[https://www.nuget.org/packages/Merchello.FastTrack/](https://www.nuget.org/packages/Merchello.FastTrack/)\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Merchello.Core Nuget Package\",\n  \"body\": \"Please read the installation documentation about the Merchello.Core nuget package. It is literally just the Core binaries.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Where Can I Get Help?\"\n}\n[/block]\nThe community forum is a great place to ask questions and get help. [https://our.umbraco.org/projects/collaboration/merchello/merchello/](https://our.umbraco.org/projects/collaboration/merchello/)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Feature Requests & Bug Reports\"\n}\n[/block]\nPlease report bugs, issues and make feature requests on [http://issues.merchello.com](http://issues.merchello.com).","createdAt":"2015-11-10T18:26:00.905Z","excerpt":"Merchello is an open source eCommerce package for the Umbraco CMS.","title":"Overview","type":"basic","api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","sync_unique":"","childrenPages":[]}

Overview

Merchello is an open source eCommerce package for the Umbraco CMS.

[block:api-header] { "type": "basic", "title": "Basic Features" } [/block] Merchello comes with the following core features, but it's also built so you can expand on it to your needs. Here's what you get right out of the box: * Products with options and variants * Extending Content on products (Attach Umbraco DocTypes) * Collection management for product, invoices and customers * Flat rate shipping provider (by weight or price) for a single warehouse that can be adjusted by country and region * Cash payment provider (for cash, check, cod, pay by phone, etc) * Braintree payment provider * PayPal payment provider * Product and Invoice based taxation * Both invoicing and orders, created with each purchase * Multiple currencies * Discount Coupons (Highly configurable) * Reporting [block:api-header] { "type": "basic", "title": "Where Can I Download It?" } [/block] Merchello and the FastTrack starter kit can be downloaded from [http://our.umbraco.org](https://our.umbraco.org/projects/collaboration/merchello/). Merchello **binaries** are available through NuGet. [https://www.nuget.org/packages/Merchello.Core/](https://www.nuget.org/packages/Merchello.Core/) FastTrack **binaries** are available through NuGet. [https://www.nuget.org/packages/Merchello.FastTrack/](https://www.nuget.org/packages/Merchello.FastTrack/) [block:callout] { "type": "warning", "title": "Merchello.Core Nuget Package", "body": "Please read the installation documentation about the Merchello.Core nuget package. It is literally just the Core binaries." } [/block] [block:api-header] { "type": "basic", "title": "Where Can I Get Help?" } [/block] The community forum is a great place to ask questions and get help. [https://our.umbraco.org/projects/collaboration/merchello/merchello/](https://our.umbraco.org/projects/collaboration/merchello/) [block:api-header] { "type": "basic", "title": "Feature Requests & Bug Reports" } [/block] Please report bugs, issues and make feature requests on [http://issues.merchello.com](http://issues.merchello.com).
[block:api-header] { "type": "basic", "title": "Basic Features" } [/block] Merchello comes with the following core features, but it's also built so you can expand on it to your needs. Here's what you get right out of the box: * Products with options and variants * Extending Content on products (Attach Umbraco DocTypes) * Collection management for product, invoices and customers * Flat rate shipping provider (by weight or price) for a single warehouse that can be adjusted by country and region * Cash payment provider (for cash, check, cod, pay by phone, etc) * Braintree payment provider * PayPal payment provider * Product and Invoice based taxation * Both invoicing and orders, created with each purchase * Multiple currencies * Discount Coupons (Highly configurable) * Reporting [block:api-header] { "type": "basic", "title": "Where Can I Download It?" } [/block] Merchello and the FastTrack starter kit can be downloaded from [http://our.umbraco.org](https://our.umbraco.org/projects/collaboration/merchello/). Merchello **binaries** are available through NuGet. [https://www.nuget.org/packages/Merchello.Core/](https://www.nuget.org/packages/Merchello.Core/) FastTrack **binaries** are available through NuGet. [https://www.nuget.org/packages/Merchello.FastTrack/](https://www.nuget.org/packages/Merchello.FastTrack/) [block:callout] { "type": "warning", "title": "Merchello.Core Nuget Package", "body": "Please read the installation documentation about the Merchello.Core nuget package. It is literally just the Core binaries." } [/block] [block:api-header] { "type": "basic", "title": "Where Can I Get Help?" } [/block] The community forum is a great place to ask questions and get help. [https://our.umbraco.org/projects/collaboration/merchello/merchello/](https://our.umbraco.org/projects/collaboration/merchello/) [block:api-header] { "type": "basic", "title": "Feature Requests & Bug Reports" } [/block] Please report bugs, issues and make feature requests on [http://issues.merchello.com](http://issues.merchello.com).
{"_id":"56b92aff08d8b20d00bc3b10","__v":1,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"category":"56b92aff08d8b20d00bc3afe","hidden":false,"project":"56421bcdb48bdf19006a4c97","sync_unique":"","isReference":false,"link_url":"","slug":"installation","title":"Installation","type":"basic","updates":["5a27c309ffe263002650feb3"],"version":"56b92afe08d8b20d00bc3afd","body":"Before downloading Merchello, review the following Umbraco to Merchello compatibility matrix. \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Umbraco Version\",\n    \"h-1\": \"Merchello Version\",\n    \"0-0\": \"Umbraco 7.0.x & 7.1.x\",\n    \"0-1\": \"1.1.x to 1.5.1\",\n    \"1-0\": \"Umbraco 7.2.x\",\n    \"1-1\": \"1.6.0 to 1.12.0\",\n    \"2-0\": \"Umbraco 7.3.x\",\n    \"2-1\": \"1.13.x to 1.14.0\",\n    \"3-0\": \"Umbraco 7.4.X\",\n    \"3-1\": \"1.14.1 to current\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Package Installation\"\n}\n[/block]\nTo install Merchello or the FastTrack you must install it initially as a normal Umbraco package and not via Nuget (*See Nuget installation below for more information on Nuget*).\n\nDownload Merchello from [http://our.umbraco.org/projects/collaboration/merchello](http://our.umbraco.org/projects/collaboration/merchello) or through the Umbraco package Repository in the back office, search for \"Merchello.\" And install from there.\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Package Files\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Merchello_[VERSION].zip\",\n    \"0-1\": \"**Main package file**.  Installs Merchello into an Umbraco instance.  Intended to be uploaded through Umbraco's package manager.\",\n    \"1-0\": \"Merchello-FastTrack-[VERSION].zip\",\n    \"1-1\": \"Starter kit only. Installs **ONLY** the FastTrack store and **REQUIRES** that Merchello has been previously installed.\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\nIn the Umbraco backend go to the Developer section. In the Developer/Packages section, select **Install local package** .\n\nClick the **Accept License** check box and select **Install Package** for the Merchello file you just downloaded.\n\nWhen the installation is done, you will see the Package is Installed screen.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Nuget Installation\"\n}\n[/block]\nWe have the Core files of Merchello on Nuget to help you keep your installation up to date more easily. However, please not that the **Nuget package is just the Core files** (*Same goes for the FastTrack*).\n\nYou must install Merchello (*Or the FastTrack*) via the Umbraco package initially to get a full install. Then once you have the package installed, and you want to keep it up to date via Nuget (And not have to keep installing it as a package every update).\n\nJust pull in via Nuget using the links below, and if you are prompted to overwrite any Merchello files then you can/or just skip (*Obviously make sure you use the correct Nuget version that matches the package you installed*)\n\n**Merchello Nuget Core Files**\n\nhttps://www.nuget.org/packages/Merchello.Core/\n\n**FastTrack Nuget Core Files** \n\nhttps://www.nuget.org/packages/Merchello.FastTrack/\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Umbraco Beta and Pre-Release Version\",\n  \"body\": \"Merchello's development process often lags behind Umbraco's ongoing development, largely because the project itself is completely dependent on Umbraco.  As a result we cannot immediately confirm Merchello will work flawlessly with every Umbraco version - especially major release versions.\\n\\nIf you would like to verify the compatibility of the two products, please post a question in the [forum](http://our.umbraco.org/projects/collaboration/merchello/merchello).\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"UaaS Installation (Experimental) - 1.13.2+\"\n}\n[/block]\nThe install for Merchello has been updated to be more compatible with Umbraco as a Service.\n\nA supplemental zip file can be downloaded that contains the [configuration transforms](https://our.umbraco.org/documentation/Umbraco-as-a-Service/Set-Up/Config-Transforms/) needed to run Merchello on UaaS.   The `web.config` transforms should go in the root.  The Umbraco specific config transforms should be placed in the /Config folder.\n\nPlease note that although this installs and works on each environment on UaaS, the content syncing between environment is still being worked on.\n\nIt's actually very complicated as Umbraco themselves still haven't figured out how to allow third party packages with custom tables to deploy changes in data via Courier.\n\nWe have a concept, but it's likely to be a couple of months before we release it and it's highly likely it will be just for collections/settings initially.","link_external":false,"user":"564136b9f424a10d001181e1","createdAt":"2015-11-10T18:28:20.736Z","excerpt":"","githubsync":"","order":1,"next":{"pages":[]},"childrenPages":[]}

Installation


Before downloading Merchello, review the following Umbraco to Merchello compatibility matrix. [block:parameters] { "data": { "h-0": "Umbraco Version", "h-1": "Merchello Version", "0-0": "Umbraco 7.0.x & 7.1.x", "0-1": "1.1.x to 1.5.1", "1-0": "Umbraco 7.2.x", "1-1": "1.6.0 to 1.12.0", "2-0": "Umbraco 7.3.x", "2-1": "1.13.x to 1.14.0", "3-0": "Umbraco 7.4.X", "3-1": "1.14.1 to current" }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Package Installation" } [/block] To install Merchello or the FastTrack you must install it initially as a normal Umbraco package and not via Nuget (*See Nuget installation below for more information on Nuget*). Download Merchello from [http://our.umbraco.org/projects/collaboration/merchello](http://our.umbraco.org/projects/collaboration/merchello) or through the Umbraco package Repository in the back office, search for "Merchello." And install from there. [block:parameters] { "data": { "h-0": "Package Files", "h-1": "Description", "0-0": "Merchello_[VERSION].zip", "0-1": "**Main package file**. Installs Merchello into an Umbraco instance. Intended to be uploaded through Umbraco's package manager.", "1-0": "Merchello-FastTrack-[VERSION].zip", "1-1": "Starter kit only. Installs **ONLY** the FastTrack store and **REQUIRES** that Merchello has been previously installed." }, "cols": 2, "rows": 2 } [/block] In the Umbraco backend go to the Developer section. In the Developer/Packages section, select **Install local package** . Click the **Accept License** check box and select **Install Package** for the Merchello file you just downloaded. When the installation is done, you will see the Package is Installed screen. [block:api-header] { "type": "basic", "title": "Nuget Installation" } [/block] We have the Core files of Merchello on Nuget to help you keep your installation up to date more easily. However, please not that the **Nuget package is just the Core files** (*Same goes for the FastTrack*). You must install Merchello (*Or the FastTrack*) via the Umbraco package initially to get a full install. Then once you have the package installed, and you want to keep it up to date via Nuget (And not have to keep installing it as a package every update). Just pull in via Nuget using the links below, and if you are prompted to overwrite any Merchello files then you can/or just skip (*Obviously make sure you use the correct Nuget version that matches the package you installed*) **Merchello Nuget Core Files** https://www.nuget.org/packages/Merchello.Core/ **FastTrack Nuget Core Files** https://www.nuget.org/packages/Merchello.FastTrack/ [block:callout] { "type": "info", "title": "Umbraco Beta and Pre-Release Version", "body": "Merchello's development process often lags behind Umbraco's ongoing development, largely because the project itself is completely dependent on Umbraco. As a result we cannot immediately confirm Merchello will work flawlessly with every Umbraco version - especially major release versions.\n\nIf you would like to verify the compatibility of the two products, please post a question in the [forum](http://our.umbraco.org/projects/collaboration/merchello/merchello)." } [/block] [block:api-header] { "type": "basic", "title": "UaaS Installation (Experimental) - 1.13.2+" } [/block] The install for Merchello has been updated to be more compatible with Umbraco as a Service. A supplemental zip file can be downloaded that contains the [configuration transforms](https://our.umbraco.org/documentation/Umbraco-as-a-Service/Set-Up/Config-Transforms/) needed to run Merchello on UaaS. The `web.config` transforms should go in the root. The Umbraco specific config transforms should be placed in the /Config folder. Please note that although this installs and works on each environment on UaaS, the content syncing between environment is still being worked on. It's actually very complicated as Umbraco themselves still haven't figured out how to allow third party packages with custom tables to deploy changes in data via Courier. We have a concept, but it's likely to be a couple of months before we release it and it's highly likely it will be just for collections/settings initially.
Before downloading Merchello, review the following Umbraco to Merchello compatibility matrix. [block:parameters] { "data": { "h-0": "Umbraco Version", "h-1": "Merchello Version", "0-0": "Umbraco 7.0.x & 7.1.x", "0-1": "1.1.x to 1.5.1", "1-0": "Umbraco 7.2.x", "1-1": "1.6.0 to 1.12.0", "2-0": "Umbraco 7.3.x", "2-1": "1.13.x to 1.14.0", "3-0": "Umbraco 7.4.X", "3-1": "1.14.1 to current" }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Package Installation" } [/block] To install Merchello or the FastTrack you must install it initially as a normal Umbraco package and not via Nuget (*See Nuget installation below for more information on Nuget*). Download Merchello from [http://our.umbraco.org/projects/collaboration/merchello](http://our.umbraco.org/projects/collaboration/merchello) or through the Umbraco package Repository in the back office, search for "Merchello." And install from there. [block:parameters] { "data": { "h-0": "Package Files", "h-1": "Description", "0-0": "Merchello_[VERSION].zip", "0-1": "**Main package file**. Installs Merchello into an Umbraco instance. Intended to be uploaded through Umbraco's package manager.", "1-0": "Merchello-FastTrack-[VERSION].zip", "1-1": "Starter kit only. Installs **ONLY** the FastTrack store and **REQUIRES** that Merchello has been previously installed." }, "cols": 2, "rows": 2 } [/block] In the Umbraco backend go to the Developer section. In the Developer/Packages section, select **Install local package** . Click the **Accept License** check box and select **Install Package** for the Merchello file you just downloaded. When the installation is done, you will see the Package is Installed screen. [block:api-header] { "type": "basic", "title": "Nuget Installation" } [/block] We have the Core files of Merchello on Nuget to help you keep your installation up to date more easily. However, please not that the **Nuget package is just the Core files** (*Same goes for the FastTrack*). You must install Merchello (*Or the FastTrack*) via the Umbraco package initially to get a full install. Then once you have the package installed, and you want to keep it up to date via Nuget (And not have to keep installing it as a package every update). Just pull in via Nuget using the links below, and if you are prompted to overwrite any Merchello files then you can/or just skip (*Obviously make sure you use the correct Nuget version that matches the package you installed*) **Merchello Nuget Core Files** https://www.nuget.org/packages/Merchello.Core/ **FastTrack Nuget Core Files** https://www.nuget.org/packages/Merchello.FastTrack/ [block:callout] { "type": "info", "title": "Umbraco Beta and Pre-Release Version", "body": "Merchello's development process often lags behind Umbraco's ongoing development, largely because the project itself is completely dependent on Umbraco. As a result we cannot immediately confirm Merchello will work flawlessly with every Umbraco version - especially major release versions.\n\nIf you would like to verify the compatibility of the two products, please post a question in the [forum](http://our.umbraco.org/projects/collaboration/merchello/merchello)." } [/block] [block:api-header] { "type": "basic", "title": "UaaS Installation (Experimental) - 1.13.2+" } [/block] The install for Merchello has been updated to be more compatible with Umbraco as a Service. A supplemental zip file can be downloaded that contains the [configuration transforms](https://our.umbraco.org/documentation/Umbraco-as-a-Service/Set-Up/Config-Transforms/) needed to run Merchello on UaaS. The `web.config` transforms should go in the root. The Umbraco specific config transforms should be placed in the /Config folder. Please note that although this installs and works on each environment on UaaS, the content syncing between environment is still being worked on. It's actually very complicated as Umbraco themselves still haven't figured out how to allow third party packages with custom tables to deploy changes in data via Courier. We have a concept, but it's likely to be a couple of months before we release it and it's highly likely it will be just for collections/settings initially.
{"_id":"56b92aff08d8b20d00bc3b11","category":"56b92aff08d8b20d00bc3afe","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","link_url":"","body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/dWw2SitRiGCZUnxNU8cu_merchello-section.png\",\n        \"merchello-section.png\",\n        \"438\",\n        \"659\",\n        \"#56a6e1\",\n        \"\"\n      ],\n      \"caption\": \"The Merchello Back Office Section\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\nAfter Merchello is installed the \"Merchello Section\" will appear in the back office.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Merchello Tree Overview\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Tree node\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"MERCHELLO (root)\",\n    \"0-1\": \"Navigates to the welcome dashboard and provides access to the **Settings** panel.\",\n    \"1-0\": \"Products\",\n    \"1-1\": \"Navigates to the **Product Listing** and is the entry point for product management.\",\n    \"2-0\": \"Sales\",\n    \"2-1\": \"Navigates to the **Sales Listing** and is the entry point for sales and order fulfillment.\",\n    \"3-0\": \"Customers\",\n    \"3-1\": \"Navigates to the **Customer Listing** and is the entry point for customer management.\",\n    \"4-0\": \"Marketing\",\n    \"4-1\": \"Navigates to the **Offers Listing** and is the entry point for marketing offer management such as Coupons.\",\n    \"6-0\": \"Gateway Providers\",\n    \"6-1\": \"Navigates to the **Gateway Provider Listing**.  This section is the entry point for Payment, Notification, Shipping and Taxation provider configuration.\",\n    \"5-0\": \"Reports\",\n    \"5-1\": \"Navigates to the **Reports Dashboard** and is the parent for individual report pages.\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]","title":"Merchello Section","__v":0,"updates":[],"githubsync":"","hidden":false,"order":2,"excerpt":"This page describes the Umbraco back office Merchello section.","slug":"merchello-section","type":"basic","version":"56b92afe08d8b20d00bc3afd","createdAt":"2015-11-10T21:47:09.546Z","link_external":false,"sync_unique":"","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]}},"childrenPages":[]}

Merchello Section

This page describes the Umbraco back office Merchello section.

[block:image] { "images": [ { "image": [ "https://files.readme.io/dWw2SitRiGCZUnxNU8cu_merchello-section.png", "merchello-section.png", "438", "659", "#56a6e1", "" ], "caption": "The Merchello Back Office Section" } ], "sidebar": true } [/block] After Merchello is installed the "Merchello Section" will appear in the back office. [block:api-header] { "type": "basic", "title": "Merchello Tree Overview" } [/block] [block:parameters] { "data": { "h-0": "Tree node", "h-1": "Description", "0-0": "MERCHELLO (root)", "0-1": "Navigates to the welcome dashboard and provides access to the **Settings** panel.", "1-0": "Products", "1-1": "Navigates to the **Product Listing** and is the entry point for product management.", "2-0": "Sales", "2-1": "Navigates to the **Sales Listing** and is the entry point for sales and order fulfillment.", "3-0": "Customers", "3-1": "Navigates to the **Customer Listing** and is the entry point for customer management.", "4-0": "Marketing", "4-1": "Navigates to the **Offers Listing** and is the entry point for marketing offer management such as Coupons.", "6-0": "Gateway Providers", "6-1": "Navigates to the **Gateway Provider Listing**. This section is the entry point for Payment, Notification, Shipping and Taxation provider configuration.", "5-0": "Reports", "5-1": "Navigates to the **Reports Dashboard** and is the parent for individual report pages." }, "cols": 2, "rows": 7 } [/block]
[block:image] { "images": [ { "image": [ "https://files.readme.io/dWw2SitRiGCZUnxNU8cu_merchello-section.png", "merchello-section.png", "438", "659", "#56a6e1", "" ], "caption": "The Merchello Back Office Section" } ], "sidebar": true } [/block] After Merchello is installed the "Merchello Section" will appear in the back office. [block:api-header] { "type": "basic", "title": "Merchello Tree Overview" } [/block] [block:parameters] { "data": { "h-0": "Tree node", "h-1": "Description", "0-0": "MERCHELLO (root)", "0-1": "Navigates to the welcome dashboard and provides access to the **Settings** panel.", "1-0": "Products", "1-1": "Navigates to the **Product Listing** and is the entry point for product management.", "2-0": "Sales", "2-1": "Navigates to the **Sales Listing** and is the entry point for sales and order fulfillment.", "3-0": "Customers", "3-1": "Navigates to the **Customer Listing** and is the entry point for customer management.", "4-0": "Marketing", "4-1": "Navigates to the **Offers Listing** and is the entry point for marketing offer management such as Coupons.", "6-0": "Gateway Providers", "6-1": "Navigates to the **Gateway Provider Listing**. This section is the entry point for Payment, Notification, Shipping and Taxation provider configuration.", "5-0": "Reports", "5-1": "Navigates to the **Reports Dashboard** and is the parent for individual report pages." }, "cols": 2, "rows": 7 } [/block]
{"_id":"56b92aff08d8b20d00bc3b12","link_url":"","__v":0,"user":"564136b9f424a10d001181e1","order":3,"type":"basic","sync_unique":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"version":"56b92afe08d8b20d00bc3afd","updates":[],"link_external":false,"githubsync":"","excerpt":"This page describes the Merch configuration section and global settings that can be set through the Merch back office section.","category":"56b92aff08d8b20d00bc3afe","project":"56421bcdb48bdf19006a4c97","body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/UQiwH86CSqus3R8f8Ouk_merchello-section-settings.png\",\n        \"merchello-section-settings.png\",\n        \"441\",\n        \"638\",\n        \"#e81b0b\",\n        \"\"\n      ],\n      \"caption\": \"Merchello Settings Page is a tab off of the tree root.\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\nMerchello configuration is done in the Umbraco backend Merchello section. You can control the product catalog, inventory, shipping, payment, taxation, and notifications.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/82uX9azPQvSJVdZNJIME_settings.png\",\n        \"settings.png\",\n        \"1479\",\n        \"778\",\n        \"#4c7379\",\n        \"\"\n      ],\n      \"caption\": \"Settings dashboard\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Store Defaults\"\n}\n[/block]\nMerchello configuration includes some global settings for the store back office such as default currency and culture, unit system, and starting document numbers.  \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Setting\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Currency\",\n    \"0-1\": \"Sets the default store currency used in product pricing, ship rate quoting, taxation and invoicing.\",\n    \"1-0\": \"Set the default extended data culture\",\n    \"1-1\": \"Sets the default language that is selected when navigating to extended content off of a product.\",\n    \"2-0\": \"Time format\",\n    \"2-1\": \"Sets the time format.  Currently not used.\",\n    \"3-0\": \"Unit system\",\n    \"3-1\": \"Sets back office unit labels.\",\n    \"4-0\": \"Set how taxes are applied\",\n    \"4-1\": \"Sets how taxes are applied.  Options are Invoice or Product.  If invoice is selected, taxes are calculated in the invoice generation process.  If product is selected, taxes are added to the base product price when rendering a product.\",\n    \"5-0\": \"Date Format\",\n    \"5-1\": \"Sets the date format for dates displayed in back office.\",\n    \"6-0\": \"Starting order number\",\n    \"6-1\": \"Sets the next order number\",\n    \"7-0\": \"Starting invoice number\",\n    \"7-1\": \"Sets the next invoice number\",\n    \"8-0\": \"Starting shipment number\",\n    \"8-1\": \"Sets the next shipment number\"\n  },\n  \"cols\": 2,\n  \"rows\": 9\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Catalog Defaults\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"These settings are meant to save time by NOT having to set the properties for each product as it is added to the catalog and have NO effect on existing products.\",\n  \"title\": \"Note\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Setting\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"All items are taxable\",\n    \"0-1\": \"If checked, new products are created with taxable setting set to TRUE\",\n    \"1-0\": \"All items are shippable\",\n    \"1-1\": \"If checked, new products are created with shippable setting set to TRUE\",\n    \"2-0\": \"Track inventory for all items & variants\",\n    \"2-1\": \"If checked, new products are created with the tracks inventory setting set to TRUE\",\n    \"3-0\": \"Shipping charges are taxable\",\n    \"3-1\": \"If checked, shipping charges will be set to taxable.  *Note* Custom tax providers may not respect this.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]","slug":"global-settings","title":"Global Settings","createdAt":"2015-11-10T18:28:41.107Z","hidden":false,"childrenPages":[]}

Global Settings

This page describes the Merch configuration section and global settings that can be set through the Merch back office section.

[block:image] { "images": [ { "image": [ "https://files.readme.io/UQiwH86CSqus3R8f8Ouk_merchello-section-settings.png", "merchello-section-settings.png", "441", "638", "#e81b0b", "" ], "caption": "Merchello Settings Page is a tab off of the tree root." } ], "sidebar": true } [/block] Merchello configuration is done in the Umbraco backend Merchello section. You can control the product catalog, inventory, shipping, payment, taxation, and notifications. [block:image] { "images": [ { "image": [ "https://files.readme.io/82uX9azPQvSJVdZNJIME_settings.png", "settings.png", "1479", "778", "#4c7379", "" ], "caption": "Settings dashboard" } ] } [/block] [block:api-header] { "type": "basic", "title": "Store Defaults" } [/block] Merchello configuration includes some global settings for the store back office such as default currency and culture, unit system, and starting document numbers. [block:parameters] { "data": { "h-0": "Setting", "h-1": "Description", "0-0": "Currency", "0-1": "Sets the default store currency used in product pricing, ship rate quoting, taxation and invoicing.", "1-0": "Set the default extended data culture", "1-1": "Sets the default language that is selected when navigating to extended content off of a product.", "2-0": "Time format", "2-1": "Sets the time format. Currently not used.", "3-0": "Unit system", "3-1": "Sets back office unit labels.", "4-0": "Set how taxes are applied", "4-1": "Sets how taxes are applied. Options are Invoice or Product. If invoice is selected, taxes are calculated in the invoice generation process. If product is selected, taxes are added to the base product price when rendering a product.", "5-0": "Date Format", "5-1": "Sets the date format for dates displayed in back office.", "6-0": "Starting order number", "6-1": "Sets the next order number", "7-0": "Starting invoice number", "7-1": "Sets the next invoice number", "8-0": "Starting shipment number", "8-1": "Sets the next shipment number" }, "cols": 2, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Catalog Defaults" } [/block] [block:callout] { "type": "warning", "body": "These settings are meant to save time by NOT having to set the properties for each product as it is added to the catalog and have NO effect on existing products.", "title": "Note" } [/block] [block:parameters] { "data": { "h-0": "Setting", "h-1": "Description", "0-0": "All items are taxable", "0-1": "If checked, new products are created with taxable setting set to TRUE", "1-0": "All items are shippable", "1-1": "If checked, new products are created with shippable setting set to TRUE", "2-0": "Track inventory for all items & variants", "2-1": "If checked, new products are created with the tracks inventory setting set to TRUE", "3-0": "Shipping charges are taxable", "3-1": "If checked, shipping charges will be set to taxable. *Note* Custom tax providers may not respect this." }, "cols": 2, "rows": 4 } [/block]
[block:image] { "images": [ { "image": [ "https://files.readme.io/UQiwH86CSqus3R8f8Ouk_merchello-section-settings.png", "merchello-section-settings.png", "441", "638", "#e81b0b", "" ], "caption": "Merchello Settings Page is a tab off of the tree root." } ], "sidebar": true } [/block] Merchello configuration is done in the Umbraco backend Merchello section. You can control the product catalog, inventory, shipping, payment, taxation, and notifications. [block:image] { "images": [ { "image": [ "https://files.readme.io/82uX9azPQvSJVdZNJIME_settings.png", "settings.png", "1479", "778", "#4c7379", "" ], "caption": "Settings dashboard" } ] } [/block] [block:api-header] { "type": "basic", "title": "Store Defaults" } [/block] Merchello configuration includes some global settings for the store back office such as default currency and culture, unit system, and starting document numbers. [block:parameters] { "data": { "h-0": "Setting", "h-1": "Description", "0-0": "Currency", "0-1": "Sets the default store currency used in product pricing, ship rate quoting, taxation and invoicing.", "1-0": "Set the default extended data culture", "1-1": "Sets the default language that is selected when navigating to extended content off of a product.", "2-0": "Time format", "2-1": "Sets the time format. Currently not used.", "3-0": "Unit system", "3-1": "Sets back office unit labels.", "4-0": "Set how taxes are applied", "4-1": "Sets how taxes are applied. Options are Invoice or Product. If invoice is selected, taxes are calculated in the invoice generation process. If product is selected, taxes are added to the base product price when rendering a product.", "5-0": "Date Format", "5-1": "Sets the date format for dates displayed in back office.", "6-0": "Starting order number", "6-1": "Sets the next order number", "7-0": "Starting invoice number", "7-1": "Sets the next invoice number", "8-0": "Starting shipment number", "8-1": "Sets the next shipment number" }, "cols": 2, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Catalog Defaults" } [/block] [block:callout] { "type": "warning", "body": "These settings are meant to save time by NOT having to set the properties for each product as it is added to the catalog and have NO effect on existing products.", "title": "Note" } [/block] [block:parameters] { "data": { "h-0": "Setting", "h-1": "Description", "0-0": "All items are taxable", "0-1": "If checked, new products are created with taxable setting set to TRUE", "1-0": "All items are shippable", "1-1": "If checked, new products are created with shippable setting set to TRUE", "2-0": "Track inventory for all items & variants", "2-1": "If checked, new products are created with the tracks inventory setting set to TRUE", "3-0": "Shipping charges are taxable", "3-1": "If checked, shipping charges will be set to taxable. *Note* Custom tax providers may not respect this." }, "cols": 2, "rows": 4 } [/block]
{"_id":"56b92b0508d8b20d00bc3b34","project":"56421bcdb48bdf19006a4c97","updates":[],"githubsync":"","hidden":false,"type":"basic","category":"56b92aff08d8b20d00bc3aff","user":"564136b9f424a10d001181e1","createdAt":"2015-11-11T19:31:52.673Z","link_url":"","slug":"product-collections","version":"56b92afe08d8b20d00bc3afd","api":{"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"order":4,"__v":0,"link_external":false,"sync_unique":"","body":"Product Collections are a great way to organise products. To create a collection, simply right click on the root 'Products' node and choose 'New Collection'. To Add products to your collection, right click on it and choose 'Manage Collection'. \n\nHere you'll see all available products to be added to the collection. The same applies to remove products, you just need to select the 'Remove collection items' radio button.\n\nThey can be used for anything. For example, you could recreate your main category structure by nesting collections inside another. You could create collections for featured sections on your site, or create a collection for an API/XML feed.\n\nThe image below shows a number of nested collections under the main Products node.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/dQEuXcE0QAi6o8b3ognn_collections.PNG\",\n        \"collections.PNG\",\n        \"1229\",\n        \"529\",\n        \"#944430\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Dynamic Collections\"\n}\n[/block]\nThe above details 'Static' collections. These are collections you create in the backoffice and manually add products in and out.\n\nMerchello also offers dynamic collections, a way to programatically create a collection that is auto updated based on your own logic. \n\nPlease see [Sales Collections](doc:sales-collections) below for more information on this.","excerpt":"","title":"Product Collections","childrenPages":[]}

Product Collections


Product Collections are a great way to organise products. To create a collection, simply right click on the root 'Products' node and choose 'New Collection'. To Add products to your collection, right click on it and choose 'Manage Collection'. Here you'll see all available products to be added to the collection. The same applies to remove products, you just need to select the 'Remove collection items' radio button. They can be used for anything. For example, you could recreate your main category structure by nesting collections inside another. You could create collections for featured sections on your site, or create a collection for an API/XML feed. The image below shows a number of nested collections under the main Products node. [block:image] { "images": [ { "image": [ "https://files.readme.io/dQEuXcE0QAi6o8b3ognn_collections.PNG", "collections.PNG", "1229", "529", "#944430", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Dynamic Collections" } [/block] The above details 'Static' collections. These are collections you create in the backoffice and manually add products in and out. Merchello also offers dynamic collections, a way to programatically create a collection that is auto updated based on your own logic. Please see [Sales Collections](doc:sales-collections) below for more information on this.
Product Collections are a great way to organise products. To create a collection, simply right click on the root 'Products' node and choose 'New Collection'. To Add products to your collection, right click on it and choose 'Manage Collection'. Here you'll see all available products to be added to the collection. The same applies to remove products, you just need to select the 'Remove collection items' radio button. They can be used for anything. For example, you could recreate your main category structure by nesting collections inside another. You could create collections for featured sections on your site, or create a collection for an API/XML feed. The image below shows a number of nested collections under the main Products node. [block:image] { "images": [ { "image": [ "https://files.readme.io/dQEuXcE0QAi6o8b3ognn_collections.PNG", "collections.PNG", "1229", "529", "#944430", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Dynamic Collections" } [/block] The above details 'Static' collections. These are collections you create in the backoffice and manually add products in and out. Merchello also offers dynamic collections, a way to programatically create a collection that is auto updated based on your own logic. Please see [Sales Collections](doc:sales-collections) below for more information on this.
{"_id":"56b92b0508d8b20d00bc3b35","excerpt":"","type":"basic","title":"Product Listing","category":"56b92aff08d8b20d00bc3aff","link_external":false,"hidden":false,"body":"Product Listing shows all products within Merchello, you can edit a product by clicking on the product name. If you want to further categorise your products, then use [Product Collections](doc:product-collections) .\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/wQqWWGCTlqBL6QmqmpwX_product-listing.png\",\n        \"product-listing.png\",\n        \"1479\",\n        \"541\",\n        \"#3e527b\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","__v":0,"sync_unique":"","slug":"back-office-sections","order":5,"project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","link_url":"","api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"updates":[],"createdAt":"2015-11-10T21:44:26.240Z","githubsync":"","childrenPages":[]}

Product Listing


Product Listing shows all products within Merchello, you can edit a product by clicking on the product name. If you want to further categorise your products, then use [Product Collections](doc:product-collections) . [block:image] { "images": [ { "image": [ "https://files.readme.io/wQqWWGCTlqBL6QmqmpwX_product-listing.png", "product-listing.png", "1479", "541", "#3e527b", "" ] } ] } [/block]
Product Listing shows all products within Merchello, you can edit a product by clicking on the product name. If you want to further categorise your products, then use [Product Collections](doc:product-collections) . [block:image] { "images": [ { "image": [ "https://files.readme.io/wQqWWGCTlqBL6QmqmpwX_product-listing.png", "product-listing.png", "1479", "541", "#3e527b", "" ] } ] } [/block]
{"_id":"56b92b0508d8b20d00bc3b36","type":"basic","title":"Product Content Types","sync_unique":"","api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required"},"order":6,"body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/JRz95FnJQe2NGBy3eBIa_content-types.PNG\",\n        \"content-types.PNG\",\n        \"1166\",\n        \"477\",\n        \"#9a573e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nProduct Content Types are actually just DocTypes. But these DocTypes are specifically used to display custom product or product variant properties that can be edited on either your product or product variant. They work in a similar way to [Nested Content](https://our.umbraco.org/projects/backoffice-extensions/nested-content/), and allow Merchello to render the Umbraco property editors on a product or option.\n\nAn example would be, that you want to add an SEO tab and an Images tab on your product. You would create a DocType with these properties and tabs and name it whatever you want (i.e. Product - Standard).\n\nTo tell Merchello you want to use this DocType, you need to register it as a Product Content Type. Simply right click on the 'Products' root and choose 'Product Content Type'\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/GUW9uWo5TzCDQ1xxnrk9_product-content.PNG\",\n        \"product-content.PNG\",\n        \"852\",\n        \"553\",\n        \"#3d5a5d\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nGive it a Name and choose the DocType from the dropdown at the bottom, then click Save. This is now available to us to add to a product. \n\nTo add this to a product, just go to a product and edit it. You will see a Tab called 'Extended Data' from here all you need to do is select the DocType you just created (Product - Standard) and click the icon next to it.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/N1g9Vsz3T5iviUwA8GDE_choose-content-type.PNG\",\n        \"choose-content-type.PNG\",\n        \"925\",\n        \"286\",\n        \"#47547f\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nNow you'll see your DocType properties rendered and you can update and save them just like a normal Umbraco node.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Sway28mmQBSAhhMq27mA_example-content-loaded.PNG\",\n        \"example-content-loaded.PNG\",\n        \"1030\",\n        \"483\",\n        \"#9e5a48\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThis same logic applies for product options, and you can have custom properties on different options.","link_external":false,"link_url":"","excerpt":"","category":"56b92aff08d8b20d00bc3aff","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","updates":[],"createdAt":"2015-11-11T20:14:32.424Z","githubsync":"","hidden":false,"slug":"product-content-types","__v":0,"childrenPages":[]}

Product Content Types


[block:image] { "images": [ { "image": [ "https://files.readme.io/JRz95FnJQe2NGBy3eBIa_content-types.PNG", "content-types.PNG", "1166", "477", "#9a573e", "" ] } ] } [/block] Product Content Types are actually just DocTypes. But these DocTypes are specifically used to display custom product or product variant properties that can be edited on either your product or product variant. They work in a similar way to [Nested Content](https://our.umbraco.org/projects/backoffice-extensions/nested-content/), and allow Merchello to render the Umbraco property editors on a product or option. An example would be, that you want to add an SEO tab and an Images tab on your product. You would create a DocType with these properties and tabs and name it whatever you want (i.e. Product - Standard). To tell Merchello you want to use this DocType, you need to register it as a Product Content Type. Simply right click on the 'Products' root and choose 'Product Content Type' [block:image] { "images": [ { "image": [ "https://files.readme.io/GUW9uWo5TzCDQ1xxnrk9_product-content.PNG", "product-content.PNG", "852", "553", "#3d5a5d", "" ] } ] } [/block] Give it a Name and choose the DocType from the dropdown at the bottom, then click Save. This is now available to us to add to a product. To add this to a product, just go to a product and edit it. You will see a Tab called 'Extended Data' from here all you need to do is select the DocType you just created (Product - Standard) and click the icon next to it. [block:image] { "images": [ { "image": [ "https://files.readme.io/N1g9Vsz3T5iviUwA8GDE_choose-content-type.PNG", "choose-content-type.PNG", "925", "286", "#47547f", "" ] } ] } [/block] Now you'll see your DocType properties rendered and you can update and save them just like a normal Umbraco node. [block:image] { "images": [ { "image": [ "https://files.readme.io/Sway28mmQBSAhhMq27mA_example-content-loaded.PNG", "example-content-loaded.PNG", "1030", "483", "#9e5a48", "" ] } ] } [/block] This same logic applies for product options, and you can have custom properties on different options.
[block:image] { "images": [ { "image": [ "https://files.readme.io/JRz95FnJQe2NGBy3eBIa_content-types.PNG", "content-types.PNG", "1166", "477", "#9a573e", "" ] } ] } [/block] Product Content Types are actually just DocTypes. But these DocTypes are specifically used to display custom product or product variant properties that can be edited on either your product or product variant. They work in a similar way to [Nested Content](https://our.umbraco.org/projects/backoffice-extensions/nested-content/), and allow Merchello to render the Umbraco property editors on a product or option. An example would be, that you want to add an SEO tab and an Images tab on your product. You would create a DocType with these properties and tabs and name it whatever you want (i.e. Product - Standard). To tell Merchello you want to use this DocType, you need to register it as a Product Content Type. Simply right click on the 'Products' root and choose 'Product Content Type' [block:image] { "images": [ { "image": [ "https://files.readme.io/GUW9uWo5TzCDQ1xxnrk9_product-content.PNG", "product-content.PNG", "852", "553", "#3d5a5d", "" ] } ] } [/block] Give it a Name and choose the DocType from the dropdown at the bottom, then click Save. This is now available to us to add to a product. To add this to a product, just go to a product and edit it. You will see a Tab called 'Extended Data' from here all you need to do is select the DocType you just created (Product - Standard) and click the icon next to it. [block:image] { "images": [ { "image": [ "https://files.readme.io/N1g9Vsz3T5iviUwA8GDE_choose-content-type.PNG", "choose-content-type.PNG", "925", "286", "#47547f", "" ] } ] } [/block] Now you'll see your DocType properties rendered and you can update and save them just like a normal Umbraco node. [block:image] { "images": [ { "image": [ "https://files.readme.io/Sway28mmQBSAhhMq27mA_example-content-loaded.PNG", "example-content-loaded.PNG", "1030", "483", "#9e5a48", "" ] } ] } [/block] This same logic applies for product options, and you can have custom properties on different options.
{"_id":"56b92b0808d8b20d00bc3b44","link_external":false,"link_url":"","sync_unique":"","slug":"sales-collections","createdAt":"2015-11-11T19:32:09.820Z","githubsync":"","order":7,"title":"Sales Collections","__v":0,"project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","updates":[],"excerpt":"","type":"basic","category":"56b92aff08d8b20d00bc3b00","version":"56b92afe08d8b20d00bc3afd","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"body":"Sales Collections work in the same way as Product Collections do. They enable you to organise Sales into specific collections.\n\nAlso, as with [Product Collections](doc:product-collections) & [Customer Collections](doc:customer-collections), you can create Dynamic collections. \n\nDynamic collections are used to display information based off commonly desired specific criteria. There are a number of dynamic sales collections which come with Merchello out of the box and serve as a great example of how to create a dynamic collection. \n\nThe out of the box dynamic collections are:\n\n - Unpaid invoices\n - Partially paid invoices\n - Paid invoices\n - Unfulfilled orders\n - Open orders\n - Fulfilled orders\n\nBelow is the code for the Unpaid Invoices dynamic collection, which you can use as a reference to create your own and also, part of the Merchello.config where you register your dynamic collection.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"    /// <summary>\\n    /// The unpaid invoice collection provider.\\n    /// </summary>\\n    [EntityCollectionProvider(\\\"A8120A01-E9BF-4204-ADDD-D9553F6F24FE\\\", \\\"454539B9-D753-4C16-8ED5-5EB659E56665\\\", \\n        \\\"Unpaid Invoice Collection\\\", \\\"A dynamic collection queries for unpaid invoices\\\", true, \\n        \\\"merchelloProviders/unpaidInvoiceCollection\\\")]\\n    internal class DynamicUnpaidInvoiceCollectionProvider : CachedQueryableEntityCollectionProviderBase<IInvoice>\\n    {\\n        /// <summary>\\n        /// The <see cref=\\\"InvoiceService\\\"/>.\\n        /// </summary>\\n        private readonly InvoiceService _invoiceService;\\n\\n        /// <summary>\\n        /// Initializes a new instance of the <see cref=\\\"DynamicUnpaidInvoiceCollectionProvider\\\"/> class.\\n        /// </summary>\\n        /// <param name=\\\"merchelloContext\\\">\\n        /// The merchello context.\\n        /// </param>\\n        /// <param name=\\\"collectionKey\\\">\\n        /// The collection key.\\n        /// </param>\\n        public DynamicUnpaidInvoiceCollectionProvider(IMerchelloContext merchelloContext, Guid collectionKey)\\n            : base(merchelloContext, collectionKey)\\n        {\\n            _invoiceService = (InvoiceService)merchelloContext.Services.InvoiceService;\\n        }\\n\\n        /// <summary>\\n        /// Checks if the invoice exists in the collection\\n        /// </summary>\\n        /// <param name=\\\"entity\\\">\\n        /// The entity.\\n        /// </param>\\n        /// <returns>\\n        /// The <see cref=\\\"bool\\\"/>.\\n        /// </returns>\\n        protected override bool PerformExists(IInvoice entity)\\n        {\\n            return entity.InvoiceStatusKey.Equals(Constants.DefaultKeys.InvoiceStatus.Unpaid);\\n        }\\n\\n        /// <summary>\\n        /// The perform get paged entities.\\n        /// </summary>\\n        /// <param name=\\\"page\\\">\\n        /// The page.\\n        /// </param>\\n        /// <param name=\\\"itemsPerPage\\\">\\n        /// The items per page.\\n        /// </param>\\n        /// <param name=\\\"sortBy\\\">\\n        /// The sort by.\\n        /// </param>\\n        /// <param name=\\\"sortDirection\\\">\\n        /// The sort direction.\\n        /// </param>\\n        /// <returns>\\n        /// The <see cref=\\\"Page{IInvoice}\\\"/>.\\n        /// </returns>\\n        protected override Page<IInvoice> PerformGetPagedEntities(long page, long itemsPerPage, string sortBy = \\\"\\\", SortDirection sortDirection = SortDirection.Ascending)\\n        {\\n            var keyPage = this.PerformGetPagedEntityKeys(page, itemsPerPage, sortBy, sortDirection);\\n            return _invoiceService.GetPageFromKeyPage(keyPage, () => _invoiceService.GetByKeys(keyPage.Items));\\n        }\\n\\n        /// <summary>\\n        /// Gets a page of keys associated with invoices with an unpaid status\\n        /// </summary>\\n        /// <param name=\\\"page\\\">\\n        /// The page.\\n        /// </param>\\n        /// <param name=\\\"itemsPerPage\\\">\\n        /// The items per page.\\n        /// </param>\\n        /// <param name=\\\"sortBy\\\">\\n        /// The sort by.\\n        /// </param>\\n        /// <param name=\\\"sortDirection\\\">\\n        /// The sort direction.\\n        /// </param>\\n        /// <returns>\\n        /// The <see cref=\\\"Page{Guid}\\\"/>.\\n        /// </returns>\\n        protected override Page<Guid> PerformGetPagedEntityKeys(\\n            long page,\\n            long itemsPerPage,\\n            string sortBy = \\\"\\\",\\n            SortDirection sortDirection = SortDirection.Ascending)\\n        {\\n            var query =\\n                Query<IInvoice>.Builder.Where(x => x.InvoiceStatusKey == Constants.DefaultKeys.InvoiceStatus.Unpaid);\\n\\n            return _invoiceService.GetPagedKeys(query, page, itemsPerPage, sortBy, sortDirection);\\n        }\\n\\n        /// <summary>\\n        /// The perform get paged entity keys.\\n        /// </summary>\\n        /// <param name=\\\"args\\\">\\n        /// The args.\\n        /// </param>\\n        /// <param name=\\\"page\\\">\\n        /// The page.\\n        /// </param>\\n        /// <param name=\\\"itemsPerPage\\\">\\n        /// The items per page.\\n        /// </param>\\n        /// <param name=\\\"sortBy\\\">\\n        /// The sort by.\\n        /// </param>\\n        /// <param name=\\\"sortDirection\\\">\\n        /// The sort direction.\\n        /// </param>\\n        /// <returns>\\n        /// The <see cref=\\\"Page{Guid}\\\"/>.\\n        /// </returns>\\n        protected override Page<Guid> PerformGetPagedEntityKeys(\\n            Dictionary<string, object> args,\\n            long page,\\n            long itemsPerPage,\\n            string sortBy = \\\"\\\",\\n            SortDirection sortDirection = SortDirection.Ascending)\\n        {\\n            if (!args.ContainsKey(\\\"searchTerm\\\")) return PerformGetPagedEntityKeys(page, itemsPerPage, sortBy, sortDirection);\\n            \\n            return\\n                    this._invoiceService.GetInvoiceKeysMatchingInvoiceStatus(\\n                        args[\\\"searchTerm\\\"].ToString(),\\n                        Constants.DefaultKeys.InvoiceStatus.Unpaid,\\n                        page,\\n                        itemsPerPage,\\n                        sortBy,\\n                        sortDirection);\\n        }\\n\\n        /// <summary>\\n        /// The perform get paged entity keys not in collection.\\n        /// </summary>\\n        /// <param name=\\\"page\\\">\\n        /// The page.\\n        /// </param>\\n        /// <param name=\\\"itemsPerPage\\\">\\n        /// The items per page.\\n        /// </param>\\n        /// <param name=\\\"sortBy\\\">\\n        /// The sort by.\\n        /// </param>\\n        /// <param name=\\\"sortDirection\\\">\\n        /// The sort direction.\\n        /// </param>\\n        /// <returns>\\n        /// The <see cref=\\\"Page{Guid}\\\"/>.\\n        /// </returns>\\n        protected override Page<Guid> PerformGetPagedEntityKeysNotInCollection(\\n            long page,\\n            long itemsPerPage,\\n            string sortBy = \\\"\\\",\\n            SortDirection sortDirection = SortDirection.Ascending)\\n        {\\n            var query =\\n               Query<IInvoice>.Builder.Where(x => x.InvoiceStatusKey != Constants.DefaultKeys.InvoiceStatus.Unpaid);\\n\\n            return _invoiceService.GetPagedKeys(query, page, itemsPerPage, sortBy, sortDirection);\\n        }\\n\\n        /// <summary>\\n        /// The perform get paged entity keys not in collection.\\n        /// </summary>\\n        /// <param name=\\\"args\\\">\\n        /// The args.\\n        /// </param>\\n        /// <param name=\\\"page\\\">\\n        /// The page.\\n        /// </param>\\n        /// <param name=\\\"itemsPerPage\\\">\\n        /// The items per page.\\n        /// </param>\\n        /// <param name=\\\"sortBy\\\">\\n        /// The sort by.\\n        /// </param>\\n        /// <param name=\\\"sortDirection\\\">\\n        /// The sort direction.\\n        /// </param>\\n        /// <returns>\\n        /// The <see cref=\\\"Page{Guid}\\\"/>.\\n        /// </returns>\\n        protected override Page<Guid> PerformGetPagedEntityKeysNotInCollection(\\n            Dictionary<string, object> args,\\n            long page,\\n            long itemsPerPage,\\n            string sortBy = \\\"\\\",\\n            SortDirection sortDirection = SortDirection.Ascending)\\n        {\\n            if (!args.ContainsKey(\\\"searchTerm\\\")) return PerformGetPagedEntityKeysNotInCollection(page, itemsPerPage, sortBy, sortDirection);\\n\\n\\n            return\\n                this._invoiceService.GetInvoiceKeysMatchingTermNotInvoiceStatus(\\n                    args[\\\"searchTerm\\\"].ToString(),\\n                    Constants.DefaultKeys.InvoiceStatus.Unpaid,\\n                    page,\\n                    itemsPerPage,\\n                    sortBy,\\n                    sortDirection);\\n        }\\n    }\",\n      \"language\": \"csharp\",\n      \"name\": \"DynamicUnpaidInvoiceCollectionProvider\"\n    },\n    {\n      \"code\": \"    <tree id=\\\"sales\\\" title=\\\"Sales\\\" icon=\\\"icon-receipt-dollar\\\" routePath=\\\"merchello/merchello/saleslist/manage\\\" visible=\\\"true\\\" sortOrder=\\\"2\\\">\\n        <childSettings>\\n            <!--\\n                Sets the order where self managed entity collection providers (like Unpaid invoices) are listed in the tree.\\n                If set to true, the resolved collections will be listed before the user defined collections.  False will list them\\n                after.\\n            -->\\n            <setting alias=\\\"selfManagedProvidersBeforeStaticProviders\\\" value=\\\"true\\\" />\\n        </childSettings>\\n        <selfManagedEntityCollectionProviders>\\n            <!--\\n                attribute: key - the provider key defined in the EntityCollectionProviderAttribute decorating the EntityCollectionProvider\\n                attribute: icon - is the icon displayed in the tree\\n                attribute: visible - indicates whether or not the collection should provider should create a tree node\\n                attribute: ref - not actually used, it is only here so that they can be managed more easily\\n               -->\\n            <entityCollectionProvider key=\\\"A8120A01-E9BF-4204-ADDD-D9553F6F24FE\\\" icon=\\\"icon-bills\\\" visible=\\\"true\\\" ref=\\\"Unpaid invoices\\\" />\\n            <entityCollectionProvider key=\\\"82015B97-11E8-4E57-8258-A59E1D378E04\\\" icon=\\\"icon-bills\\\" visible=\\\"true\\\" ref=\\\"Partially paid invoices\\\" />\\n            <entityCollectionProvider key=\\\"072E0671-31BE-41E4-8CF9-4AEEC6CC5BC6\\\" icon=\\\"icon-bills\\\" visible=\\\"true\\\" ref=\\\"Paid invoices\\\" />\\n            <entityCollectionProvider key=\\\"5FD6E5EB-0B7C-41A4-B863-7AEC31BE84C0\\\" icon=\\\"icon-truck\\\" visible=\\\"true\\\" ref=\\\"Unfulfilled orders\\\" />\\n            <entityCollectionProvider key=\\\"A9A288F3-DA98-4712-9E90-F9F909F2C26A\\\" icon=\\\"icon-truck\\\" visible=\\\"true\\\" ref=\\\"Open orders\\\" />\\n            <entityCollectionProvider key=\\\"68B57648-7550-4702-8223-C5574B7C0604\\\" icon=\\\"icon-truck\\\" visible=\\\"true\\\" ref=\\\"Fulfilled orders\\\" />\\n        </selfManagedEntityCollectionProviders>\\n    </tree>\",\n      \"language\": \"xml\",\n      \"name\": \"Merchello.config\"\n    }\n  ]\n}\n[/block]","childrenPages":[]}

Sales Collections


Sales Collections work in the same way as Product Collections do. They enable you to organise Sales into specific collections. Also, as with [Product Collections](doc:product-collections) & [Customer Collections](doc:customer-collections), you can create Dynamic collections. Dynamic collections are used to display information based off commonly desired specific criteria. There are a number of dynamic sales collections which come with Merchello out of the box and serve as a great example of how to create a dynamic collection. The out of the box dynamic collections are: - Unpaid invoices - Partially paid invoices - Paid invoices - Unfulfilled orders - Open orders - Fulfilled orders Below is the code for the Unpaid Invoices dynamic collection, which you can use as a reference to create your own and also, part of the Merchello.config where you register your dynamic collection. [block:code] { "codes": [ { "code": " /// <summary>\n /// The unpaid invoice collection provider.\n /// </summary>\n [EntityCollectionProvider(\"A8120A01-E9BF-4204-ADDD-D9553F6F24FE\", \"454539B9-D753-4C16-8ED5-5EB659E56665\", \n \"Unpaid Invoice Collection\", \"A dynamic collection queries for unpaid invoices\", true, \n \"merchelloProviders/unpaidInvoiceCollection\")]\n internal class DynamicUnpaidInvoiceCollectionProvider : CachedQueryableEntityCollectionProviderBase<IInvoice>\n {\n /// <summary>\n /// The <see cref=\"InvoiceService\"/>.\n /// </summary>\n private readonly InvoiceService _invoiceService;\n\n /// <summary>\n /// Initializes a new instance of the <see cref=\"DynamicUnpaidInvoiceCollectionProvider\"/> class.\n /// </summary>\n /// <param name=\"merchelloContext\">\n /// The merchello context.\n /// </param>\n /// <param name=\"collectionKey\">\n /// The collection key.\n /// </param>\n public DynamicUnpaidInvoiceCollectionProvider(IMerchelloContext merchelloContext, Guid collectionKey)\n : base(merchelloContext, collectionKey)\n {\n _invoiceService = (InvoiceService)merchelloContext.Services.InvoiceService;\n }\n\n /// <summary>\n /// Checks if the invoice exists in the collection\n /// </summary>\n /// <param name=\"entity\">\n /// The entity.\n /// </param>\n /// <returns>\n /// The <see cref=\"bool\"/>.\n /// </returns>\n protected override bool PerformExists(IInvoice entity)\n {\n return entity.InvoiceStatusKey.Equals(Constants.DefaultKeys.InvoiceStatus.Unpaid);\n }\n\n /// <summary>\n /// The perform get paged entities.\n /// </summary>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{IInvoice}\"/>.\n /// </returns>\n protected override Page<IInvoice> PerformGetPagedEntities(long page, long itemsPerPage, string sortBy = \"\", SortDirection sortDirection = SortDirection.Ascending)\n {\n var keyPage = this.PerformGetPagedEntityKeys(page, itemsPerPage, sortBy, sortDirection);\n return _invoiceService.GetPageFromKeyPage(keyPage, () => _invoiceService.GetByKeys(keyPage.Items));\n }\n\n /// <summary>\n /// Gets a page of keys associated with invoices with an unpaid status\n /// </summary>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeys(\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n var query =\n Query<IInvoice>.Builder.Where(x => x.InvoiceStatusKey == Constants.DefaultKeys.InvoiceStatus.Unpaid);\n\n return _invoiceService.GetPagedKeys(query, page, itemsPerPage, sortBy, sortDirection);\n }\n\n /// <summary>\n /// The perform get paged entity keys.\n /// </summary>\n /// <param name=\"args\">\n /// The args.\n /// </param>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeys(\n Dictionary<string, object> args,\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n if (!args.ContainsKey(\"searchTerm\")) return PerformGetPagedEntityKeys(page, itemsPerPage, sortBy, sortDirection);\n \n return\n this._invoiceService.GetInvoiceKeysMatchingInvoiceStatus(\n args[\"searchTerm\"].ToString(),\n Constants.DefaultKeys.InvoiceStatus.Unpaid,\n page,\n itemsPerPage,\n sortBy,\n sortDirection);\n }\n\n /// <summary>\n /// The perform get paged entity keys not in collection.\n /// </summary>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeysNotInCollection(\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n var query =\n Query<IInvoice>.Builder.Where(x => x.InvoiceStatusKey != Constants.DefaultKeys.InvoiceStatus.Unpaid);\n\n return _invoiceService.GetPagedKeys(query, page, itemsPerPage, sortBy, sortDirection);\n }\n\n /// <summary>\n /// The perform get paged entity keys not in collection.\n /// </summary>\n /// <param name=\"args\">\n /// The args.\n /// </param>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeysNotInCollection(\n Dictionary<string, object> args,\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n if (!args.ContainsKey(\"searchTerm\")) return PerformGetPagedEntityKeysNotInCollection(page, itemsPerPage, sortBy, sortDirection);\n\n\n return\n this._invoiceService.GetInvoiceKeysMatchingTermNotInvoiceStatus(\n args[\"searchTerm\"].ToString(),\n Constants.DefaultKeys.InvoiceStatus.Unpaid,\n page,\n itemsPerPage,\n sortBy,\n sortDirection);\n }\n }", "language": "csharp", "name": "DynamicUnpaidInvoiceCollectionProvider" }, { "code": " <tree id=\"sales\" title=\"Sales\" icon=\"icon-receipt-dollar\" routePath=\"merchello/merchello/saleslist/manage\" visible=\"true\" sortOrder=\"2\">\n <childSettings>\n <!--\n Sets the order where self managed entity collection providers (like Unpaid invoices) are listed in the tree.\n If set to true, the resolved collections will be listed before the user defined collections. False will list them\n after.\n -->\n <setting alias=\"selfManagedProvidersBeforeStaticProviders\" value=\"true\" />\n </childSettings>\n <selfManagedEntityCollectionProviders>\n <!--\n attribute: key - the provider key defined in the EntityCollectionProviderAttribute decorating the EntityCollectionProvider\n attribute: icon - is the icon displayed in the tree\n attribute: visible - indicates whether or not the collection should provider should create a tree node\n attribute: ref - not actually used, it is only here so that they can be managed more easily\n -->\n <entityCollectionProvider key=\"A8120A01-E9BF-4204-ADDD-D9553F6F24FE\" icon=\"icon-bills\" visible=\"true\" ref=\"Unpaid invoices\" />\n <entityCollectionProvider key=\"82015B97-11E8-4E57-8258-A59E1D378E04\" icon=\"icon-bills\" visible=\"true\" ref=\"Partially paid invoices\" />\n <entityCollectionProvider key=\"072E0671-31BE-41E4-8CF9-4AEEC6CC5BC6\" icon=\"icon-bills\" visible=\"true\" ref=\"Paid invoices\" />\n <entityCollectionProvider key=\"5FD6E5EB-0B7C-41A4-B863-7AEC31BE84C0\" icon=\"icon-truck\" visible=\"true\" ref=\"Unfulfilled orders\" />\n <entityCollectionProvider key=\"A9A288F3-DA98-4712-9E90-F9F909F2C26A\" icon=\"icon-truck\" visible=\"true\" ref=\"Open orders\" />\n <entityCollectionProvider key=\"68B57648-7550-4702-8223-C5574B7C0604\" icon=\"icon-truck\" visible=\"true\" ref=\"Fulfilled orders\" />\n </selfManagedEntityCollectionProviders>\n </tree>", "language": "xml", "name": "Merchello.config" } ] } [/block]
Sales Collections work in the same way as Product Collections do. They enable you to organise Sales into specific collections. Also, as with [Product Collections](doc:product-collections) & [Customer Collections](doc:customer-collections), you can create Dynamic collections. Dynamic collections are used to display information based off commonly desired specific criteria. There are a number of dynamic sales collections which come with Merchello out of the box and serve as a great example of how to create a dynamic collection. The out of the box dynamic collections are: - Unpaid invoices - Partially paid invoices - Paid invoices - Unfulfilled orders - Open orders - Fulfilled orders Below is the code for the Unpaid Invoices dynamic collection, which you can use as a reference to create your own and also, part of the Merchello.config where you register your dynamic collection. [block:code] { "codes": [ { "code": " /// <summary>\n /// The unpaid invoice collection provider.\n /// </summary>\n [EntityCollectionProvider(\"A8120A01-E9BF-4204-ADDD-D9553F6F24FE\", \"454539B9-D753-4C16-8ED5-5EB659E56665\", \n \"Unpaid Invoice Collection\", \"A dynamic collection queries for unpaid invoices\", true, \n \"merchelloProviders/unpaidInvoiceCollection\")]\n internal class DynamicUnpaidInvoiceCollectionProvider : CachedQueryableEntityCollectionProviderBase<IInvoice>\n {\n /// <summary>\n /// The <see cref=\"InvoiceService\"/>.\n /// </summary>\n private readonly InvoiceService _invoiceService;\n\n /// <summary>\n /// Initializes a new instance of the <see cref=\"DynamicUnpaidInvoiceCollectionProvider\"/> class.\n /// </summary>\n /// <param name=\"merchelloContext\">\n /// The merchello context.\n /// </param>\n /// <param name=\"collectionKey\">\n /// The collection key.\n /// </param>\n public DynamicUnpaidInvoiceCollectionProvider(IMerchelloContext merchelloContext, Guid collectionKey)\n : base(merchelloContext, collectionKey)\n {\n _invoiceService = (InvoiceService)merchelloContext.Services.InvoiceService;\n }\n\n /// <summary>\n /// Checks if the invoice exists in the collection\n /// </summary>\n /// <param name=\"entity\">\n /// The entity.\n /// </param>\n /// <returns>\n /// The <see cref=\"bool\"/>.\n /// </returns>\n protected override bool PerformExists(IInvoice entity)\n {\n return entity.InvoiceStatusKey.Equals(Constants.DefaultKeys.InvoiceStatus.Unpaid);\n }\n\n /// <summary>\n /// The perform get paged entities.\n /// </summary>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{IInvoice}\"/>.\n /// </returns>\n protected override Page<IInvoice> PerformGetPagedEntities(long page, long itemsPerPage, string sortBy = \"\", SortDirection sortDirection = SortDirection.Ascending)\n {\n var keyPage = this.PerformGetPagedEntityKeys(page, itemsPerPage, sortBy, sortDirection);\n return _invoiceService.GetPageFromKeyPage(keyPage, () => _invoiceService.GetByKeys(keyPage.Items));\n }\n\n /// <summary>\n /// Gets a page of keys associated with invoices with an unpaid status\n /// </summary>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeys(\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n var query =\n Query<IInvoice>.Builder.Where(x => x.InvoiceStatusKey == Constants.DefaultKeys.InvoiceStatus.Unpaid);\n\n return _invoiceService.GetPagedKeys(query, page, itemsPerPage, sortBy, sortDirection);\n }\n\n /// <summary>\n /// The perform get paged entity keys.\n /// </summary>\n /// <param name=\"args\">\n /// The args.\n /// </param>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeys(\n Dictionary<string, object> args,\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n if (!args.ContainsKey(\"searchTerm\")) return PerformGetPagedEntityKeys(page, itemsPerPage, sortBy, sortDirection);\n \n return\n this._invoiceService.GetInvoiceKeysMatchingInvoiceStatus(\n args[\"searchTerm\"].ToString(),\n Constants.DefaultKeys.InvoiceStatus.Unpaid,\n page,\n itemsPerPage,\n sortBy,\n sortDirection);\n }\n\n /// <summary>\n /// The perform get paged entity keys not in collection.\n /// </summary>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeysNotInCollection(\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n var query =\n Query<IInvoice>.Builder.Where(x => x.InvoiceStatusKey != Constants.DefaultKeys.InvoiceStatus.Unpaid);\n\n return _invoiceService.GetPagedKeys(query, page, itemsPerPage, sortBy, sortDirection);\n }\n\n /// <summary>\n /// The perform get paged entity keys not in collection.\n /// </summary>\n /// <param name=\"args\">\n /// The args.\n /// </param>\n /// <param name=\"page\">\n /// The page.\n /// </param>\n /// <param name=\"itemsPerPage\">\n /// The items per page.\n /// </param>\n /// <param name=\"sortBy\">\n /// The sort by.\n /// </param>\n /// <param name=\"sortDirection\">\n /// The sort direction.\n /// </param>\n /// <returns>\n /// The <see cref=\"Page{Guid}\"/>.\n /// </returns>\n protected override Page<Guid> PerformGetPagedEntityKeysNotInCollection(\n Dictionary<string, object> args,\n long page,\n long itemsPerPage,\n string sortBy = \"\",\n SortDirection sortDirection = SortDirection.Ascending)\n {\n if (!args.ContainsKey(\"searchTerm\")) return PerformGetPagedEntityKeysNotInCollection(page, itemsPerPage, sortBy, sortDirection);\n\n\n return\n this._invoiceService.GetInvoiceKeysMatchingTermNotInvoiceStatus(\n args[\"searchTerm\"].ToString(),\n Constants.DefaultKeys.InvoiceStatus.Unpaid,\n page,\n itemsPerPage,\n sortBy,\n sortDirection);\n }\n }", "language": "csharp", "name": "DynamicUnpaidInvoiceCollectionProvider" }, { "code": " <tree id=\"sales\" title=\"Sales\" icon=\"icon-receipt-dollar\" routePath=\"merchello/merchello/saleslist/manage\" visible=\"true\" sortOrder=\"2\">\n <childSettings>\n <!--\n Sets the order where self managed entity collection providers (like Unpaid invoices) are listed in the tree.\n If set to true, the resolved collections will be listed before the user defined collections. False will list them\n after.\n -->\n <setting alias=\"selfManagedProvidersBeforeStaticProviders\" value=\"true\" />\n </childSettings>\n <selfManagedEntityCollectionProviders>\n <!--\n attribute: key - the provider key defined in the EntityCollectionProviderAttribute decorating the EntityCollectionProvider\n attribute: icon - is the icon displayed in the tree\n attribute: visible - indicates whether or not the collection should provider should create a tree node\n attribute: ref - not actually used, it is only here so that they can be managed more easily\n -->\n <entityCollectionProvider key=\"A8120A01-E9BF-4204-ADDD-D9553F6F24FE\" icon=\"icon-bills\" visible=\"true\" ref=\"Unpaid invoices\" />\n <entityCollectionProvider key=\"82015B97-11E8-4E57-8258-A59E1D378E04\" icon=\"icon-bills\" visible=\"true\" ref=\"Partially paid invoices\" />\n <entityCollectionProvider key=\"072E0671-31BE-41E4-8CF9-4AEEC6CC5BC6\" icon=\"icon-bills\" visible=\"true\" ref=\"Paid invoices\" />\n <entityCollectionProvider key=\"5FD6E5EB-0B7C-41A4-B863-7AEC31BE84C0\" icon=\"icon-truck\" visible=\"true\" ref=\"Unfulfilled orders\" />\n <entityCollectionProvider key=\"A9A288F3-DA98-4712-9E90-F9F909F2C26A\" icon=\"icon-truck\" visible=\"true\" ref=\"Open orders\" />\n <entityCollectionProvider key=\"68B57648-7550-4702-8223-C5574B7C0604\" icon=\"icon-truck\" visible=\"true\" ref=\"Fulfilled orders\" />\n </selfManagedEntityCollectionProviders>\n </tree>", "language": "xml", "name": "Merchello.config" } ] } [/block]
{"_id":"56b92b0808d8b20d00bc3b45","slug":"sales","createdAt":"2015-11-10T21:46:05.721Z","githubsync":"","user":"564136b9f424a10d001181e1","sync_unique":"","hidden":false,"link_url":"","title":"Sale Listing","__v":0,"category":"56b92aff08d8b20d00bc3b00","version":"56b92afe08d8b20d00bc3afd","updates":[],"order":8,"body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Uybt1jPPQd6uNDwOqLDf_sales-listing.png\",\n        \"sales-listing.png\",\n        \"1478\",\n        \"727\",\n        \"#40567c\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThe \"Invoice #\" link will take you to the invoice.","excerpt":"","type":"basic","project":"56421bcdb48bdf19006a4c97","link_external":false,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"childrenPages":[]}

Sale Listing


[block:image] { "images": [ { "image": [ "https://files.readme.io/Uybt1jPPQd6uNDwOqLDf_sales-listing.png", "sales-listing.png", "1478", "727", "#40567c", "" ] } ] } [/block] The "Invoice #" link will take you to the invoice.
[block:image] { "images": [ { "image": [ "https://files.readme.io/Uybt1jPPQd6uNDwOqLDf_sales-listing.png", "sales-listing.png", "1478", "727", "#40567c", "" ] } ] } [/block] The "Invoice #" link will take you to the invoice.
{"_id":"56b92b0108d8b20d00bc3b1a","updates":[],"excerpt":"","slug":"customer-collections","__v":0,"category":"56b92aff08d8b20d00bc3b01","project":"56421bcdb48bdf19006a4c97","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"createdAt":"2015-11-11T19:32:22.380Z","link_url":"","hidden":false,"order":9,"body":"Customer Collections are the same concept as [Sales Collections](doc:sales-collections)  & [Product Collections](doc:product-collections) . You can create static collections that allow you to add/remove specific customers from a collection.\n\nAs with the Sales Collections, the real power comes from Dynamic collections. Where you can create dynamic collections to group specific customers together. For example, you could create a dynamic collection for 'High Purchase Value Customers' and create a dynamic collection of customers who have ordered with a total amount of over £1000.\n\nSee Sales Collections section for more details/information on how to create a dynamic collection.","link_external":false,"sync_unique":"","githubsync":"","type":"basic","title":"Customer Collections","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","childrenPages":[]}

Customer Collections


Customer Collections are the same concept as [Sales Collections](doc:sales-collections) & [Product Collections](doc:product-collections) . You can create static collections that allow you to add/remove specific customers from a collection. As with the Sales Collections, the real power comes from Dynamic collections. Where you can create dynamic collections to group specific customers together. For example, you could create a dynamic collection for 'High Purchase Value Customers' and create a dynamic collection of customers who have ordered with a total amount of over £1000. See Sales Collections section for more details/information on how to create a dynamic collection.
Customer Collections are the same concept as [Sales Collections](doc:sales-collections) & [Product Collections](doc:product-collections) . You can create static collections that allow you to add/remove specific customers from a collection. As with the Sales Collections, the real power comes from Dynamic collections. Where you can create dynamic collections to group specific customers together. For example, you could create a dynamic collection for 'High Purchase Value Customers' and create a dynamic collection of customers who have ordered with a total amount of over £1000. See Sales Collections section for more details/information on how to create a dynamic collection.
{"_id":"56b92b0108d8b20d00bc3b1b","hidden":false,"excerpt":"The Customers page is where you manage your customers in the store.","slug":"customers","category":"56b92aff08d8b20d00bc3b01","project":"56421bcdb48bdf19006a4c97","link_url":"","version":"56b92afe08d8b20d00bc3afd","body":"You can filter your view of the customers to see only the customers you want.  You can also add, edit or delete customers right from the customers page.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/WkqNPmDyTaCDoHmtLfAC_customer-list.png\",\n        \"customer-list.png\",\n        \"1478\",\n        \"516\",\n        \"#364c73\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","user":"564136b9f424a10d001181e1","link_external":false,"githubsync":"","sync_unique":"","type":"basic","title":"Customer Listing","__v":0,"updates":[],"createdAt":"2015-11-10T21:46:23.549Z","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[],"url":""},"order":10,"childrenPages":[]}

Customer Listing

The Customers page is where you manage your customers in the store.

You can filter your view of the customers to see only the customers you want. You can also add, edit or delete customers right from the customers page. [block:image] { "images": [ { "image": [ "https://files.readme.io/WkqNPmDyTaCDoHmtLfAC_customer-list.png", "customer-list.png", "1478", "516", "#364c73", "" ] } ] } [/block]
You can filter your view of the customers to see only the customers you want. You can also add, edit or delete customers right from the customers page. [block:image] { "images": [ { "image": [ "https://files.readme.io/WkqNPmDyTaCDoHmtLfAC_customer-list.png", "customer-list.png", "1478", "516", "#364c73", "" ] } ] } [/block]
{"_id":"56b92b0008d8b20d00bc3b13","link_external":false,"api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"slug":"marketing","category":"56b92aff08d8b20d00bc3b02","updates":[],"createdAt":"2015-11-10T21:46:33.141Z","type":"basic","project":"56421bcdb48bdf19006a4c97","githubsync":"","hidden":false,"body":"The offer listings sections in the Marketing tree lists out all your 'Offers'. Which are in effect discounts you want to offer customers.\n\nThe concept of an offer is an abstraction that developers can use to implement different sorts of discounts as well as conceptually other types of \"offers.\" \n\nIncluded in the Merchello.Core we've included a Coupon Provider - \"Coupons\" and a new Coupon Editor page which should allow editors to create quite a few different types of coupon offers. The system is based off a single reward (like % off or FREE shipping) that can be optionally constrained by one or more constraints APPLIED IN A CONFIGURABLE ORDER.\n\nIt is conceptually a complicated system, but it is extremely flexible.\n\nBoth rewards and constraints are resolvable, so if you do not find what you are looking for, you can roll your own. If this is something you are interested in trying, checkout the classes we've included in Merchello located in the Merchello.Web.Discounts.Coupons namespace.\n\nhttps://github.com/Merchello/Merchello/tree/merchello-dev/src/Merchello.Web/Discounts/Coupons\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/y4LxmVKjR6uwXyjHiDqi_offer-listing.png\",\n        \"offer-listing.png\",\n        \"1479\",\n        \"555\",\n        \"#3e567d\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","link_url":"","sync_unique":"","excerpt":"","title":"Offer Listings","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","order":11,"__v":0,"childrenPages":[]}

Offer Listings


The offer listings sections in the Marketing tree lists out all your 'Offers'. Which are in effect discounts you want to offer customers. The concept of an offer is an abstraction that developers can use to implement different sorts of discounts as well as conceptually other types of "offers." Included in the Merchello.Core we've included a Coupon Provider - "Coupons" and a new Coupon Editor page which should allow editors to create quite a few different types of coupon offers. The system is based off a single reward (like % off or FREE shipping) that can be optionally constrained by one or more constraints APPLIED IN A CONFIGURABLE ORDER. It is conceptually a complicated system, but it is extremely flexible. Both rewards and constraints are resolvable, so if you do not find what you are looking for, you can roll your own. If this is something you are interested in trying, checkout the classes we've included in Merchello located in the Merchello.Web.Discounts.Coupons namespace. https://github.com/Merchello/Merchello/tree/merchello-dev/src/Merchello.Web/Discounts/Coupons [block:image] { "images": [ { "image": [ "https://files.readme.io/y4LxmVKjR6uwXyjHiDqi_offer-listing.png", "offer-listing.png", "1479", "555", "#3e567d", "" ] } ] } [/block]
The offer listings sections in the Marketing tree lists out all your 'Offers'. Which are in effect discounts you want to offer customers. The concept of an offer is an abstraction that developers can use to implement different sorts of discounts as well as conceptually other types of "offers." Included in the Merchello.Core we've included a Coupon Provider - "Coupons" and a new Coupon Editor page which should allow editors to create quite a few different types of coupon offers. The system is based off a single reward (like % off or FREE shipping) that can be optionally constrained by one or more constraints APPLIED IN A CONFIGURABLE ORDER. It is conceptually a complicated system, but it is extremely flexible. Both rewards and constraints are resolvable, so if you do not find what you are looking for, you can roll your own. If this is something you are interested in trying, checkout the classes we've included in Merchello located in the Merchello.Web.Discounts.Coupons namespace. https://github.com/Merchello/Merchello/tree/merchello-dev/src/Merchello.Web/Discounts/Coupons [block:image] { "images": [ { "image": [ "https://files.readme.io/y4LxmVKjR6uwXyjHiDqi_offer-listing.png", "offer-listing.png", "1479", "555", "#3e567d", "" ] } ] } [/block]
{"_id":"56b92b0008d8b20d00bc3b14","link_url":"","sync_unique":"","hidden":false,"order":12,"excerpt":"","slug":"coupons","user":"56425464b48bdf19006a4cfd","api":{"results":{"codes":[{"code":"{}","language":"json","status":200,"name":""},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","auth":"required","params":[],"url":""},"title":"Coupons","createdAt":"2016-01-01T09:39:46.721Z","githubsync":"","link_external":false,"__v":0,"version":"56b92afe08d8b20d00bc3afd","updates":[],"body":"As explained above, the Coupon Provider is supplied out of the box.\n\nTo create a new Coupon, right click on the 'Marketing' tree and select 'New Offer'. You will now see a list of all 'Offer' Providers that have been created.\n\nSelect Coupon and then Give it a name, and a code (This is what the customer will use in the front end...i.e. '10OFF'). You can also optionally select a date range, once done click save.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/uOrRNLQCfa4jjSn6wqgb_coupon.PNG\",\n        \"coupon.PNG\",\n        \"964\",\n        \"351\",\n        \"#4e5980\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can now configure the coupon. As you will see, Coupons themselves can be quite complex.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/BJ8byhsQ5OZZqtcvYO0K_assign.PNG\",\n        \"assign.PNG\",\n        \"1186\",\n        \"1122\",\n        \"#6194d0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nIf we are going to offer 10% off as per the screenshots, then Under Available Rewards we'll assign 'Discount the price' by clicking the plus button next to it.\n\nOnce Assigned, we just need to configure it. By adding a name that will appear on the invoice, then making sure we choose % off. This is done by clicking, the edit/pencil icon and select the % radio button and adding 10 into the text box.\n\nOnce saved, the final thing you need to do is enable it at the top of the page.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/YnkZLPQQ4CkvzYRvuXWO_active.PNG\",\n        \"active.PNG\",\n        \"1035\",\n        \"288\",\n        \"#53a262\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","type":"basic","category":"56b92aff08d8b20d00bc3b02","project":"56421bcdb48bdf19006a4c97","childrenPages":[]}

Coupons


As explained above, the Coupon Provider is supplied out of the box. To create a new Coupon, right click on the 'Marketing' tree and select 'New Offer'. You will now see a list of all 'Offer' Providers that have been created. Select Coupon and then Give it a name, and a code (This is what the customer will use in the front end...i.e. '10OFF'). You can also optionally select a date range, once done click save. [block:image] { "images": [ { "image": [ "https://files.readme.io/uOrRNLQCfa4jjSn6wqgb_coupon.PNG", "coupon.PNG", "964", "351", "#4e5980", "" ] } ] } [/block] You can now configure the coupon. As you will see, Coupons themselves can be quite complex. [block:image] { "images": [ { "image": [ "https://files.readme.io/BJ8byhsQ5OZZqtcvYO0K_assign.PNG", "assign.PNG", "1186", "1122", "#6194d0", "" ] } ] } [/block] If we are going to offer 10% off as per the screenshots, then Under Available Rewards we'll assign 'Discount the price' by clicking the plus button next to it. Once Assigned, we just need to configure it. By adding a name that will appear on the invoice, then making sure we choose % off. This is done by clicking, the edit/pencil icon and select the % radio button and adding 10 into the text box. Once saved, the final thing you need to do is enable it at the top of the page. [block:image] { "images": [ { "image": [ "https://files.readme.io/YnkZLPQQ4CkvzYRvuXWO_active.PNG", "active.PNG", "1035", "288", "#53a262", "" ] } ] } [/block]
As explained above, the Coupon Provider is supplied out of the box. To create a new Coupon, right click on the 'Marketing' tree and select 'New Offer'. You will now see a list of all 'Offer' Providers that have been created. Select Coupon and then Give it a name, and a code (This is what the customer will use in the front end...i.e. '10OFF'). You can also optionally select a date range, once done click save. [block:image] { "images": [ { "image": [ "https://files.readme.io/uOrRNLQCfa4jjSn6wqgb_coupon.PNG", "coupon.PNG", "964", "351", "#4e5980", "" ] } ] } [/block] You can now configure the coupon. As you will see, Coupons themselves can be quite complex. [block:image] { "images": [ { "image": [ "https://files.readme.io/BJ8byhsQ5OZZqtcvYO0K_assign.PNG", "assign.PNG", "1186", "1122", "#6194d0", "" ] } ] } [/block] If we are going to offer 10% off as per the screenshots, then Under Available Rewards we'll assign 'Discount the price' by clicking the plus button next to it. Once Assigned, we just need to configure it. By adding a name that will appear on the invoice, then making sure we choose % off. This is done by clicking, the edit/pencil icon and select the % radio button and adding 10 into the text box. Once saved, the final thing you need to do is enable it at the top of the page. [block:image] { "images": [ { "image": [ "https://files.readme.io/YnkZLPQQ4CkvzYRvuXWO_active.PNG", "active.PNG", "1035", "288", "#53a262", "" ] } ] } [/block]
{"_id":"56b92b0008d8b20d00bc3b15","__v":0,"user":"564136b9f424a10d001181e1","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"excerpt":"","slug":"this-week-vs-last-week","type":"basic","version":"56b92afe08d8b20d00bc3afd","updates":[],"createdAt":"2016-02-02T16:56:48.249Z","sync_unique":"","order":13,"hidden":false,"body":"This report provides a snap shot view of sales made in the current week versus the matching day of the previous week.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/s7jeVn0CRgmbRTTRG5jc_ThisWeekVsLast.png\",\n        \"ThisWeekVsLast.png\",\n        \"1555\",\n        \"901\",\n        \"#d06531\",\n        \"\"\n      ],\n      \"sizing\": \"full\",\n      \"caption\": \"This week versus last week\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Multiple Currencies\",\n  \"body\": \"The report further breaks down sales by currency if a site accepts charges in multiple currencies.\"\n}\n[/block]","title":"This Week Vs. Last Week","category":"56b92aff08d8b20d00bc3b03","project":"56421bcdb48bdf19006a4c97","link_external":false,"link_url":"","githubsync":"","childrenPages":[]}

This Week Vs. Last Week


This report provides a snap shot view of sales made in the current week versus the matching day of the previous week. [block:image] { "images": [ { "image": [ "https://files.readme.io/s7jeVn0CRgmbRTTRG5jc_ThisWeekVsLast.png", "ThisWeekVsLast.png", "1555", "901", "#d06531", "" ], "sizing": "full", "caption": "This week versus last week" } ] } [/block] [block:callout] { "type": "info", "title": "Multiple Currencies", "body": "The report further breaks down sales by currency if a site accepts charges in multiple currencies." } [/block]
This report provides a snap shot view of sales made in the current week versus the matching day of the previous week. [block:image] { "images": [ { "image": [ "https://files.readme.io/s7jeVn0CRgmbRTTRG5jc_ThisWeekVsLast.png", "ThisWeekVsLast.png", "1555", "901", "#d06531", "" ], "sizing": "full", "caption": "This week versus last week" } ] } [/block] [block:callout] { "type": "info", "title": "Multiple Currencies", "body": "The report further breaks down sales by currency if a site accepts charges in multiple currencies." } [/block]
{"_id":"56b92b0008d8b20d00bc3b16","project":"56421bcdb48bdf19006a4c97","updates":[],"sync_unique":"","hidden":false,"title":"Sales Over Time","__v":0,"createdAt":"2016-02-01T21:06:24.125Z","githubsync":"","api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required"},"excerpt":"","slug":"sales-over-time","version":"56b92afe08d8b20d00bc3afd","body":"This report shows total monthly sales for the previous year (by default).  Dates can be selected.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Z9hiMP0S2aFdWbkNq9ys_SalesOverTime.png\",\n        \"SalesOverTime.png\",\n        \"1468\",\n        \"901\",\n        \"#cf6333\",\n        \"\"\n      ],\n      \"sizing\": \"full\",\n      \"caption\": \"Sales Over Time\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Multiple Currencies\",\n  \"body\": \"The report further breaks down sales by currency if a site accepts charges in multiple currencies.\"\n}\n[/block]","type":"basic","category":"56b92aff08d8b20d00bc3b03","user":"564136b9f424a10d001181e1","link_external":false,"link_url":"","order":14,"childrenPages":[]}

Sales Over Time


This report shows total monthly sales for the previous year (by default). Dates can be selected. [block:image] { "images": [ { "image": [ "https://files.readme.io/Z9hiMP0S2aFdWbkNq9ys_SalesOverTime.png", "SalesOverTime.png", "1468", "901", "#cf6333", "" ], "sizing": "full", "caption": "Sales Over Time" } ] } [/block] [block:callout] { "type": "info", "title": "Multiple Currencies", "body": "The report further breaks down sales by currency if a site accepts charges in multiple currencies." } [/block]
This report shows total monthly sales for the previous year (by default). Dates can be selected. [block:image] { "images": [ { "image": [ "https://files.readme.io/Z9hiMP0S2aFdWbkNq9ys_SalesOverTime.png", "SalesOverTime.png", "1468", "901", "#cf6333", "" ], "sizing": "full", "caption": "Sales Over Time" } ] } [/block] [block:callout] { "type": "info", "title": "Multiple Currencies", "body": "The report further breaks down sales by currency if a site accepts charges in multiple currencies." } [/block]
{"_id":"56b92b0008d8b20d00bc3b17","project":"56421bcdb48bdf19006a4c97","title":"Sales By Item","updates":[],"link_external":false,"githubsync":"","hidden":false,"body":"This report shows the **TOP 10** historically purchased items. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Dvc4USV2Tki4EdLnRRSC_SalesByItem.png\",\n        \"SalesByItem.png\",\n        \"1322\",\n        \"800\",\n        \"#fa6b6a\",\n        \"\"\n      ],\n      \"sizing\": \"full\",\n      \"caption\": \"Sales by Item\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"TOP 10\",\n  \"body\": \"The report is limited to 10 items due to limitations in the graphing library.\"\n}\n[/block]","category":"56b92aff08d8b20d00bc3b03","version":"56b92afe08d8b20d00bc3afd","order":15,"excerpt":"","slug":"sales-by-item","type":"basic","__v":0,"user":"564136b9f424a10d001181e1","createdAt":"2016-02-01T21:06:40.854Z","link_url":"","sync_unique":"","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":""},"childrenPages":[]}

Sales By Item


This report shows the **TOP 10** historically purchased items. [block:image] { "images": [ { "image": [ "https://files.readme.io/Dvc4USV2Tki4EdLnRRSC_SalesByItem.png", "SalesByItem.png", "1322", "800", "#fa6b6a", "" ], "sizing": "full", "caption": "Sales by Item" } ] } [/block] [block:callout] { "type": "info", "title": "TOP 10", "body": "The report is limited to 10 items due to limitations in the graphing library." } [/block]
This report shows the **TOP 10** historically purchased items. [block:image] { "images": [ { "image": [ "https://files.readme.io/Dvc4USV2Tki4EdLnRRSC_SalesByItem.png", "SalesByItem.png", "1322", "800", "#fa6b6a", "" ], "sizing": "full", "caption": "Sales by Item" } ] } [/block] [block:callout] { "type": "info", "title": "TOP 10", "body": "The report is limited to 10 items due to limitations in the graphing library." } [/block]
{"_id":"56b92b0008d8b20d00bc3b18","category":"56b92aff08d8b20d00bc3b03","sync_unique":"","title":"Abandoned Basket","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","updates":[],"link_external":false,"githubsync":"","excerpt":"","slug":"abandoned-basket","type":"basic","__v":0,"version":"56b92afe08d8b20d00bc3afd","hidden":false,"api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required"},"order":16,"body":"The abandoned basket report provides a quick view of both customer and anonymous customers who completed checkouts versus those that have left items in their basket without checking out. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/h5nhE3KOSJWllvCKd1hU_abandoned-basket.png\",\n        \"abandoned-basket.png\",\n        \"1713\",\n        \"901\",\n        \"#d4672f\",\n        \"\"\n      ],\n      \"sizing\": \"full\",\n      \"caption\": \"Abandoned Baskets Versus Completed Checkouts\"\n    }\n  ]\n}\n[/block]\nFor known customers who left items in their basket, a page list showing the basket contents is also available.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4nZWOq0lT9aie5u3MOQV_customer-baskets.png\",\n        \"customer-baskets.png\",\n        \"1484\",\n        \"234\",\n        \"#515151\",\n        \"\"\n      ],\n      \"sizing\": \"full\"\n    }\n  ]\n}\n[/block]","createdAt":"2016-02-01T21:06:58.395Z","link_url":"","childrenPages":[]}

Abandoned Basket


The abandoned basket report provides a quick view of both customer and anonymous customers who completed checkouts versus those that have left items in their basket without checking out. [block:image] { "images": [ { "image": [ "https://files.readme.io/h5nhE3KOSJWllvCKd1hU_abandoned-basket.png", "abandoned-basket.png", "1713", "901", "#d4672f", "" ], "sizing": "full", "caption": "Abandoned Baskets Versus Completed Checkouts" } ] } [/block] For known customers who left items in their basket, a page list showing the basket contents is also available. [block:image] { "images": [ { "image": [ "https://files.readme.io/4nZWOq0lT9aie5u3MOQV_customer-baskets.png", "customer-baskets.png", "1484", "234", "#515151", "" ], "sizing": "full" } ] } [/block]
The abandoned basket report provides a quick view of both customer and anonymous customers who completed checkouts versus those that have left items in their basket without checking out. [block:image] { "images": [ { "image": [ "https://files.readme.io/h5nhE3KOSJWllvCKd1hU_abandoned-basket.png", "abandoned-basket.png", "1713", "901", "#d4672f", "" ], "sizing": "full", "caption": "Abandoned Baskets Versus Completed Checkouts" } ] } [/block] For known customers who left items in their basket, a page list showing the basket contents is also available. [block:image] { "images": [ { "image": [ "https://files.readme.io/4nZWOq0lT9aie5u3MOQV_customer-baskets.png", "customer-baskets.png", "1484", "234", "#515151", "" ], "sizing": "full" } ] } [/block]
{"_id":"56b92b0308d8b20d00bc3b26","link_external":false,"body":"Gateway providers are used to provide a standardized way of implementing either internal programming or external service communications. This functionality is broken down into four specific types of providers. These provider types are Notification, Payment, Shipping and Taxation.\n\nRolling your own gateway provider can be a very rewarding experience. When you are finished testing your gateway, contribute it to the community. As the community library of gateways continues to grow, imagine the benefits to you finding a gateway already written to your need. Everyone wins!\n\nMerchello gateway providers are all written to follow a specific set of design guidelines. Follow these guidelines in your provider to ensure your gateway has full compatibility throughout the Merchello application.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/IzTKtwfySEeo2M7lA7Ua_dtKWzuu.jpg\",\n        \"dtKWzuu.jpg\",\n        \"900\",\n        \"520\",\n        \"#e9e9e9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"BackOffice\"\n}\n[/block]\nThe Gateway Providers page is where you manage your 3rd party providers. You can activate and deactivate your providers. This allows you to leave the provider in the system, yet inactive.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/WT8kBY4aQ6WgDNAzOP9G_gateway-providers.png\",\n        \"gateway-providers.png\",\n        \"1478\",\n        \"688\",\n        \"#44557c\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n##Configuration\nProviders may allow for configuration. If configuration is possible, a pencil button will appear to the right of the deactivate button. Some gateways have additional configuration abilities on each individual gateway page. These are generally not the same properties. \n\n###Provider packages installed with Merchello Installation\nSeveral providers are installed for you: \n\n|Type | Name|\n|----|-----|\n|Notification| SMTP|\n|Payment | Cash |\n|Shipping | Fixed Rate |\n|Taxation | Fixed Rate | \n\nYou may have to activate the provider, which is done by clicking on the lightbulb icon on the listing page. Example of this can be seen below with the built in SMTP provider. After first install you will need to activate the SMTP provider.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/tOcNSvMkQg2amuysZUID_activate.PNG\",\n        \"activate.PNG\",\n        \"1009\",\n        \"118\",\n        \"#5d91cc\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nOnce you have clicked on the active icon, you will see an edit and delete icon. The edit icon is present because the SMTP provider requires some additional configuration.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4o3vhodQyCRuIwvXDdLw_activated.PNG\",\n        \"activated.PNG\",\n        \"1004\",\n        \"108\",\n        \"#5f92d0\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/BiInN6ZmT0iGu5zdBV1f_edit-settings.PNG\",\n        \"edit-settings.PNG\",\n        \"1009\",\n        \"397\",\n        \"#70a4d9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]","user":"564136b9f424a10d001181e1","updates":[],"link_url":"","hidden":false,"api":{"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"order":17,"slug":"gateway-providers","type":"basic","version":"56b92afe08d8b20d00bc3afd","__v":0,"sync_unique":"","title":"Gateway Providers","createdAt":"2015-11-10T21:46:52.115Z","project":"56421bcdb48bdf19006a4c97","githubsync":"","excerpt":"","category":"56b92aff08d8b20d00bc3b04","childrenPages":[]}

Gateway Providers


Gateway providers are used to provide a standardized way of implementing either internal programming or external service communications. This functionality is broken down into four specific types of providers. These provider types are Notification, Payment, Shipping and Taxation. Rolling your own gateway provider can be a very rewarding experience. When you are finished testing your gateway, contribute it to the community. As the community library of gateways continues to grow, imagine the benefits to you finding a gateway already written to your need. Everyone wins! Merchello gateway providers are all written to follow a specific set of design guidelines. Follow these guidelines in your provider to ensure your gateway has full compatibility throughout the Merchello application. [block:image] { "images": [ { "image": [ "https://files.readme.io/IzTKtwfySEeo2M7lA7Ua_dtKWzuu.jpg", "dtKWzuu.jpg", "900", "520", "#e9e9e9", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "BackOffice" } [/block] The Gateway Providers page is where you manage your 3rd party providers. You can activate and deactivate your providers. This allows you to leave the provider in the system, yet inactive. [block:image] { "images": [ { "image": [ "https://files.readme.io/WT8kBY4aQ6WgDNAzOP9G_gateway-providers.png", "gateway-providers.png", "1478", "688", "#44557c", "" ] } ] } [/block] ##Configuration Providers may allow for configuration. If configuration is possible, a pencil button will appear to the right of the deactivate button. Some gateways have additional configuration abilities on each individual gateway page. These are generally not the same properties. ###Provider packages installed with Merchello Installation Several providers are installed for you: |Type | Name| |----|-----| |Notification| SMTP| |Payment | Cash | |Shipping | Fixed Rate | |Taxation | Fixed Rate | You may have to activate the provider, which is done by clicking on the lightbulb icon on the listing page. Example of this can be seen below with the built in SMTP provider. After first install you will need to activate the SMTP provider. [block:image] { "images": [ { "image": [ "https://files.readme.io/tOcNSvMkQg2amuysZUID_activate.PNG", "activate.PNG", "1009", "118", "#5d91cc", "" ] } ] } [/block] Once you have clicked on the active icon, you will see an edit and delete icon. The edit icon is present because the SMTP provider requires some additional configuration. [block:image] { "images": [ { "image": [ "https://files.readme.io/4o3vhodQyCRuIwvXDdLw_activated.PNG", "activated.PNG", "1004", "108", "#5f92d0", "" ] } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/BiInN6ZmT0iGu5zdBV1f_edit-settings.PNG", "edit-settings.PNG", "1009", "397", "#70a4d9", "" ] } ] } [/block]
Gateway providers are used to provide a standardized way of implementing either internal programming or external service communications. This functionality is broken down into four specific types of providers. These provider types are Notification, Payment, Shipping and Taxation. Rolling your own gateway provider can be a very rewarding experience. When you are finished testing your gateway, contribute it to the community. As the community library of gateways continues to grow, imagine the benefits to you finding a gateway already written to your need. Everyone wins! Merchello gateway providers are all written to follow a specific set of design guidelines. Follow these guidelines in your provider to ensure your gateway has full compatibility throughout the Merchello application. [block:image] { "images": [ { "image": [ "https://files.readme.io/IzTKtwfySEeo2M7lA7Ua_dtKWzuu.jpg", "dtKWzuu.jpg", "900", "520", "#e9e9e9", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "BackOffice" } [/block] The Gateway Providers page is where you manage your 3rd party providers. You can activate and deactivate your providers. This allows you to leave the provider in the system, yet inactive. [block:image] { "images": [ { "image": [ "https://files.readme.io/WT8kBY4aQ6WgDNAzOP9G_gateway-providers.png", "gateway-providers.png", "1478", "688", "#44557c", "" ] } ] } [/block] ##Configuration Providers may allow for configuration. If configuration is possible, a pencil button will appear to the right of the deactivate button. Some gateways have additional configuration abilities on each individual gateway page. These are generally not the same properties. ###Provider packages installed with Merchello Installation Several providers are installed for you: |Type | Name| |----|-----| |Notification| SMTP| |Payment | Cash | |Shipping | Fixed Rate | |Taxation | Fixed Rate | You may have to activate the provider, which is done by clicking on the lightbulb icon on the listing page. Example of this can be seen below with the built in SMTP provider. After first install you will need to activate the SMTP provider. [block:image] { "images": [ { "image": [ "https://files.readme.io/tOcNSvMkQg2amuysZUID_activate.PNG", "activate.PNG", "1009", "118", "#5d91cc", "" ] } ] } [/block] Once you have clicked on the active icon, you will see an edit and delete icon. The edit icon is present because the SMTP provider requires some additional configuration. [block:image] { "images": [ { "image": [ "https://files.readme.io/4o3vhodQyCRuIwvXDdLw_activated.PNG", "activated.PNG", "1004", "108", "#5f92d0", "" ] } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/BiInN6ZmT0iGu5zdBV1f_edit-settings.PNG", "edit-settings.PNG", "1009", "397", "#70a4d9", "" ] } ] } [/block]
{"_id":"56b92b0708d8b20d00bc3b40","user":"56425464b48bdf19006a4cfd","createdAt":"2016-01-01T10:19:00.729Z","link_external":false,"title":"Notification","updates":[],"order":18,"slug":"using-providers","category":"56b92aff08d8b20d00bc3b05","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","githubsync":"","hidden":false,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Usage\"\n}\n[/block]\nOnce you have activated a provider, you can now go and set up the provider. Click on the tab which is the type of provider you have activated.\n\nIn our case, it was the SMTP provider which is of type 'Notification'. On the right you can see the link 'Add Notification'. Click the link and you'll see 'Email Notification', choose Add and give it a name (i.e. Order Notifications) and a description (Optional).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/gec0qtpKQGyuKIZhbHPo_stageone.PNG\",\n        \"stageone.PNG\",\n        \"776\",\n        \"65\",\n        \"#bf884a\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nTo configure the Order Confirmation, click on the + icon and you'll see some events we can hook into. We want the first one 'Order Confirmation Message (Pattern Replace)'. Add your Subject, From Email Address and (Optional) description.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/sYCouAhWRHGbmQFr2Ngw_stagetwo.PNG\",\n        \"stagetwo.PNG\",\n        \"778\",\n        \"185\",\n        \"#5998d5\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nLastly, let's configure the actual message the we'll send. Click on the edit/pencil icon next to your email address. And you'll get a tab with all the final options for this provider. Here you can choose to whom you send the order confirmation and the actual message.\n\nAs this message is a 'Pattern Replace' we can pull out data from the order using a pattern like we use in AngularJs to display data i.e. {{BillToName}} or {{PaymentAmount}}\n\nA full list of the items we can use are listed in the Merchello.config and it's always best to check there for the most recent items. Below is a list at the time of writing this documentation.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"    <patternFormatter>\\n\\n        <!-- patterns to search and replace can be \\n          \\n          <replace alias=\\\"Company\\\" pattern=\\\"{{Company}}\\\" replacement=\\\"Merchello\\\" replacementInMonitor=\\\"false\\\" />\\n          -->\\n\\n        <!--\\n          Depending on the model passed to the \\\"Monitor\\\" responsible for populating the replacements, some of these values will be empty.  For example,\\n          a MonitorModel that only contains shipment information will not be able to populate Billing information ...\\n          -->\\n\\n        <!-- INVOICE -->\\n        <replace alias=\\\"InvoiceKey\\\" pattern=\\\"{{InvoiceKey}}\\\" />\\n        <replace alias=\\\"InvoiceNumber\\\" pattern=\\\"{{InvoiceNumber}}\\\" />\\n        <replace alias=\\\"InvoiceDate\\\" pattern=\\\"{{InvoiceDate}}\\\" />\\n\\n        <replace alias=\\\"InvoiceStatus\\\" pattern=\\\"{{InvoiceStatus}}\\\" />\\n        <replace alias=\\\"TotalDiscountPrice\\\" pattern=\\\"{{TotalDiscountPrice}}\\\" />\\n        <replace alias=\\\"TotalShippingPrice\\\" pattern=\\\"{{TotalShippingPrice}}\\\" />\\n        <replace alias=\\\"TotalCustomPrice\\\" pattern=\\\"{{TotalCustomPrice}}\\\" />\\n        <replace alias=\\\"TotalTaxPrice\\\" pattern=\\\"{{TotalTaxPrice}}\\\" />\\n        <replace alias=\\\"TotalItemPrice\\\" pattern=\\\"{{TotalItemPrice}}\\\" />\\n        <replace alias=\\\"TotalItemPlusCustom\\\" pattern=\\\"{{TotalItemPlusCustom}}\\\" />\\n        <replace alias=\\\"TotalPrice\\\" pattern=\\\"{{TotalPrice}}\\\" />\\n\\n        <!-- ADDRESS -->\\n        <replace alias=\\\"BillToName\\\" pattern=\\\"{{BillToName}}\\\" />\\n        <replace alias=\\\"BillToAddress1\\\" pattern=\\\"{{BillToAddress1}}\\\" />\\n        <replace alias=\\\"BillToAddress2\\\" pattern=\\\"{{BillToAddress2}}\\\" />\\n        <replace alias=\\\"BillToLocality\\\" pattern=\\\"{{BillToLocality}}\\\" />\\n        <replace alias=\\\"BillToRegion\\\" pattern=\\\"{{BillToRegion}}\\\" />\\n        <replace alias=\\\"BillToPostalCode\\\" pattern=\\\"{{BillToPostalCode}}\\\" />\\n        <replace alias=\\\"BillToCountryCode\\\" pattern=\\\"{{BillToCountryCode}}\\\" />\\n        <replace alias=\\\"BillToEmail\\\" pattern=\\\"{{BillToEmail}}\\\" />\\n        <replace alias=\\\"BillToPhone\\\" pattern=\\\"{{BillToPhone}}\\\" />\\n        <replace alias=\\\"BillToCompany\\\" pattern=\\\"{{BillToCompany}}\\\" />\\n\\n        <replace alias=\\\"ShippedDate\\\" pattern=\\\"{{ShippedDate}}\\\" />\\n        <replace alias=\\\"ShipToAddress1\\\" pattern=\\\"{{ShipToAddress1}}\\\" />\\n        <replace alias=\\\"ShipToAddress2\\\" pattern=\\\"{{ShipToAddress2}}\\\" />\\n        <replace alias=\\\"ShipToLocality\\\" pattern=\\\"{{ShipToLocality}}\\\" />\\n        <replace alias=\\\"ShipToRegion\\\" pattern=\\\"{{ShipToRegion}}\\\" />\\n        <replace alias=\\\"ShipToPostalCode\\\" pattern=\\\"{{ShipToPostalCode}}\\\" />     \\n        <replace alias=\\\"ShipToCountryCode\\\" pattern=\\\"{{ShipToCountryCode}}\\\" />\\n        <replace alias=\\\"ShipToName\\\" pattern=\\\"{{ShipToName}}\\\" />\\n        <replace alias=\\\"ShipToEmail\\\" pattern=\\\"{{ShipToEmail}}\\\" />\\n        <replace alias=\\\"ShipToPhone\\\" pattern=\\\"{{ShipToPhone}}\\\" />\\n        <replace alias=\\\"ShipToOrganization\\\" pattern=\\\"{{ShipToOrganization}}\\\" />\\n        <replace alias=\\\"ShipToName\\\" pattern=\\\"{{ShipToName}}\\\" />\\n        <replace alias=\\\"TrackingCode\\\" pattern=\\\"{{TrackingCode}}\\\" />\\n        <replace alias=\\\"ShipMethodName\\\" pattern=\\\"{{ShipMethodName}}\\\" />\\n        <!-- ITERATING THROUGH LINE ITEMS -->\\n\\n\\n        <!-- LINE ITEMS\\n        these must be between the IterationStart[Invoice.Items] and IterationEnd[Invoice.Items] so they get repeated in the iteration -\\n        the pattern is then dynamically changed to\\n        \\n        Item.Sku.0 - Item.Name.0 - Item.Price.0 ...\\n        Item.Sku.1 - Item.Name.1 - Item.Price.1 ...\\n        Item.Sku.2 - Item.Name.2 - Item.Price.2 ...\\n        \\n        before the formatter performs it's replacements the message \\n        -->\\n        <replace alias=\\\"LineItemSku\\\" pattern=\\\"{{Item.Sku}}\\\" />\\n        <replace alias=\\\"LineItemName\\\" pattern=\\\"{{Item.Name}}\\\" />\\n        <replace alias=\\\"LineItemUnitPrice\\\" pattern=\\\"{{Item.UnitPrice}}\\\" />\\n        <replace alias=\\\"LineItemQuantity\\\" pattern=\\\"{{Item.Quantity}}\\\" />\\n        <replace alias=\\\"LineItemTotalPrice\\\" pattern=\\\"{{Item.TotalPrice}}\\\" />\\n\\n        <!-- PAYMENT -->\\n        <replace alias=\\\"PaymentMethodName\\\" pattern=\\\"{{PaymentMethodName}}\\\" />\\n        <replace alias=\\\"PaymentAmount\\\" pattern=\\\"{{PaymentAmount}}\\\" />\\n        <replace alias=\\\"PamentReferenceNumber\\\" pattern=\\\"{{ReferenceNumber}}\\\" />\\n\\n    </patternFormatter>\",\n      \"language\": \"xml\",\n      \"name\": \"Patterns\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"How to create a Custom Notification Provider\"\n}\n[/block]\nMerchello Notifications allow you to send email, twitter, or other information posts based on triggered events. An example of a notification is for a customer to receive an email confirming a placed order or processed credit card sale.\n\nWhile there are a few standard events (new order) and notifications (SMTP/email), Merchello allows you to build your own to fit your unique business needs.\n\n###The Custom Notification Gateway\n\nIn this example, I will build a custom SMTP/email-based notification that sends email when a new product is added to the catalog. The email is sent to both warehouse personnel and the sales team alerting them to the new product.\n\nThis notification doesn't create new information but uses existing information (the new product) in Merchello to fulfill the notification event.\n\n###Development Tasks\n\nThe first task is create the class library for the sample notification gateway. Once the library is created and its gateway code is completed and built, the class library will be added to the website.\n\n###Test Tasks: BackOffice\n\nThe first test task is to prepare the Back office.\n\nModify the Back office to activate the SMTP notification gateway, then add notification messages for the new event (new product) to both sales and warehouse personal. The email template will include replaceable strings with double curly brackets . When the new product event is triggered, the replaceable strings will be replaced with the properties of the new product.\n\n###Test Tasks: Trip the Notification Event\n\nThe next test task is to use the Back office - tripping the trigger to send the emails. Create a new Merchello product. Make sure to fill in the following properties when you create the product:\n\nName\nSku\nBarcode\nTrackInventory\nHeight\nLength\nWidth\nWeight\n\nThese properties are used in the email template. These are not all the Product properties so more could have been added to the email because they are in the monitor replacement code. However, I choose not to include them.\n\n###Considerations for your own Custom Notification\n\nIn this example, I rely heavily on Merchello. The event is for new Merchello product created in the Back office and the notification information is from the new product object. This made the sample quick and easy.\n\nYour situation may be more complex with your own event and your own information. The trigger can be tripped at any time, and any object can be passed into the monitor.\n\nIf you just need to send email in a random spot of the website, feel free to use whatever SMTP framework you already have in place. Merchello notifications don't need to be used in that situation, but they are an option -- albeit a more complicated one.\n\n###Visual Studio Solution Organization\n\nFor this example, you will want to create a Class Library project. The class library BIN directory will need to have all the Umbraco and Merchello dlls from the website.\n\nIn the example code for this document, you will see a Visual Studio solution, with 2 projects. The first project is the class library. The second project is one of the sample Umbraco/Merchello websites.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/gARHVSrdSVqtgW2bWuf5_notif-cust-vs-solution.png\",\n        \"notif-cust-vs-solution.png\",\n        \"417\",\n        \"733\",\n        \"#476daa\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nAdd the class library as a reference to the website project. For this example, that is all you need to add the sample shipping gateway to the Merchello website. When you change and build the shipping gateway, the changes are encapsulated in the dll that is updated in the website's /BIN directory.\n\nMake sure the website is set as the Startup Project.\n\n###Simple Configurations For This Example\n\nJust adding a reference of the class library to the website skips several steps that you may want to go back and engineer to have a more durable project. The first is to wrap the addition of the class library (and any associated client-side files) into an Umbraco package.\n\n###Client Library\n\nFor the notification provider class library, you need 3 classes.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Class\",\n    \"h-1\": \"Inherits From\",\n    \"h-2\": \"Purpose\",\n    \"0-0\": \"NotificationEvent\",\n    \"0-1\": \"Umbraco.Core\\n.ApplicationEventHandler\",\n    \"0-2\": \"Register event to listen for, pass new product info to monitor for string replacement - converting template into email\",\n    \"1-0\": \"NotificationTripper\",\n    \"2-0\": \"NotificationMonitor\",\n    \"1-1\": \"Merchello.Core.Gateways\\n.Notification.Triggering\\n.NotificationTriggerBase\",\n    \"2-1\": \"Merchello.Core.Gateways\\n.Notification.Monitors\\n.NotificationMonitorBase\",\n    \"1-2\": \"registers trigger name and passes object from event to monitor\",\n    \"2-2\": \"Manage the replacement pattern for email\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n###Event class\n\nStart building the class library by registering the event and passing an object through the event. In this example, I selected the Saving event on the ProductService. When the saving event is triggered, the new product's information is passed through.\n\nMore than just new products can use the Saving event, so I use the HasProperty check to make sure I'm only firing off the notification trigger if the product does not have an existing identity.\n\nNotice the name \"ProductAdd\" of the trigger in this class is the same as the name in the class trigger class further down.\n\n**MerchelloEvents::ProductService_Saving** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"namespace MerchelloNotificationExampleProvder.Events\\n{\\n    using System;\\n    using System.Linq;\\n\\n    using Merchello.Core;\\n    using Merchello.Core.Events;\\n    using Merchello.Core.Models;\\n    using Merchello.Core.Services;\\n\\n    using Umbraco.Core;\\n    using Umbraco.Core.Events;\\n    using Umbraco.Core.Logging;\\n\\n    public class MerchelloEvents : ApplicationEventHandler\\n    {\\n        protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\\n        {\\n            // register event\\n            ProductService.Saving += ProductService_Saving;\\n        }\\n\\n        void ProductService_Saving(IProductService sender, SaveEventArgs<IProduct> e)\\n        {\\n            foreach (var product in e.SavedEntities)\\n            {\\n                // new products only\\n                if (!product.HasIdentity)\\n                {\\n                    // trigger event, pass product\\n                    Notification.Trigger(\\\"ProductAdd\\\", product);\\n                }\\n            }\\n        }\\n    }\\n}\",\n      \"language\": \"csharp\",\n      \"name\": \"MerchelloEvents\"\n    }\n  ]\n}\n[/block]\nNow that the event is wired up, we need something to do when it fires.\n\n###Trigger class\n\nThe trigger class's purpose is to be invoked by the invent and then notify the monitors. If you wanted to change this class for your own purposes, all you would need is a new class attribute decoration value for \"TriggerFor\" and a new object model to pass on such as IProduct.\n\nIn this version of Merchello, the second parameter of contacts is not used since the email contacts are set in the message in the Back Office. You could have also chosen to pick an object that contains an email address or list, or you could use the contacts list passed through.\n\n**ProductAddTrigger class** \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"namespace MerchelloNotificationExampleProvder.NotificationProvider\\n{\\n    using System;\\n    using System.Collections.Generic;\\n    using System.Linq;\\n    using System.Text;\\n    using System.Threading.Tasks;\\n\\n    using Merchello.Core.Gateways.Notification.Triggering;\\n    using Merchello.Core.Observation;\\n    using Merchello.Core.Models;\\n\\n    [TriggerFor(\\\"ProductAdd\\\", Topic.Notifications)]\\n    public class ProductAddTrigger : NotificationTriggerBase<Merchello.Core.Models.IProduct, Merchello.Core.Models.IProduct>\\n    {\\n        protected override void Notify(Merchello.Core.Models.IProduct product, IEnumerable<string> contacts)\\n        {\\n            this.NotifyMonitors(product);\\n        }\\n    }\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n###Monitor class\n\nThe real work is in the monitor class. This is where you replace strings in the email. The class decoration attribute contains a unique guid, the trigger class and the string that appears in the back office to create the message. Notice that the same IProduct is based from the event, through the trigger, and now to the monitor.\n\nThe code below is cherry-picking which properties of IProduct I want to pass through to the email template. You can add all or just a few or create a link with an ID that goes back to the website with information.\n\nProductAddMonitor\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"namespace MerchelloNotificationExampleProvder.NotificationProvider\\n{\\n    using System.Collections.Generic;\\n    using System.Linq;\\n    using Merchello.Core.Formatters;\\n    using Merchello.Core.Gateways.Notification;\\n    using Merchello.Core.Gateways.Notification.Monitors;\\n    using Merchello.Core.Observation;\\n    using Merchello.Core.Models;\\n\\n    [MonitorFor(\\\"B829266B-B585-4CA2-BCCB-4EBCEE045114\\\", typeof(ProductAddTrigger), \\\"Product Add Message (Pattern Replace)\\\")]\\n    public class ProductAddMonitor : NotificationMonitorBase<IProduct>\\n    {\\n        public ProductAddMonitor(INotificationContext notificationContext)\\n            : base(notificationContext)\\n        {\\n        }\\n\\n        public override void OnNext(IProduct value)\\n        {\\n            if (!Messages.Any()) return;\\n\\n            var patterns = new Dictionary<string, IReplaceablePattern>()\\n            {\\n                { \\\"Name\\\", new ReplaceablePattern(\\\"Name\\\", \\\"\\\", value.Name.ToString()) },    \\n                { \\\"TrackInventory\\\", new ReplaceablePattern(\\\"TrackInventory\\\", \\\"\\\", value.TrackInventory.ToString()) },\\n                { \\\"Barcode\\\", new ReplaceablePattern(\\\"Barcode\\\", \\\"\\\", value.Barcode) },\\n                { \\\"Sku\\\", new ReplaceablePattern(\\\"Sku\\\", \\\"\\\", value.Sku) },\\n                { \\\"Height\\\", new ReplaceablePattern(\\\"Height\\\", \\\"\\\", value.Height.ToString()) },\\n                { \\\"Length\\\", new ReplaceablePattern(\\\"Length\\\", \\\"\\\", value.Length.ToString()) },\\n                { \\\"Width\\\", new ReplaceablePattern(\\\"Width\\\", \\\"\\\", value.Width.ToString()) },\\n                { \\\"Weight\\\", new ReplaceablePattern(\\\"Weight\\\", \\\"\\\", value.Weight.ToString()) }\\n            };\\n\\n            var formatter = new PatternReplaceFormatter(patterns);\\n\\n            foreach (var message in Messages.ToArray())\\n            {\\n                // send the message\\n                NotificationContext.Send(message, formatter);\\n            }\\n        }\\n    }\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nNow that the 3 classes are connected, build the class library, make sure the website is set as the start project and debug.\n\n###Back Office Setup for Customer Notification Event\n\nStill in the Merchello back office, go to Settings/Notifications. Add a new notification and name it \"New Product.\" This is a category name for all messages created under this category. Add a message and select the new event \"Product Add Message,\" which was the name in the class attribute \"MonitorFor.\"\n\nFor the first message, name it \"Sales - New Product,\" and save. Create a second new message and name it \"Warehouse - New Product.\"\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/jLLXK4pfRD2TfD8tHKQM_notif-cust-bo-event.png\",\n        \"notif-cust-bo-event.png\",\n        \"1920\",\n        \"1033\",\n        \"#4ea34b\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThe only difference for these two messages is where it is going (the email address) and what it says (the template). The sales team probably doesn't need to know product measurements but the warehouse team definitely does need to know those to prepare a space in the warehouse.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/QiJbWtumR5OZO0vfE56w_notif-cust-bo-mess-setting.png\",\n        \"notif-cust-bo-mess-setting.png\",\n        \"1920\",\n        \"1031\",\n        \"#8d706e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/T8KTu2tqSUH6oaGuv7Lm_notif-cust-bo-mess-template.png\",\n        \"notif-cust-bo-mess-template.png\",\n        \"1917\",\n        \"1031\",\n        \"#54a161\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n###Ready to Test\n\nThe custom notification is coded up the class library and built into the website via a reference. The notification gateway is enabled and a notification message has been built on that custom trigger event. Now we are ready to test.\n\nCreate a New Product\n\nIn the Merchello back office, in the catalog, create a new Product. Save the product. You just triggered the event and you should now have two emails.\n\n###Local SMTP Server: SMTP4Dev\n\nWhile working on email notifications, I looked for a local smtp to install and test. I looked at several but wanted something that didn't let the emails leave my development machine. [I settled on SMTP4Dev](http://smtp4dev.codeplex.com/) which has both the source code and the install available from CodePlex. On my Windows 8.1 machine, it works well.","excerpt":"Notifications gateway providers allow you to send notifications based on events in Merchello. An popular notification is to send an email to a customer when the customer has completed the checkout process.","__v":0,"link_url":"","sync_unique":"","api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"status":400,"name":"","code":"{}","language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"type":"basic","childrenPages":[]}

Notification

Notifications gateway providers allow you to send notifications based on events in Merchello. An popular notification is to send an email to a customer when the customer has completed the checkout process.

[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] Once you have activated a provider, you can now go and set up the provider. Click on the tab which is the type of provider you have activated. In our case, it was the SMTP provider which is of type 'Notification'. On the right you can see the link 'Add Notification'. Click the link and you'll see 'Email Notification', choose Add and give it a name (i.e. Order Notifications) and a description (Optional). [block:image] { "images": [ { "image": [ "https://files.readme.io/gec0qtpKQGyuKIZhbHPo_stageone.PNG", "stageone.PNG", "776", "65", "#bf884a", "" ] } ] } [/block] To configure the Order Confirmation, click on the + icon and you'll see some events we can hook into. We want the first one 'Order Confirmation Message (Pattern Replace)'. Add your Subject, From Email Address and (Optional) description. [block:image] { "images": [ { "image": [ "https://files.readme.io/sYCouAhWRHGbmQFr2Ngw_stagetwo.PNG", "stagetwo.PNG", "778", "185", "#5998d5", "" ] } ] } [/block] Lastly, let's configure the actual message the we'll send. Click on the edit/pencil icon next to your email address. And you'll get a tab with all the final options for this provider. Here you can choose to whom you send the order confirmation and the actual message. As this message is a 'Pattern Replace' we can pull out data from the order using a pattern like we use in AngularJs to display data i.e. {{BillToName}} or {{PaymentAmount}} A full list of the items we can use are listed in the Merchello.config and it's always best to check there for the most recent items. Below is a list at the time of writing this documentation. [block:code] { "codes": [ { "code": " <patternFormatter>\n\n <!-- patterns to search and replace can be \n \n <replace alias=\"Company\" pattern=\"{{Company}}\" replacement=\"Merchello\" replacementInMonitor=\"false\" />\n -->\n\n <!--\n Depending on the model passed to the \"Monitor\" responsible for populating the replacements, some of these values will be empty. For example,\n a MonitorModel that only contains shipment information will not be able to populate Billing information ...\n -->\n\n <!-- INVOICE -->\n <replace alias=\"InvoiceKey\" pattern=\"{{InvoiceKey}}\" />\n <replace alias=\"InvoiceNumber\" pattern=\"{{InvoiceNumber}}\" />\n <replace alias=\"InvoiceDate\" pattern=\"{{InvoiceDate}}\" />\n\n <replace alias=\"InvoiceStatus\" pattern=\"{{InvoiceStatus}}\" />\n <replace alias=\"TotalDiscountPrice\" pattern=\"{{TotalDiscountPrice}}\" />\n <replace alias=\"TotalShippingPrice\" pattern=\"{{TotalShippingPrice}}\" />\n <replace alias=\"TotalCustomPrice\" pattern=\"{{TotalCustomPrice}}\" />\n <replace alias=\"TotalTaxPrice\" pattern=\"{{TotalTaxPrice}}\" />\n <replace alias=\"TotalItemPrice\" pattern=\"{{TotalItemPrice}}\" />\n <replace alias=\"TotalItemPlusCustom\" pattern=\"{{TotalItemPlusCustom}}\" />\n <replace alias=\"TotalPrice\" pattern=\"{{TotalPrice}}\" />\n\n <!-- ADDRESS -->\n <replace alias=\"BillToName\" pattern=\"{{BillToName}}\" />\n <replace alias=\"BillToAddress1\" pattern=\"{{BillToAddress1}}\" />\n <replace alias=\"BillToAddress2\" pattern=\"{{BillToAddress2}}\" />\n <replace alias=\"BillToLocality\" pattern=\"{{BillToLocality}}\" />\n <replace alias=\"BillToRegion\" pattern=\"{{BillToRegion}}\" />\n <replace alias=\"BillToPostalCode\" pattern=\"{{BillToPostalCode}}\" />\n <replace alias=\"BillToCountryCode\" pattern=\"{{BillToCountryCode}}\" />\n <replace alias=\"BillToEmail\" pattern=\"{{BillToEmail}}\" />\n <replace alias=\"BillToPhone\" pattern=\"{{BillToPhone}}\" />\n <replace alias=\"BillToCompany\" pattern=\"{{BillToCompany}}\" />\n\n <replace alias=\"ShippedDate\" pattern=\"{{ShippedDate}}\" />\n <replace alias=\"ShipToAddress1\" pattern=\"{{ShipToAddress1}}\" />\n <replace alias=\"ShipToAddress2\" pattern=\"{{ShipToAddress2}}\" />\n <replace alias=\"ShipToLocality\" pattern=\"{{ShipToLocality}}\" />\n <replace alias=\"ShipToRegion\" pattern=\"{{ShipToRegion}}\" />\n <replace alias=\"ShipToPostalCode\" pattern=\"{{ShipToPostalCode}}\" /> \n <replace alias=\"ShipToCountryCode\" pattern=\"{{ShipToCountryCode}}\" />\n <replace alias=\"ShipToName\" pattern=\"{{ShipToName}}\" />\n <replace alias=\"ShipToEmail\" pattern=\"{{ShipToEmail}}\" />\n <replace alias=\"ShipToPhone\" pattern=\"{{ShipToPhone}}\" />\n <replace alias=\"ShipToOrganization\" pattern=\"{{ShipToOrganization}}\" />\n <replace alias=\"ShipToName\" pattern=\"{{ShipToName}}\" />\n <replace alias=\"TrackingCode\" pattern=\"{{TrackingCode}}\" />\n <replace alias=\"ShipMethodName\" pattern=\"{{ShipMethodName}}\" />\n <!-- ITERATING THROUGH LINE ITEMS -->\n\n\n <!-- LINE ITEMS\n these must be between the IterationStart[Invoice.Items] and IterationEnd[Invoice.Items] so they get repeated in the iteration -\n the pattern is then dynamically changed to\n \n Item.Sku.0 - Item.Name.0 - Item.Price.0 ...\n Item.Sku.1 - Item.Name.1 - Item.Price.1 ...\n Item.Sku.2 - Item.Name.2 - Item.Price.2 ...\n \n before the formatter performs it's replacements the message \n -->\n <replace alias=\"LineItemSku\" pattern=\"{{Item.Sku}}\" />\n <replace alias=\"LineItemName\" pattern=\"{{Item.Name}}\" />\n <replace alias=\"LineItemUnitPrice\" pattern=\"{{Item.UnitPrice}}\" />\n <replace alias=\"LineItemQuantity\" pattern=\"{{Item.Quantity}}\" />\n <replace alias=\"LineItemTotalPrice\" pattern=\"{{Item.TotalPrice}}\" />\n\n <!-- PAYMENT -->\n <replace alias=\"PaymentMethodName\" pattern=\"{{PaymentMethodName}}\" />\n <replace alias=\"PaymentAmount\" pattern=\"{{PaymentAmount}}\" />\n <replace alias=\"PamentReferenceNumber\" pattern=\"{{ReferenceNumber}}\" />\n\n </patternFormatter>", "language": "xml", "name": "Patterns" } ] } [/block] [block:api-header] { "type": "basic", "title": "How to create a Custom Notification Provider" } [/block] Merchello Notifications allow you to send email, twitter, or other information posts based on triggered events. An example of a notification is for a customer to receive an email confirming a placed order or processed credit card sale. While there are a few standard events (new order) and notifications (SMTP/email), Merchello allows you to build your own to fit your unique business needs. ###The Custom Notification Gateway In this example, I will build a custom SMTP/email-based notification that sends email when a new product is added to the catalog. The email is sent to both warehouse personnel and the sales team alerting them to the new product. This notification doesn't create new information but uses existing information (the new product) in Merchello to fulfill the notification event. ###Development Tasks The first task is create the class library for the sample notification gateway. Once the library is created and its gateway code is completed and built, the class library will be added to the website. ###Test Tasks: BackOffice The first test task is to prepare the Back office. Modify the Back office to activate the SMTP notification gateway, then add notification messages for the new event (new product) to both sales and warehouse personal. The email template will include replaceable strings with double curly brackets . When the new product event is triggered, the replaceable strings will be replaced with the properties of the new product. ###Test Tasks: Trip the Notification Event The next test task is to use the Back office - tripping the trigger to send the emails. Create a new Merchello product. Make sure to fill in the following properties when you create the product: Name Sku Barcode TrackInventory Height Length Width Weight These properties are used in the email template. These are not all the Product properties so more could have been added to the email because they are in the monitor replacement code. However, I choose not to include them. ###Considerations for your own Custom Notification In this example, I rely heavily on Merchello. The event is for new Merchello product created in the Back office and the notification information is from the new product object. This made the sample quick and easy. Your situation may be more complex with your own event and your own information. The trigger can be tripped at any time, and any object can be passed into the monitor. If you just need to send email in a random spot of the website, feel free to use whatever SMTP framework you already have in place. Merchello notifications don't need to be used in that situation, but they are an option -- albeit a more complicated one. ###Visual Studio Solution Organization For this example, you will want to create a Class Library project. The class library BIN directory will need to have all the Umbraco and Merchello dlls from the website. In the example code for this document, you will see a Visual Studio solution, with 2 projects. The first project is the class library. The second project is one of the sample Umbraco/Merchello websites. [block:image] { "images": [ { "image": [ "https://files.readme.io/gARHVSrdSVqtgW2bWuf5_notif-cust-vs-solution.png", "notif-cust-vs-solution.png", "417", "733", "#476daa", "" ] } ] } [/block] Add the class library as a reference to the website project. For this example, that is all you need to add the sample shipping gateway to the Merchello website. When you change and build the shipping gateway, the changes are encapsulated in the dll that is updated in the website's /BIN directory. Make sure the website is set as the Startup Project. ###Simple Configurations For This Example Just adding a reference of the class library to the website skips several steps that you may want to go back and engineer to have a more durable project. The first is to wrap the addition of the class library (and any associated client-side files) into an Umbraco package. ###Client Library For the notification provider class library, you need 3 classes. [block:parameters] { "data": { "h-0": "Class", "h-1": "Inherits From", "h-2": "Purpose", "0-0": "NotificationEvent", "0-1": "Umbraco.Core\n.ApplicationEventHandler", "0-2": "Register event to listen for, pass new product info to monitor for string replacement - converting template into email", "1-0": "NotificationTripper", "2-0": "NotificationMonitor", "1-1": "Merchello.Core.Gateways\n.Notification.Triggering\n.NotificationTriggerBase", "2-1": "Merchello.Core.Gateways\n.Notification.Monitors\n.NotificationMonitorBase", "1-2": "registers trigger name and passes object from event to monitor", "2-2": "Manage the replacement pattern for email" }, "cols": 3, "rows": 3 } [/block] ###Event class Start building the class library by registering the event and passing an object through the event. In this example, I selected the Saving event on the ProductService. When the saving event is triggered, the new product's information is passed through. More than just new products can use the Saving event, so I use the HasProperty check to make sure I'm only firing off the notification trigger if the product does not have an existing identity. Notice the name "ProductAdd" of the trigger in this class is the same as the name in the class trigger class further down. **MerchelloEvents::ProductService_Saving** [block:code] { "codes": [ { "code": "namespace MerchelloNotificationExampleProvder.Events\n{\n using System;\n using System.Linq;\n\n using Merchello.Core;\n using Merchello.Core.Events;\n using Merchello.Core.Models;\n using Merchello.Core.Services;\n\n using Umbraco.Core;\n using Umbraco.Core.Events;\n using Umbraco.Core.Logging;\n\n public class MerchelloEvents : ApplicationEventHandler\n {\n protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\n {\n // register event\n ProductService.Saving += ProductService_Saving;\n }\n\n void ProductService_Saving(IProductService sender, SaveEventArgs<IProduct> e)\n {\n foreach (var product in e.SavedEntities)\n {\n // new products only\n if (!product.HasIdentity)\n {\n // trigger event, pass product\n Notification.Trigger(\"ProductAdd\", product);\n }\n }\n }\n }\n}", "language": "csharp", "name": "MerchelloEvents" } ] } [/block] Now that the event is wired up, we need something to do when it fires. ###Trigger class The trigger class's purpose is to be invoked by the invent and then notify the monitors. If you wanted to change this class for your own purposes, all you would need is a new class attribute decoration value for "TriggerFor" and a new object model to pass on such as IProduct. In this version of Merchello, the second parameter of contacts is not used since the email contacts are set in the message in the Back Office. You could have also chosen to pick an object that contains an email address or list, or you could use the contacts list passed through. **ProductAddTrigger class** [block:code] { "codes": [ { "code": "namespace MerchelloNotificationExampleProvder.NotificationProvider\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Threading.Tasks;\n\n using Merchello.Core.Gateways.Notification.Triggering;\n using Merchello.Core.Observation;\n using Merchello.Core.Models;\n\n [TriggerFor(\"ProductAdd\", Topic.Notifications)]\n public class ProductAddTrigger : NotificationTriggerBase<Merchello.Core.Models.IProduct, Merchello.Core.Models.IProduct>\n {\n protected override void Notify(Merchello.Core.Models.IProduct product, IEnumerable<string> contacts)\n {\n this.NotifyMonitors(product);\n }\n }\n}", "language": "csharp" } ] } [/block] ###Monitor class The real work is in the monitor class. This is where you replace strings in the email. The class decoration attribute contains a unique guid, the trigger class and the string that appears in the back office to create the message. Notice that the same IProduct is based from the event, through the trigger, and now to the monitor. The code below is cherry-picking which properties of IProduct I want to pass through to the email template. You can add all or just a few or create a link with an ID that goes back to the website with information. ProductAddMonitor [block:code] { "codes": [ { "code": "namespace MerchelloNotificationExampleProvder.NotificationProvider\n{\n using System.Collections.Generic;\n using System.Linq;\n using Merchello.Core.Formatters;\n using Merchello.Core.Gateways.Notification;\n using Merchello.Core.Gateways.Notification.Monitors;\n using Merchello.Core.Observation;\n using Merchello.Core.Models;\n\n [MonitorFor(\"B829266B-B585-4CA2-BCCB-4EBCEE045114\", typeof(ProductAddTrigger), \"Product Add Message (Pattern Replace)\")]\n public class ProductAddMonitor : NotificationMonitorBase<IProduct>\n {\n public ProductAddMonitor(INotificationContext notificationContext)\n : base(notificationContext)\n {\n }\n\n public override void OnNext(IProduct value)\n {\n if (!Messages.Any()) return;\n\n var patterns = new Dictionary<string, IReplaceablePattern>()\n {\n { \"Name\", new ReplaceablePattern(\"Name\", \"\", value.Name.ToString()) }, \n { \"TrackInventory\", new ReplaceablePattern(\"TrackInventory\", \"\", value.TrackInventory.ToString()) },\n { \"Barcode\", new ReplaceablePattern(\"Barcode\", \"\", value.Barcode) },\n { \"Sku\", new ReplaceablePattern(\"Sku\", \"\", value.Sku) },\n { \"Height\", new ReplaceablePattern(\"Height\", \"\", value.Height.ToString()) },\n { \"Length\", new ReplaceablePattern(\"Length\", \"\", value.Length.ToString()) },\n { \"Width\", new ReplaceablePattern(\"Width\", \"\", value.Width.ToString()) },\n { \"Weight\", new ReplaceablePattern(\"Weight\", \"\", value.Weight.ToString()) }\n };\n\n var formatter = new PatternReplaceFormatter(patterns);\n\n foreach (var message in Messages.ToArray())\n {\n // send the message\n NotificationContext.Send(message, formatter);\n }\n }\n }\n}", "language": "csharp" } ] } [/block] Now that the 3 classes are connected, build the class library, make sure the website is set as the start project and debug. ###Back Office Setup for Customer Notification Event Still in the Merchello back office, go to Settings/Notifications. Add a new notification and name it "New Product." This is a category name for all messages created under this category. Add a message and select the new event "Product Add Message," which was the name in the class attribute "MonitorFor." For the first message, name it "Sales - New Product," and save. Create a second new message and name it "Warehouse - New Product." [block:image] { "images": [ { "image": [ "https://files.readme.io/jLLXK4pfRD2TfD8tHKQM_notif-cust-bo-event.png", "notif-cust-bo-event.png", "1920", "1033", "#4ea34b", "" ] } ] } [/block] The only difference for these two messages is where it is going (the email address) and what it says (the template). The sales team probably doesn't need to know product measurements but the warehouse team definitely does need to know those to prepare a space in the warehouse. [block:image] { "images": [ { "image": [ "https://files.readme.io/QiJbWtumR5OZO0vfE56w_notif-cust-bo-mess-setting.png", "notif-cust-bo-mess-setting.png", "1920", "1031", "#8d706e", "" ] } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/T8KTu2tqSUH6oaGuv7Lm_notif-cust-bo-mess-template.png", "notif-cust-bo-mess-template.png", "1917", "1031", "#54a161", "" ] } ] } [/block] ###Ready to Test The custom notification is coded up the class library and built into the website via a reference. The notification gateway is enabled and a notification message has been built on that custom trigger event. Now we are ready to test. Create a New Product In the Merchello back office, in the catalog, create a new Product. Save the product. You just triggered the event and you should now have two emails. ###Local SMTP Server: SMTP4Dev While working on email notifications, I looked for a local smtp to install and test. I looked at several but wanted something that didn't let the emails leave my development machine. [I settled on SMTP4Dev](http://smtp4dev.codeplex.com/) which has both the source code and the install available from CodePlex. On my Windows 8.1 machine, it works well.
[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] Once you have activated a provider, you can now go and set up the provider. Click on the tab which is the type of provider you have activated. In our case, it was the SMTP provider which is of type 'Notification'. On the right you can see the link 'Add Notification'. Click the link and you'll see 'Email Notification', choose Add and give it a name (i.e. Order Notifications) and a description (Optional). [block:image] { "images": [ { "image": [ "https://files.readme.io/gec0qtpKQGyuKIZhbHPo_stageone.PNG", "stageone.PNG", "776", "65", "#bf884a", "" ] } ] } [/block] To configure the Order Confirmation, click on the + icon and you'll see some events we can hook into. We want the first one 'Order Confirmation Message (Pattern Replace)'. Add your Subject, From Email Address and (Optional) description. [block:image] { "images": [ { "image": [ "https://files.readme.io/sYCouAhWRHGbmQFr2Ngw_stagetwo.PNG", "stagetwo.PNG", "778", "185", "#5998d5", "" ] } ] } [/block] Lastly, let's configure the actual message the we'll send. Click on the edit/pencil icon next to your email address. And you'll get a tab with all the final options for this provider. Here you can choose to whom you send the order confirmation and the actual message. As this message is a 'Pattern Replace' we can pull out data from the order using a pattern like we use in AngularJs to display data i.e. {{BillToName}} or {{PaymentAmount}} A full list of the items we can use are listed in the Merchello.config and it's always best to check there for the most recent items. Below is a list at the time of writing this documentation. [block:code] { "codes": [ { "code": " <patternFormatter>\n\n <!-- patterns to search and replace can be \n \n <replace alias=\"Company\" pattern=\"{{Company}}\" replacement=\"Merchello\" replacementInMonitor=\"false\" />\n -->\n\n <!--\n Depending on the model passed to the \"Monitor\" responsible for populating the replacements, some of these values will be empty. For example,\n a MonitorModel that only contains shipment information will not be able to populate Billing information ...\n -->\n\n <!-- INVOICE -->\n <replace alias=\"InvoiceKey\" pattern=\"{{InvoiceKey}}\" />\n <replace alias=\"InvoiceNumber\" pattern=\"{{InvoiceNumber}}\" />\n <replace alias=\"InvoiceDate\" pattern=\"{{InvoiceDate}}\" />\n\n <replace alias=\"InvoiceStatus\" pattern=\"{{InvoiceStatus}}\" />\n <replace alias=\"TotalDiscountPrice\" pattern=\"{{TotalDiscountPrice}}\" />\n <replace alias=\"TotalShippingPrice\" pattern=\"{{TotalShippingPrice}}\" />\n <replace alias=\"TotalCustomPrice\" pattern=\"{{TotalCustomPrice}}\" />\n <replace alias=\"TotalTaxPrice\" pattern=\"{{TotalTaxPrice}}\" />\n <replace alias=\"TotalItemPrice\" pattern=\"{{TotalItemPrice}}\" />\n <replace alias=\"TotalItemPlusCustom\" pattern=\"{{TotalItemPlusCustom}}\" />\n <replace alias=\"TotalPrice\" pattern=\"{{TotalPrice}}\" />\n\n <!-- ADDRESS -->\n <replace alias=\"BillToName\" pattern=\"{{BillToName}}\" />\n <replace alias=\"BillToAddress1\" pattern=\"{{BillToAddress1}}\" />\n <replace alias=\"BillToAddress2\" pattern=\"{{BillToAddress2}}\" />\n <replace alias=\"BillToLocality\" pattern=\"{{BillToLocality}}\" />\n <replace alias=\"BillToRegion\" pattern=\"{{BillToRegion}}\" />\n <replace alias=\"BillToPostalCode\" pattern=\"{{BillToPostalCode}}\" />\n <replace alias=\"BillToCountryCode\" pattern=\"{{BillToCountryCode}}\" />\n <replace alias=\"BillToEmail\" pattern=\"{{BillToEmail}}\" />\n <replace alias=\"BillToPhone\" pattern=\"{{BillToPhone}}\" />\n <replace alias=\"BillToCompany\" pattern=\"{{BillToCompany}}\" />\n\n <replace alias=\"ShippedDate\" pattern=\"{{ShippedDate}}\" />\n <replace alias=\"ShipToAddress1\" pattern=\"{{ShipToAddress1}}\" />\n <replace alias=\"ShipToAddress2\" pattern=\"{{ShipToAddress2}}\" />\n <replace alias=\"ShipToLocality\" pattern=\"{{ShipToLocality}}\" />\n <replace alias=\"ShipToRegion\" pattern=\"{{ShipToRegion}}\" />\n <replace alias=\"ShipToPostalCode\" pattern=\"{{ShipToPostalCode}}\" /> \n <replace alias=\"ShipToCountryCode\" pattern=\"{{ShipToCountryCode}}\" />\n <replace alias=\"ShipToName\" pattern=\"{{ShipToName}}\" />\n <replace alias=\"ShipToEmail\" pattern=\"{{ShipToEmail}}\" />\n <replace alias=\"ShipToPhone\" pattern=\"{{ShipToPhone}}\" />\n <replace alias=\"ShipToOrganization\" pattern=\"{{ShipToOrganization}}\" />\n <replace alias=\"ShipToName\" pattern=\"{{ShipToName}}\" />\n <replace alias=\"TrackingCode\" pattern=\"{{TrackingCode}}\" />\n <replace alias=\"ShipMethodName\" pattern=\"{{ShipMethodName}}\" />\n <!-- ITERATING THROUGH LINE ITEMS -->\n\n\n <!-- LINE ITEMS\n these must be between the IterationStart[Invoice.Items] and IterationEnd[Invoice.Items] so they get repeated in the iteration -\n the pattern is then dynamically changed to\n \n Item.Sku.0 - Item.Name.0 - Item.Price.0 ...\n Item.Sku.1 - Item.Name.1 - Item.Price.1 ...\n Item.Sku.2 - Item.Name.2 - Item.Price.2 ...\n \n before the formatter performs it's replacements the message \n -->\n <replace alias=\"LineItemSku\" pattern=\"{{Item.Sku}}\" />\n <replace alias=\"LineItemName\" pattern=\"{{Item.Name}}\" />\n <replace alias=\"LineItemUnitPrice\" pattern=\"{{Item.UnitPrice}}\" />\n <replace alias=\"LineItemQuantity\" pattern=\"{{Item.Quantity}}\" />\n <replace alias=\"LineItemTotalPrice\" pattern=\"{{Item.TotalPrice}}\" />\n\n <!-- PAYMENT -->\n <replace alias=\"PaymentMethodName\" pattern=\"{{PaymentMethodName}}\" />\n <replace alias=\"PaymentAmount\" pattern=\"{{PaymentAmount}}\" />\n <replace alias=\"PamentReferenceNumber\" pattern=\"{{ReferenceNumber}}\" />\n\n </patternFormatter>", "language": "xml", "name": "Patterns" } ] } [/block] [block:api-header] { "type": "basic", "title": "How to create a Custom Notification Provider" } [/block] Merchello Notifications allow you to send email, twitter, or other information posts based on triggered events. An example of a notification is for a customer to receive an email confirming a placed order or processed credit card sale. While there are a few standard events (new order) and notifications (SMTP/email), Merchello allows you to build your own to fit your unique business needs. ###The Custom Notification Gateway In this example, I will build a custom SMTP/email-based notification that sends email when a new product is added to the catalog. The email is sent to both warehouse personnel and the sales team alerting them to the new product. This notification doesn't create new information but uses existing information (the new product) in Merchello to fulfill the notification event. ###Development Tasks The first task is create the class library for the sample notification gateway. Once the library is created and its gateway code is completed and built, the class library will be added to the website. ###Test Tasks: BackOffice The first test task is to prepare the Back office. Modify the Back office to activate the SMTP notification gateway, then add notification messages for the new event (new product) to both sales and warehouse personal. The email template will include replaceable strings with double curly brackets . When the new product event is triggered, the replaceable strings will be replaced with the properties of the new product. ###Test Tasks: Trip the Notification Event The next test task is to use the Back office - tripping the trigger to send the emails. Create a new Merchello product. Make sure to fill in the following properties when you create the product: Name Sku Barcode TrackInventory Height Length Width Weight These properties are used in the email template. These are not all the Product properties so more could have been added to the email because they are in the monitor replacement code. However, I choose not to include them. ###Considerations for your own Custom Notification In this example, I rely heavily on Merchello. The event is for new Merchello product created in the Back office and the notification information is from the new product object. This made the sample quick and easy. Your situation may be more complex with your own event and your own information. The trigger can be tripped at any time, and any object can be passed into the monitor. If you just need to send email in a random spot of the website, feel free to use whatever SMTP framework you already have in place. Merchello notifications don't need to be used in that situation, but they are an option -- albeit a more complicated one. ###Visual Studio Solution Organization For this example, you will want to create a Class Library project. The class library BIN directory will need to have all the Umbraco and Merchello dlls from the website. In the example code for this document, you will see a Visual Studio solution, with 2 projects. The first project is the class library. The second project is one of the sample Umbraco/Merchello websites. [block:image] { "images": [ { "image": [ "https://files.readme.io/gARHVSrdSVqtgW2bWuf5_notif-cust-vs-solution.png", "notif-cust-vs-solution.png", "417", "733", "#476daa", "" ] } ] } [/block] Add the class library as a reference to the website project. For this example, that is all you need to add the sample shipping gateway to the Merchello website. When you change and build the shipping gateway, the changes are encapsulated in the dll that is updated in the website's /BIN directory. Make sure the website is set as the Startup Project. ###Simple Configurations For This Example Just adding a reference of the class library to the website skips several steps that you may want to go back and engineer to have a more durable project. The first is to wrap the addition of the class library (and any associated client-side files) into an Umbraco package. ###Client Library For the notification provider class library, you need 3 classes. [block:parameters] { "data": { "h-0": "Class", "h-1": "Inherits From", "h-2": "Purpose", "0-0": "NotificationEvent", "0-1": "Umbraco.Core\n.ApplicationEventHandler", "0-2": "Register event to listen for, pass new product info to monitor for string replacement - converting template into email", "1-0": "NotificationTripper", "2-0": "NotificationMonitor", "1-1": "Merchello.Core.Gateways\n.Notification.Triggering\n.NotificationTriggerBase", "2-1": "Merchello.Core.Gateways\n.Notification.Monitors\n.NotificationMonitorBase", "1-2": "registers trigger name and passes object from event to monitor", "2-2": "Manage the replacement pattern for email" }, "cols": 3, "rows": 3 } [/block] ###Event class Start building the class library by registering the event and passing an object through the event. In this example, I selected the Saving event on the ProductService. When the saving event is triggered, the new product's information is passed through. More than just new products can use the Saving event, so I use the HasProperty check to make sure I'm only firing off the notification trigger if the product does not have an existing identity. Notice the name "ProductAdd" of the trigger in this class is the same as the name in the class trigger class further down. **MerchelloEvents::ProductService_Saving** [block:code] { "codes": [ { "code": "namespace MerchelloNotificationExampleProvder.Events\n{\n using System;\n using System.Linq;\n\n using Merchello.Core;\n using Merchello.Core.Events;\n using Merchello.Core.Models;\n using Merchello.Core.Services;\n\n using Umbraco.Core;\n using Umbraco.Core.Events;\n using Umbraco.Core.Logging;\n\n public class MerchelloEvents : ApplicationEventHandler\n {\n protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\n {\n // register event\n ProductService.Saving += ProductService_Saving;\n }\n\n void ProductService_Saving(IProductService sender, SaveEventArgs<IProduct> e)\n {\n foreach (var product in e.SavedEntities)\n {\n // new products only\n if (!product.HasIdentity)\n {\n // trigger event, pass product\n Notification.Trigger(\"ProductAdd\", product);\n }\n }\n }\n }\n}", "language": "csharp", "name": "MerchelloEvents" } ] } [/block] Now that the event is wired up, we need something to do when it fires. ###Trigger class The trigger class's purpose is to be invoked by the invent and then notify the monitors. If you wanted to change this class for your own purposes, all you would need is a new class attribute decoration value for "TriggerFor" and a new object model to pass on such as IProduct. In this version of Merchello, the second parameter of contacts is not used since the email contacts are set in the message in the Back Office. You could have also chosen to pick an object that contains an email address or list, or you could use the contacts list passed through. **ProductAddTrigger class** [block:code] { "codes": [ { "code": "namespace MerchelloNotificationExampleProvder.NotificationProvider\n{\n using System;\n using System.Collections.Generic;\n using System.Linq;\n using System.Text;\n using System.Threading.Tasks;\n\n using Merchello.Core.Gateways.Notification.Triggering;\n using Merchello.Core.Observation;\n using Merchello.Core.Models;\n\n [TriggerFor(\"ProductAdd\", Topic.Notifications)]\n public class ProductAddTrigger : NotificationTriggerBase<Merchello.Core.Models.IProduct, Merchello.Core.Models.IProduct>\n {\n protected override void Notify(Merchello.Core.Models.IProduct product, IEnumerable<string> contacts)\n {\n this.NotifyMonitors(product);\n }\n }\n}", "language": "csharp" } ] } [/block] ###Monitor class The real work is in the monitor class. This is where you replace strings in the email. The class decoration attribute contains a unique guid, the trigger class and the string that appears in the back office to create the message. Notice that the same IProduct is based from the event, through the trigger, and now to the monitor. The code below is cherry-picking which properties of IProduct I want to pass through to the email template. You can add all or just a few or create a link with an ID that goes back to the website with information. ProductAddMonitor [block:code] { "codes": [ { "code": "namespace MerchelloNotificationExampleProvder.NotificationProvider\n{\n using System.Collections.Generic;\n using System.Linq;\n using Merchello.Core.Formatters;\n using Merchello.Core.Gateways.Notification;\n using Merchello.Core.Gateways.Notification.Monitors;\n using Merchello.Core.Observation;\n using Merchello.Core.Models;\n\n [MonitorFor(\"B829266B-B585-4CA2-BCCB-4EBCEE045114\", typeof(ProductAddTrigger), \"Product Add Message (Pattern Replace)\")]\n public class ProductAddMonitor : NotificationMonitorBase<IProduct>\n {\n public ProductAddMonitor(INotificationContext notificationContext)\n : base(notificationContext)\n {\n }\n\n public override void OnNext(IProduct value)\n {\n if (!Messages.Any()) return;\n\n var patterns = new Dictionary<string, IReplaceablePattern>()\n {\n { \"Name\", new ReplaceablePattern(\"Name\", \"\", value.Name.ToString()) }, \n { \"TrackInventory\", new ReplaceablePattern(\"TrackInventory\", \"\", value.TrackInventory.ToString()) },\n { \"Barcode\", new ReplaceablePattern(\"Barcode\", \"\", value.Barcode) },\n { \"Sku\", new ReplaceablePattern(\"Sku\", \"\", value.Sku) },\n { \"Height\", new ReplaceablePattern(\"Height\", \"\", value.Height.ToString()) },\n { \"Length\", new ReplaceablePattern(\"Length\", \"\", value.Length.ToString()) },\n { \"Width\", new ReplaceablePattern(\"Width\", \"\", value.Width.ToString()) },\n { \"Weight\", new ReplaceablePattern(\"Weight\", \"\", value.Weight.ToString()) }\n };\n\n var formatter = new PatternReplaceFormatter(patterns);\n\n foreach (var message in Messages.ToArray())\n {\n // send the message\n NotificationContext.Send(message, formatter);\n }\n }\n }\n}", "language": "csharp" } ] } [/block] Now that the 3 classes are connected, build the class library, make sure the website is set as the start project and debug. ###Back Office Setup for Customer Notification Event Still in the Merchello back office, go to Settings/Notifications. Add a new notification and name it "New Product." This is a category name for all messages created under this category. Add a message and select the new event "Product Add Message," which was the name in the class attribute "MonitorFor." For the first message, name it "Sales - New Product," and save. Create a second new message and name it "Warehouse - New Product." [block:image] { "images": [ { "image": [ "https://files.readme.io/jLLXK4pfRD2TfD8tHKQM_notif-cust-bo-event.png", "notif-cust-bo-event.png", "1920", "1033", "#4ea34b", "" ] } ] } [/block] The only difference for these two messages is where it is going (the email address) and what it says (the template). The sales team probably doesn't need to know product measurements but the warehouse team definitely does need to know those to prepare a space in the warehouse. [block:image] { "images": [ { "image": [ "https://files.readme.io/QiJbWtumR5OZO0vfE56w_notif-cust-bo-mess-setting.png", "notif-cust-bo-mess-setting.png", "1920", "1031", "#8d706e", "" ] } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/T8KTu2tqSUH6oaGuv7Lm_notif-cust-bo-mess-template.png", "notif-cust-bo-mess-template.png", "1917", "1031", "#54a161", "" ] } ] } [/block] ###Ready to Test The custom notification is coded up the class library and built into the website via a reference. The notification gateway is enabled and a notification message has been built on that custom trigger event. Now we are ready to test. Create a New Product In the Merchello back office, in the catalog, create a new Product. Save the product. You just triggered the event and you should now have two emails. ###Local SMTP Server: SMTP4Dev While working on email notifications, I looked for a local smtp to install and test. I looked at several but wanted something that didn't let the emails leave my development machine. [I settled on SMTP4Dev](http://smtp4dev.codeplex.com/) which has both the source code and the install available from CodePlex. On my Windows 8.1 machine, it works well.
{"_id":"56b92b0708d8b20d00bc3b41","body":"As Merchello ships with the cash provider enabled by default. It's a very simple payment option with no configurable options.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Custom Payment Gateways\"\n}\n[/block]\nMerchello does have other Payment Gateways, which can be found in the Github Repo and this is also a great place to start when you are looking to create your own Custom Payment Gateway.\n\n[https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments)\n\n###Installing\n\nPayment gateways (And other gateways) are installed just like Standard Umbraco Packages.","user":"564136b9f424a10d001181e1","link_url":"","project":"56421bcdb48bdf19006a4c97","slug":"payments","type":"basic","version":"56b92afe08d8b20d00bc3afd","createdAt":"2015-11-10T20:24:25.064Z","excerpt":"Handles all necessary transaction processing for authorizing, capturing and refunding payments.","link_external":false,"order":19,"title":"Payments","updates":["580a05f5d40e880f00094578","5bb496fa370887000359fdca"],"__v":2,"githubsync":"","hidden":false,"isReference":false,"sync_unique":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"category":"56b92aff08d8b20d00bc3b05","next":{"pages":[]},"childrenPages":[]}

Payments

Handles all necessary transaction processing for authorizing, capturing and refunding payments.

As Merchello ships with the cash provider enabled by default. It's a very simple payment option with no configurable options. [block:api-header] { "type": "basic", "title": "Custom Payment Gateways" } [/block] Merchello does have other Payment Gateways, which can be found in the Github Repo and this is also a great place to start when you are looking to create your own Custom Payment Gateway. [https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments) ###Installing Payment gateways (And other gateways) are installed just like Standard Umbraco Packages.
As Merchello ships with the cash provider enabled by default. It's a very simple payment option with no configurable options. [block:api-header] { "type": "basic", "title": "Custom Payment Gateways" } [/block] Merchello does have other Payment Gateways, which can be found in the Github Repo and this is also a great place to start when you are looking to create your own Custom Payment Gateway. [https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Payments) ###Installing Payment gateways (And other gateways) are installed just like Standard Umbraco Packages.
{"_id":"56b92b0708d8b20d00bc3b42","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","createdAt":"2015-11-10T20:24:52.030Z","hidden":false,"link_url":"","title":"Shipping","__v":1,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":""},"githubsync":"","isReference":false,"type":"basic","version":"56b92afe08d8b20d00bc3afd","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Usage\"\n}\n[/block]\nThe Shipping page is where you manage your shipping providers. This allows you to have different providers based on shipment needs. You may have one provider for domestic packages, a different provider for foreign packages. You may have a third provider that handles bulk cargo.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Set the Warehouse Address and Name\"\n}\n[/block]\nA default Warehouse is created for you. However, its address is not filled in. In order for the shipping process to work, the Warehouse address must be entered.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/CveSyViStmXgaqkdCzWH_shipping-one.png\",\n        \"shipping-one.png\",\n        \"1600\",\n        \"724\",\n        \"#4ba36e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n###Verify Shipment Settings for Products\n\nShipment settings for products can either be set as a global setting in Merchello or as a setting on each product.\n\n###Shipping Rules\n\nShipping rules are arranged inside a catalog. On the Merchello/Settings/Shipping page, \"Select Catalog\" in the top right section of the page.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/lN0lVqYBTZ6ztuovdwDt_shipping-two.png\",\n        \"shipping-two.png\",\n        \"1920\",\n        \"906\",\n        \"#4ba36e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThen add the countries that this catalog can ship to.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4kjZjTubQLmslPmXvhmQ_shipping-three.png\",\n        \"shipping-three.png\",\n        \"1918\",\n        \"1030\",\n        \"#55a07d\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nFor each country, select a shipping provider. The shipping providers are listed on the Gateway Providers page in the Shipping Providers section.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/58GptX8R0ilt5ogkkv5R_shipping-four.png\",\n        \"shipping-four.png\",\n        \"1206\",\n        \"845\",\n        \"#aa605f\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYour shipping provider may need to set a range for the rule, such as a range of weight or a range of sizes. For example, the image below shows shipping to Argentina by price. The price range is from $1-$50 will cost $10 in shipping fees. Add the range and save the rate.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/XKzQ3JgeToKnwr0cSAxp_shipping-five.png\",\n        \"shipping-five.png\",\n        \"1203\",\n        \"845\",\n        \"#4fa452\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Creating A Custom Shipping Gateway\"\n}\n[/block]\nThe easiest place to start is looking at the custom shipping gateways that come in the Merchello source\n\n[https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Shipping](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Shipping)","category":"56b92aff08d8b20d00bc3b05","excerpt":"Handles all communication between Merchello and a specific shipping carrier to obtain shipping rate quotes. A level-based shipping gateway provider has already been included with the default Merchello install.","link_external":false,"order":20,"slug":"shipping","sync_unique":"","updates":["57c45a628588a30e00a99ddf"],"childrenPages":[]}

Shipping

Handles all communication between Merchello and a specific shipping carrier to obtain shipping rate quotes. A level-based shipping gateway provider has already been included with the default Merchello install.

[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] The Shipping page is where you manage your shipping providers. This allows you to have different providers based on shipment needs. You may have one provider for domestic packages, a different provider for foreign packages. You may have a third provider that handles bulk cargo. [block:api-header] { "type": "basic", "title": "Set the Warehouse Address and Name" } [/block] A default Warehouse is created for you. However, its address is not filled in. In order for the shipping process to work, the Warehouse address must be entered. [block:image] { "images": [ { "image": [ "https://files.readme.io/CveSyViStmXgaqkdCzWH_shipping-one.png", "shipping-one.png", "1600", "724", "#4ba36e", "" ] } ] } [/block] ###Verify Shipment Settings for Products Shipment settings for products can either be set as a global setting in Merchello or as a setting on each product. ###Shipping Rules Shipping rules are arranged inside a catalog. On the Merchello/Settings/Shipping page, "Select Catalog" in the top right section of the page. [block:image] { "images": [ { "image": [ "https://files.readme.io/lN0lVqYBTZ6ztuovdwDt_shipping-two.png", "shipping-two.png", "1920", "906", "#4ba36e", "" ] } ] } [/block] Then add the countries that this catalog can ship to. [block:image] { "images": [ { "image": [ "https://files.readme.io/4kjZjTubQLmslPmXvhmQ_shipping-three.png", "shipping-three.png", "1918", "1030", "#55a07d", "" ] } ] } [/block] For each country, select a shipping provider. The shipping providers are listed on the Gateway Providers page in the Shipping Providers section. [block:image] { "images": [ { "image": [ "https://files.readme.io/58GptX8R0ilt5ogkkv5R_shipping-four.png", "shipping-four.png", "1206", "845", "#aa605f", "" ] } ] } [/block] Your shipping provider may need to set a range for the rule, such as a range of weight or a range of sizes. For example, the image below shows shipping to Argentina by price. The price range is from $1-$50 will cost $10 in shipping fees. Add the range and save the rate. [block:image] { "images": [ { "image": [ "https://files.readme.io/XKzQ3JgeToKnwr0cSAxp_shipping-five.png", "shipping-five.png", "1203", "845", "#4fa452", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Creating A Custom Shipping Gateway" } [/block] The easiest place to start is looking at the custom shipping gateways that come in the Merchello source [https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Shipping](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Shipping)
[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] The Shipping page is where you manage your shipping providers. This allows you to have different providers based on shipment needs. You may have one provider for domestic packages, a different provider for foreign packages. You may have a third provider that handles bulk cargo. [block:api-header] { "type": "basic", "title": "Set the Warehouse Address and Name" } [/block] A default Warehouse is created for you. However, its address is not filled in. In order for the shipping process to work, the Warehouse address must be entered. [block:image] { "images": [ { "image": [ "https://files.readme.io/CveSyViStmXgaqkdCzWH_shipping-one.png", "shipping-one.png", "1600", "724", "#4ba36e", "" ] } ] } [/block] ###Verify Shipment Settings for Products Shipment settings for products can either be set as a global setting in Merchello or as a setting on each product. ###Shipping Rules Shipping rules are arranged inside a catalog. On the Merchello/Settings/Shipping page, "Select Catalog" in the top right section of the page. [block:image] { "images": [ { "image": [ "https://files.readme.io/lN0lVqYBTZ6ztuovdwDt_shipping-two.png", "shipping-two.png", "1920", "906", "#4ba36e", "" ] } ] } [/block] Then add the countries that this catalog can ship to. [block:image] { "images": [ { "image": [ "https://files.readme.io/4kjZjTubQLmslPmXvhmQ_shipping-three.png", "shipping-three.png", "1918", "1030", "#55a07d", "" ] } ] } [/block] For each country, select a shipping provider. The shipping providers are listed on the Gateway Providers page in the Shipping Providers section. [block:image] { "images": [ { "image": [ "https://files.readme.io/58GptX8R0ilt5ogkkv5R_shipping-four.png", "shipping-four.png", "1206", "845", "#aa605f", "" ] } ] } [/block] Your shipping provider may need to set a range for the rule, such as a range of weight or a range of sizes. For example, the image below shows shipping to Argentina by price. The price range is from $1-$50 will cost $10 in shipping fees. Add the range and save the rate. [block:image] { "images": [ { "image": [ "https://files.readme.io/XKzQ3JgeToKnwr0cSAxp_shipping-five.png", "shipping-five.png", "1203", "845", "#4fa452", "" ] } ] } [/block] [block:api-header] { "type": "basic", "title": "Creating A Custom Shipping Gateway" } [/block] The easiest place to start is looking at the custom shipping gateways that come in the Merchello source [https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Shipping](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Shipping)
{"_id":"56b92b0708d8b20d00bc3b43","project":"56421bcdb48bdf19006a4c97","createdAt":"2015-11-10T20:25:00.508Z","link_external":false,"slug":"taxation","title":"Taxation","version":"56b92afe08d8b20d00bc3afd","updates":[],"link_url":"","githubsync":"","sync_unique":"","excerpt":"Responsible for calculating the correct tax amount. A level-based tax gateway provider has already been included with the default Merchello install.","__v":0,"category":"56b92aff08d8b20d00bc3b05","user":"564136b9f424a10d001181e1","order":21,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Usage\"\n}\n[/block]\nThe Taxation page is where you manage your taxation providers. A flat-rate taxation provider package is installed along with the Merchello installation.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/3dN67H78R1OwiJW3aXSk_tax-one.png\",\n        \"tax-one.png\",\n        \"1920\",\n        \"1011\",\n        \"#50a352\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nBy default, \"Everywhere Else\" has a setting of \"Not Taxed.\" This allows you to only select those countries you shipping to. Make sure all countries you do ship to are set on the /Merchello/Settings/Shipping page.\n\nThen on the Taxation page, select the country, and select the taxation. For example, if you select \"Fixed Rate Tax Provider,\" a box will pop up allowing you to set the percent (%) of taxation to apply to that country.\n\nIf you have individual regions inside the country with different taxation percentages, select the pencil icon next to the country and set those region/rate values. Once the rates by region are saved, they are not displayed on the Taxation page. You must re-select the pencil icon in order to verify or change the rates.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4wwbM3WuQUCm6hifyEw2_tax-two.png\",\n        \"tax-two.png\",\n        \"1916\",\n        \"1032\",\n        \"#a65e52\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nThe next time a customer purchases a product (marked with \"This variant is taxable\") that will be shipped to that country, that taxation percentage will be applied to the purchase process.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Custom Taxation Gateway\"\n}\n[/block]\nHave a look at the examples in the Merchello source for how to implement your own custom Taxation Gateway\n\n[https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Taxation](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Taxation)","type":"basic","hidden":false,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"childrenPages":[]}

Taxation

Responsible for calculating the correct tax amount. A level-based tax gateway provider has already been included with the default Merchello install.

[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] The Taxation page is where you manage your taxation providers. A flat-rate taxation provider package is installed along with the Merchello installation. [block:image] { "images": [ { "image": [ "https://files.readme.io/3dN67H78R1OwiJW3aXSk_tax-one.png", "tax-one.png", "1920", "1011", "#50a352", "" ] } ] } [/block] By default, "Everywhere Else" has a setting of "Not Taxed." This allows you to only select those countries you shipping to. Make sure all countries you do ship to are set on the /Merchello/Settings/Shipping page. Then on the Taxation page, select the country, and select the taxation. For example, if you select "Fixed Rate Tax Provider," a box will pop up allowing you to set the percent (%) of taxation to apply to that country. If you have individual regions inside the country with different taxation percentages, select the pencil icon next to the country and set those region/rate values. Once the rates by region are saved, they are not displayed on the Taxation page. You must re-select the pencil icon in order to verify or change the rates. [block:image] { "images": [ { "image": [ "https://files.readme.io/4wwbM3WuQUCm6hifyEw2_tax-two.png", "tax-two.png", "1916", "1032", "#a65e52", "" ] } ] } [/block] The next time a customer purchases a product (marked with "This variant is taxable") that will be shipped to that country, that taxation percentage will be applied to the purchase process. [block:api-header] { "type": "basic", "title": "Custom Taxation Gateway" } [/block] Have a look at the examples in the Merchello source for how to implement your own custom Taxation Gateway [https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Taxation](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Taxation)
[block:api-header] { "type": "basic", "title": "Example Usage" } [/block] The Taxation page is where you manage your taxation providers. A flat-rate taxation provider package is installed along with the Merchello installation. [block:image] { "images": [ { "image": [ "https://files.readme.io/3dN67H78R1OwiJW3aXSk_tax-one.png", "tax-one.png", "1920", "1011", "#50a352", "" ] } ] } [/block] By default, "Everywhere Else" has a setting of "Not Taxed." This allows you to only select those countries you shipping to. Make sure all countries you do ship to are set on the /Merchello/Settings/Shipping page. Then on the Taxation page, select the country, and select the taxation. For example, if you select "Fixed Rate Tax Provider," a box will pop up allowing you to set the percent (%) of taxation to apply to that country. If you have individual regions inside the country with different taxation percentages, select the pencil icon next to the country and set those region/rate values. Once the rates by region are saved, they are not displayed on the Taxation page. You must re-select the pencil icon in order to verify or change the rates. [block:image] { "images": [ { "image": [ "https://files.readme.io/4wwbM3WuQUCm6hifyEw2_tax-two.png", "tax-two.png", "1916", "1032", "#a65e52", "" ] } ] } [/block] The next time a customer purchases a product (marked with "This variant is taxable") that will be shipped to that country, that taxation percentage will be applied to the purchase process. [block:api-header] { "type": "basic", "title": "Custom Taxation Gateway" } [/block] Have a look at the examples in the Merchello source for how to implement your own custom Taxation Gateway [https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Taxation](https://github.com/Merchello/Merchello/tree/merchello-dev/Plugin/Taxation)
{"_id":"56b92b0208d8b20d00bc3b1c","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","createdAt":"2015-11-13T18:55:52.876Z","link_external":false,"sync_unique":"","excerpt":"Documentation for MerchelloTemplatePage and MerchelloViewPage<T>","slug":"view-pages","category":"56b92aff08d8b20d00bc3b06","link_url":"","hidden":false,"body":"Merchello ships with a couple of base views that can be used to extend the standard Umbraco views which provides instantiated Merchello objects.\n\nEach view exposes Merchello's `CurrentCustomer` (ICustomerBase) and the `MerchelloHelper` as Merchello.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@inherits Merchello.Web.Mvc.MerchelloTemplatePage\",\n      \"language\": \"csharp\",\n      \"name\": \"MerchelloTemplatePage\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@inherits Merchello.Web.Mvc.MerchelloViewPage<TModel> \",\n      \"language\": \"csharp\",\n      \"name\": \"MerchelloViewPage{T}\"\n    }\n  ]\n}\n[/block]","type":"basic","api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"order":22,"title":"View Pages","__v":0,"githubsync":"","updates":[],"project":"56421bcdb48bdf19006a4c97","childrenPages":[]}

View Pages

Documentation for MerchelloTemplatePage and MerchelloViewPage<T>

Merchello ships with a couple of base views that can be used to extend the standard Umbraco views which provides instantiated Merchello objects. Each view exposes Merchello's `CurrentCustomer` (ICustomerBase) and the `MerchelloHelper` as Merchello. [block:code] { "codes": [ { "code": "@inherits Merchello.Web.Mvc.MerchelloTemplatePage", "language": "csharp", "name": "MerchelloTemplatePage" } ] } [/block] [block:code] { "codes": [ { "code": "@inherits Merchello.Web.Mvc.MerchelloViewPage<TModel> ", "language": "csharp", "name": "MerchelloViewPage{T}" } ] } [/block]
Merchello ships with a couple of base views that can be used to extend the standard Umbraco views which provides instantiated Merchello objects. Each view exposes Merchello's `CurrentCustomer` (ICustomerBase) and the `MerchelloHelper` as Merchello. [block:code] { "codes": [ { "code": "@inherits Merchello.Web.Mvc.MerchelloTemplatePage", "language": "csharp", "name": "MerchelloTemplatePage" } ] } [/block] [block:code] { "codes": [ { "code": "@inherits Merchello.Web.Mvc.MerchelloViewPage<TModel> ", "language": "csharp", "name": "MerchelloViewPage{T}" } ] } [/block]
{"_id":"56b92b0208d8b20d00bc3b1d","version":"56b92afe08d8b20d00bc3afd","link_external":false,"githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"order":23,"body":"Similar to the view pages, Merchello also ships with two controllers that extend two commonly used Umbraco abstract controllers (`SurfaceController` and  `RenderMvcController`).  The Merchello variations expose an instantiated customer, the Merchello Services and Gateways. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ICustomerContext CustomerContext\",\n    \"0-1\": \"Gets the customer context\",\n    \"1-0\": \"ICustomerBase CurrentCustomer\",\n    \"1-1\": \"Gets the current customer\",\n    \"2-0\": \"IBasket Basket\",\n    \"2-1\": \"Gets the current customer basket\",\n    \"3-0\": \"IServiceContext MerchelloServices\",\n    \"3-1\": \"Gets the Merchello ServiceContext\",\n    \"4-0\": \"IGatewayContext GatewayContext\",\n    \"4-1\": \"Gets the Merchello GatewayContext\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n/// A controller to render front-end requests for Merchello\\n/// </summary>\\npublic abstract class MerchelloRenderMvcController : RenderMvcController\",\n      \"language\": \"csharp\",\n      \"name\": \"MerchelloRenderMvcController\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n/// A <see cref=\\\"SurfaceController\\\"/> that Merchello presentation Add-in controllers should inherit from\\n/// </summary>\\npublic abstract class MerchelloSurfaceController : SurfaceController\",\n      \"language\": \"csharp\",\n      \"name\": \"MerchelloSurfaceController\"\n    }\n  ]\n}\n[/block]","excerpt":"Documentation for MerchelloSurfaceController and MerchelloRenderMvcController","category":"56b92aff08d8b20d00bc3b06","project":"56421bcdb48bdf19006a4c97","link_url":"","slug":"mvc-controllers","type":"basic","user":"564136b9f424a10d001181e1","updates":[],"createdAt":"2015-11-13T18:57:39.444Z","title":"MVC Controllers","__v":0,"childrenPages":[]}

MVC Controllers

Documentation for MerchelloSurfaceController and MerchelloRenderMvcController

Similar to the view pages, Merchello also ships with two controllers that extend two commonly used Umbraco abstract controllers (`SurfaceController` and `RenderMvcController`). The Merchello variations expose an instantiated customer, the Merchello Services and Gateways. [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ICustomerContext CustomerContext", "0-1": "Gets the customer context", "1-0": "ICustomerBase CurrentCustomer", "1-1": "Gets the current customer", "2-0": "IBasket Basket", "2-1": "Gets the current customer basket", "3-0": "IServiceContext MerchelloServices", "3-1": "Gets the Merchello ServiceContext", "4-0": "IGatewayContext GatewayContext", "4-1": "Gets the Merchello GatewayContext" }, "cols": 2, "rows": 5 } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// A controller to render front-end requests for Merchello\n/// </summary>\npublic abstract class MerchelloRenderMvcController : RenderMvcController", "language": "csharp", "name": "MerchelloRenderMvcController" } ] } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// A <see cref=\"SurfaceController\"/> that Merchello presentation Add-in controllers should inherit from\n/// </summary>\npublic abstract class MerchelloSurfaceController : SurfaceController", "language": "csharp", "name": "MerchelloSurfaceController" } ] } [/block]
Similar to the view pages, Merchello also ships with two controllers that extend two commonly used Umbraco abstract controllers (`SurfaceController` and `RenderMvcController`). The Merchello variations expose an instantiated customer, the Merchello Services and Gateways. [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ICustomerContext CustomerContext", "0-1": "Gets the customer context", "1-0": "ICustomerBase CurrentCustomer", "1-1": "Gets the current customer", "2-0": "IBasket Basket", "2-1": "Gets the current customer basket", "3-0": "IServiceContext MerchelloServices", "3-1": "Gets the Merchello ServiceContext", "4-0": "IGatewayContext GatewayContext", "4-1": "Gets the Merchello GatewayContext" }, "cols": 2, "rows": 5 } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// A controller to render front-end requests for Merchello\n/// </summary>\npublic abstract class MerchelloRenderMvcController : RenderMvcController", "language": "csharp", "name": "MerchelloRenderMvcController" } ] } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// A <see cref=\"SurfaceController\"/> that Merchello presentation Add-in controllers should inherit from\n/// </summary>\npublic abstract class MerchelloSurfaceController : SurfaceController", "language": "csharp", "name": "MerchelloSurfaceController" } ] } [/block]
{"_id":"56b92b0208d8b20d00bc3b1e","sync_unique":"","excerpt":"","slug":"virtual-product-content-iproductcontent","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","link_external":false,"link_url":"","order":24,"title":"Virtual Product Content (IProductContent)","createdAt":"2015-11-13T21:54:47.247Z","githubsync":"","body":"In early versions of Merchello, in order to render products, it was required to make an association with an Umbraco content node so that additional properties such as images and descriptions could be added.  Merchello version 1.12.x introduced `IProductContent` which itself implements Umbraco's `IPublishedContent`.\n\nMerchello versions 1.12.x and later allow for a back office editor to extend Merchello products directly be associating Umbraco document types by creating a [Product Content Type](doc:product-content-types)  reference.  Extended properties can then be edited through Merchello's product editor directly.\n\nA slug is also generated for the product.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/I6Rdy6O9QvqfzjrROfH2_product-slug.png\",\n        \"product-slug.png\",\n        \"1404\",\n        \"678\",\n        \"#4a648a\",\n        \"\"\n      ],\n      \"sizing\": \"full\",\n      \"caption\": \"Product slugs can be edited through the product Extended Content - Render Tab.\"\n    }\n  ]\n}\n[/block]\nAt this point, the product can be rendered as **virtual content** (meaning they do not require an Umbraco content node to be created in the content section).  This is accomplished by using an [Umbraco Content Finder](https://our.umbraco.org/documentation/Reference/Routing/Request-Pipeline/IContentFinder) by the product slug.\n\nBy default, the URL for the **IProductContent** will be /[product-slug]\n\nVarious cultures can be configured in the Merchello.config file.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<contentFinderCulture>\\n    <!-- You can set slug prefixes for products for each culture if you need to.\\n    e.g. with the following settings, en-US product URLs will be /en/[slug]\\n    <route cultureName=\\\"en-US\\\" productSlugPrefix=\\\"en\\\" />\\n    -->\\n</contentFinderCulture>\",\n      \"language\": \"xml\",\n      \"name\": \"Product Content Culture\"\n    }\n  ]\n}\n[/block]\nIn implementations, where more complicated URLs are desired, developers can write their own content finder and use the [MerchelloHelper](doc:merchellohelper)  to find the `TypedProductContent`.","type":"basic","__v":0,"category":"56b92aff08d8b20d00bc3b06","updates":[],"hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"childrenPages":[]}

Virtual Product Content (IProductContent)


In early versions of Merchello, in order to render products, it was required to make an association with an Umbraco content node so that additional properties such as images and descriptions could be added. Merchello version 1.12.x introduced `IProductContent` which itself implements Umbraco's `IPublishedContent`. Merchello versions 1.12.x and later allow for a back office editor to extend Merchello products directly be associating Umbraco document types by creating a [Product Content Type](doc:product-content-types) reference. Extended properties can then be edited through Merchello's product editor directly. A slug is also generated for the product. [block:image] { "images": [ { "image": [ "https://files.readme.io/I6Rdy6O9QvqfzjrROfH2_product-slug.png", "product-slug.png", "1404", "678", "#4a648a", "" ], "sizing": "full", "caption": "Product slugs can be edited through the product Extended Content - Render Tab." } ] } [/block] At this point, the product can be rendered as **virtual content** (meaning they do not require an Umbraco content node to be created in the content section). This is accomplished by using an [Umbraco Content Finder](https://our.umbraco.org/documentation/Reference/Routing/Request-Pipeline/IContentFinder) by the product slug. By default, the URL for the **IProductContent** will be /[product-slug] Various cultures can be configured in the Merchello.config file. [block:code] { "codes": [ { "code": "<contentFinderCulture>\n <!-- You can set slug prefixes for products for each culture if you need to.\n e.g. with the following settings, en-US product URLs will be /en/[slug]\n <route cultureName=\"en-US\" productSlugPrefix=\"en\" />\n -->\n</contentFinderCulture>", "language": "xml", "name": "Product Content Culture" } ] } [/block] In implementations, where more complicated URLs are desired, developers can write their own content finder and use the [MerchelloHelper](doc:merchellohelper) to find the `TypedProductContent`.
In early versions of Merchello, in order to render products, it was required to make an association with an Umbraco content node so that additional properties such as images and descriptions could be added. Merchello version 1.12.x introduced `IProductContent` which itself implements Umbraco's `IPublishedContent`. Merchello versions 1.12.x and later allow for a back office editor to extend Merchello products directly be associating Umbraco document types by creating a [Product Content Type](doc:product-content-types) reference. Extended properties can then be edited through Merchello's product editor directly. A slug is also generated for the product. [block:image] { "images": [ { "image": [ "https://files.readme.io/I6Rdy6O9QvqfzjrROfH2_product-slug.png", "product-slug.png", "1404", "678", "#4a648a", "" ], "sizing": "full", "caption": "Product slugs can be edited through the product Extended Content - Render Tab." } ] } [/block] At this point, the product can be rendered as **virtual content** (meaning they do not require an Umbraco content node to be created in the content section). This is accomplished by using an [Umbraco Content Finder](https://our.umbraco.org/documentation/Reference/Routing/Request-Pipeline/IContentFinder) by the product slug. By default, the URL for the **IProductContent** will be /[product-slug] Various cultures can be configured in the Merchello.config file. [block:code] { "codes": [ { "code": "<contentFinderCulture>\n <!-- You can set slug prefixes for products for each culture if you need to.\n e.g. with the following settings, en-US product URLs will be /en/[slug]\n <route cultureName=\"en-US\" productSlugPrefix=\"en\" />\n -->\n</contentFinderCulture>", "language": "xml", "name": "Product Content Culture" } ] } [/block] In implementations, where more complicated URLs are desired, developers can write their own content finder and use the [MerchelloHelper](doc:merchellohelper) to find the `TypedProductContent`.
{"_id":"56b92b0308d8b20d00bc3b1f","link_external":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"Documentation for Merch's CustomerContext","type":"basic","user":"564136b9f424a10d001181e1","createdAt":"2015-11-10T20:15:13.753Z","githubsync":"","sync_unique":"","category":"56b92aff08d8b20d00bc3b07","link_url":"","hidden":false,"title":"CustomerContext","__v":1,"project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","updates":["5ad4a7dd306e5b0003d83a9f"],"order":25,"body":"Merch's CustomerContext is responsible for keeping track website user's with respect to the what Merch views as the customer state.  Customers will either be anonymous customers or customers depending on whether or not they have authenticated (logged in).\n\nThe default `CustomerContext` uses Umbraco's membership to determine whether or not a customer is an anonymous or known customer by first determining if the website user has authenticated and, if true, then asserts that Umbraco member type of the logged in member is listed in the allowed member types configured in the **merchello.config** file.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- A comma delimited list of Umbraco MemberTypes to be considered as Merchello Customers -->\\n<customer memberTypes=\\\"Customer,MerchelloCustomer\\\" />\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\"\n}\n[/block]\nThe CustomerContext accepts the current [UmbracoContext](https://our.umbraco.org/documentation/Reference/) which it uses to get information about the current HTTP request and current user. \n\nThe default `CustomerContext` can be instantiated simply as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var customerContext = new CustomerContext(UmbracoContext);\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nThe more formal way is to use the PluggableObjectHelper to instantiate the type value configured in the merchello.config.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var customerContext = PluggableObjectHelper.GetInstance<CustomerContextBase>(\\\"CustomerContext\\\", UmbracoContext);   \",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- Merchello.config element -->  \\n<pluggable>\\n    <object alias=\\\"CustomerContext\\\" type=\\\"Merchello.Web.CustomerContext, Merchello.Web\\\" />\\n</pluggable>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Accessing the CurrentCustomer\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// Access the customer's basket\\n\\nvar currentCustomer = CustomerContext.CurrentCustomer;\\n\\nvar basket = currentCustomer.Basket();\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// customer is ICustomerBase\\nvar currentCustomer = CustomerContext.CurrentCustomer;\\n\\n// check if the customer is anonymous\\nif (!currentCustomer.IsAnonymous) \\n{\\n  var customer = (ICustomer)currentCustomer;\\n}\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"SetValue(string, string)\",\n    \"0-1\": \"Stores a string value with key in the \\\"Merchello\\\" cookie.\",\n    \"1-0\": \"GetValue(string)\",\n    \"1-1\": \"Gets a value stored in the \\\"Merchello\\\" cookie.\",\n    \"2-0\": \"Reinitialize()\",\n    \"2-1\": \"Forces the CustomerContext to setup again.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Storing values in the Merchello cookie\",\n  \"body\": \"Remember to keep in mind that values stored in the Merchello cookie should be relatively small as the maximum size of *ALL* cookies should not exceed *4093 bytes*.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"The Merchello Cookie\"\n}\n[/block]\nThe CustomerContext persists values in the \"merchello\" cookie. \n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The value of the cookie is encrypted using Umbraco's `EncryptWithMachineKey()' string extension.  Sites running on server farms should include a machineKey element in the web.config.\",\n  \"title\": \"Cookie encryption\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Custom CustomerContext\"\n}\n[/block]\nIn cases where there is the need to use a user provider other than the Umbraco Membership provider, the `CustomerContext` can be overridden by creating a custom CustomerContext class inheriting from `Merchello.Web.Pluggable.CustomerContextBase`.\n\nIn the customer class, three methods need to be defined.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n/// Returns true or false indicating whether or not the current membership user is logged in.\\n/// </summary>\\n/// <returns>\\n/// The <see cref=\\\"bool\\\"/> indicating whether the current user is logged in.\\n/// </returns>\\nprotected abstract bool GetIsCurrentlyLoggedIn();\\n\\n/// <summary>\\n/// Gets the member/user login or user name used to sign in\\n/// </summary>\\n/// <returns>\\n/// The <see cref=\\\"string\\\"/>.\\n/// </returns>\\n/// <remarks>\\n/// Merchello makes the association between membership provider users and Merchello customers by username\\n/// </remarks>\\nprotected abstract string GetMembershipProviderUserName();\\n\\n/// <summary>\\n/// Gets the unique ID from the Membership Provider\\n/// </summary>\\n/// <returns>\\n/// The ID or key from the Membership provider as a string value \\n/// </returns>\\nprotected abstract string GetMembershipProviderKey();\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nFinally, the merchello.config needs to be updated to reflect the new class reference.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<!-- Merchello.config element -->  \\n<pluggable>\\n    <object alias=\\\"CustomerContext\\\" type=\\\"[YOUR.TYPE.FULLNAME], [YOUR.Library]\\\" />\\n</pluggable>\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","slug":"customercontext","isReference":false,"next":{"pages":[]},"childrenPages":[]}

CustomerContext

Documentation for Merch's CustomerContext

Merch's CustomerContext is responsible for keeping track website user's with respect to the what Merch views as the customer state. Customers will either be anonymous customers or customers depending on whether or not they have authenticated (logged in). The default `CustomerContext` uses Umbraco's membership to determine whether or not a customer is an anonymous or known customer by first determining if the website user has authenticated and, if true, then asserts that Umbraco member type of the logged in member is listed in the allowed member types configured in the **merchello.config** file. [block:code] { "codes": [ { "code": "<!-- A comma delimited list of Umbraco MemberTypes to be considered as Merchello Customers -->\n<customer memberTypes=\"Customer,MerchelloCustomer\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Instantiating" } [/block] The CustomerContext accepts the current [UmbracoContext](https://our.umbraco.org/documentation/Reference/) which it uses to get information about the current HTTP request and current user. The default `CustomerContext` can be instantiated simply as follows: [block:code] { "codes": [ { "code": "var customerContext = new CustomerContext(UmbracoContext);", "language": "csharp" } ] } [/block] The more formal way is to use the PluggableObjectHelper to instantiate the type value configured in the merchello.config. [block:code] { "codes": [ { "code": "var customerContext = PluggableObjectHelper.GetInstance<CustomerContextBase>(\"CustomerContext\", UmbracoContext); ", "language": "csharp" } ] } [/block] [block:code] { "codes": [ { "code": "<!-- Merchello.config element --> \n<pluggable>\n <object alias=\"CustomerContext\" type=\"Merchello.Web.CustomerContext, Merchello.Web\" />\n</pluggable>", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Accessing the CurrentCustomer", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "// Access the customer's basket\n\nvar currentCustomer = CustomerContext.CurrentCustomer;\n\nvar basket = currentCustomer.Basket();", "language": "csharp" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "// customer is ICustomerBase\nvar currentCustomer = CustomerContext.CurrentCustomer;\n\n// check if the customer is anonymous\nif (!currentCustomer.IsAnonymous) \n{\n var customer = (ICustomer)currentCustomer;\n}", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "SetValue(string, string)", "0-1": "Stores a string value with key in the \"Merchello\" cookie.", "1-0": "GetValue(string)", "1-1": "Gets a value stored in the \"Merchello\" cookie.", "2-0": "Reinitialize()", "2-1": "Forces the CustomerContext to setup again." }, "cols": 2, "rows": 3 } [/block] [block:callout] { "type": "warning", "title": "Storing values in the Merchello cookie", "body": "Remember to keep in mind that values stored in the Merchello cookie should be relatively small as the maximum size of *ALL* cookies should not exceed *4093 bytes*." } [/block] [block:api-header] { "type": "basic", "title": "The Merchello Cookie" } [/block] The CustomerContext persists values in the "merchello" cookie. [block:callout] { "type": "info", "body": "The value of the cookie is encrypted using Umbraco's `EncryptWithMachineKey()' string extension. Sites running on server farms should include a machineKey element in the web.config.", "title": "Cookie encryption" } [/block] [block:api-header] { "type": "basic", "title": "Custom CustomerContext" } [/block] In cases where there is the need to use a user provider other than the Umbraco Membership provider, the `CustomerContext` can be overridden by creating a custom CustomerContext class inheriting from `Merchello.Web.Pluggable.CustomerContextBase`. In the customer class, three methods need to be defined. [block:code] { "codes": [ { "code": "/// <summary>\n/// Returns true or false indicating whether or not the current membership user is logged in.\n/// </summary>\n/// <returns>\n/// The <see cref=\"bool\"/> indicating whether the current user is logged in.\n/// </returns>\nprotected abstract bool GetIsCurrentlyLoggedIn();\n\n/// <summary>\n/// Gets the member/user login or user name used to sign in\n/// </summary>\n/// <returns>\n/// The <see cref=\"string\"/>.\n/// </returns>\n/// <remarks>\n/// Merchello makes the association between membership provider users and Merchello customers by username\n/// </remarks>\nprotected abstract string GetMembershipProviderUserName();\n\n/// <summary>\n/// Gets the unique ID from the Membership Provider\n/// </summary>\n/// <returns>\n/// The ID or key from the Membership provider as a string value \n/// </returns>\nprotected abstract string GetMembershipProviderKey();", "language": "csharp" } ] } [/block] Finally, the merchello.config needs to be updated to reflect the new class reference. [block:code] { "codes": [ { "code": "<!-- Merchello.config element --> \n<pluggable>\n <object alias=\"CustomerContext\" type=\"[YOUR.TYPE.FULLNAME], [YOUR.Library]\" />\n</pluggable>", "language": "text" } ] } [/block]
Merch's CustomerContext is responsible for keeping track website user's with respect to the what Merch views as the customer state. Customers will either be anonymous customers or customers depending on whether or not they have authenticated (logged in). The default `CustomerContext` uses Umbraco's membership to determine whether or not a customer is an anonymous or known customer by first determining if the website user has authenticated and, if true, then asserts that Umbraco member type of the logged in member is listed in the allowed member types configured in the **merchello.config** file. [block:code] { "codes": [ { "code": "<!-- A comma delimited list of Umbraco MemberTypes to be considered as Merchello Customers -->\n<customer memberTypes=\"Customer,MerchelloCustomer\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Instantiating" } [/block] The CustomerContext accepts the current [UmbracoContext](https://our.umbraco.org/documentation/Reference/) which it uses to get information about the current HTTP request and current user. The default `CustomerContext` can be instantiated simply as follows: [block:code] { "codes": [ { "code": "var customerContext = new CustomerContext(UmbracoContext);", "language": "csharp" } ] } [/block] The more formal way is to use the PluggableObjectHelper to instantiate the type value configured in the merchello.config. [block:code] { "codes": [ { "code": "var customerContext = PluggableObjectHelper.GetInstance<CustomerContextBase>(\"CustomerContext\", UmbracoContext); ", "language": "csharp" } ] } [/block] [block:code] { "codes": [ { "code": "<!-- Merchello.config element --> \n<pluggable>\n <object alias=\"CustomerContext\" type=\"Merchello.Web.CustomerContext, Merchello.Web\" />\n</pluggable>", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "Accessing the CurrentCustomer", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "// Access the customer's basket\n\nvar currentCustomer = CustomerContext.CurrentCustomer;\n\nvar basket = currentCustomer.Basket();", "language": "csharp" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "// customer is ICustomerBase\nvar currentCustomer = CustomerContext.CurrentCustomer;\n\n// check if the customer is anonymous\nif (!currentCustomer.IsAnonymous) \n{\n var customer = (ICustomer)currentCustomer;\n}", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "SetValue(string, string)", "0-1": "Stores a string value with key in the \"Merchello\" cookie.", "1-0": "GetValue(string)", "1-1": "Gets a value stored in the \"Merchello\" cookie.", "2-0": "Reinitialize()", "2-1": "Forces the CustomerContext to setup again." }, "cols": 2, "rows": 3 } [/block] [block:callout] { "type": "warning", "title": "Storing values in the Merchello cookie", "body": "Remember to keep in mind that values stored in the Merchello cookie should be relatively small as the maximum size of *ALL* cookies should not exceed *4093 bytes*." } [/block] [block:api-header] { "type": "basic", "title": "The Merchello Cookie" } [/block] The CustomerContext persists values in the "merchello" cookie. [block:callout] { "type": "info", "body": "The value of the cookie is encrypted using Umbraco's `EncryptWithMachineKey()' string extension. Sites running on server farms should include a machineKey element in the web.config.", "title": "Cookie encryption" } [/block] [block:api-header] { "type": "basic", "title": "Custom CustomerContext" } [/block] In cases where there is the need to use a user provider other than the Umbraco Membership provider, the `CustomerContext` can be overridden by creating a custom CustomerContext class inheriting from `Merchello.Web.Pluggable.CustomerContextBase`. In the customer class, three methods need to be defined. [block:code] { "codes": [ { "code": "/// <summary>\n/// Returns true or false indicating whether or not the current membership user is logged in.\n/// </summary>\n/// <returns>\n/// The <see cref=\"bool\"/> indicating whether the current user is logged in.\n/// </returns>\nprotected abstract bool GetIsCurrentlyLoggedIn();\n\n/// <summary>\n/// Gets the member/user login or user name used to sign in\n/// </summary>\n/// <returns>\n/// The <see cref=\"string\"/>.\n/// </returns>\n/// <remarks>\n/// Merchello makes the association between membership provider users and Merchello customers by username\n/// </remarks>\nprotected abstract string GetMembershipProviderUserName();\n\n/// <summary>\n/// Gets the unique ID from the Membership Provider\n/// </summary>\n/// <returns>\n/// The ID or key from the Membership provider as a string value \n/// </returns>\nprotected abstract string GetMembershipProviderKey();", "language": "csharp" } ] } [/block] Finally, the merchello.config needs to be updated to reflect the new class reference. [block:code] { "codes": [ { "code": "<!-- Merchello.config element --> \n<pluggable>\n <object alias=\"CustomerContext\" type=\"[YOUR.TYPE.FULLNAME], [YOUR.Library]\" />\n</pluggable>", "language": "text" } ] } [/block]
{"_id":"56b92b0308d8b20d00bc3b20","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"order":26,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"CustomerItemCacheBase classes\",\n  \"body\": \"Basket, WishList\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Accessing a customer basket\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The basket is accessed through an extension method off of the `CurrentCustomer` property of the [CustomerContext](doc:customercontext).\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var basket = CustomerContext.CurrentCustomer.Basket();\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"decimal TotalBasketPrice\",\n    \"0-1\": \"Gets the sum of all basket item \\\"amount\\\" multiplied by quantity (price)\",\n    \"1-0\": \"bool EnableDataModifiers\",\n    \"1-1\": \"Gets or sets a value indicating whether enable data modifiers.\",\n    \"2-0\": \"Guid VersionKey\",\n    \"2-1\": \"Read only - Gets the item caches version key\",\n    \"3-0\": \"ICustomerBase Customer\",\n    \"3-1\": \"Read only - Gets the customer associated with the item cache\",\n    \"4-0\": \"LineItemCollection Items\",\n    \"4-1\": \"Read only - Gets the item cache line items\",\n    \"5-0\": \"int TotalItemCount\",\n    \"5-1\": \"Read only - Gets the item cache's item count\",\n    \"6-0\": \"int TotalQuantityCount\",\n    \"6-1\": \"Read only - Gets the sum of all item cache item quantities\",\n    \"7-0\": \"decimal TotalItemCachePrice\",\n    \"7-1\": \"Read only - Gets the sum of all item cache item \\\"amount\\\" multiplied by quantity (price)\",\n    \"8-0\": \"bool IsEmpty\",\n    \"8-1\": \"Read only - Gets a value indicating whether or not the item cache contains any items\"\n  },\n  \"cols\": 2,\n  \"rows\": 9\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"void AddItem(IProduct product)\",\n    \"0-1\": \"Adds a IProduct to the item cache\",\n    \"1-0\": \"void AddItem(IProduct product, int quantity)\",\n    \"1-1\": \"Adds a IProduct to the item cache\",\n    \"2-0\": \"void AddItem(IProduct product, string name, int quantity)\",\n    \"3-0\": \"void AddItem(IProduct product, string name, int quantity, ExtendedDataCollection extendedData)\",\n    \"4-0\": \"void AddItem(ProductDisplay product)\",\n    \"5-0\": \"void AddItem(ProductDisplay product, int quantity)\",\n    \"6-0\": \"void AddItem(ProductDisplay product, string name, int quantity)\",\n    \"7-0\": \"void AddItem(ProductDisplay product, string name, int quantity, ExtendedDataCollection extendedData)\",\n    \"8-0\": \"void AddItem(IProductVariant productVariant)\",\n    \"9-0\": \"void AddItem(IProductVariant productVariant, int quantity)\",\n    \"10-0\": \"void AddItem(IProductVariant productVariant, string name, int quantity)\",\n    \"11-0\": \"void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)\",\n    \"12-0\": \"void AddItem(ProductVariantDisplay productVariant)\",\n    \"13-0\": \"void AddItem(ProductVariantDisplay productVariant, int quantity)\",\n    \"14-0\": \"void AddItem(ProductVariantDisplay productVariant, string name, int quantity)\",\n    \"15-0\": \"void AddItem(ProductVariantDisplay productVariant, string name, int quantity, ExtendedDataCollection extendedData)\",\n    \"16-0\": \"void AddItem(string name, string sku, decimal price)\",\n    \"17-0\": \"void AddItem(string name, string sku, int quantity, decimal price)\",\n    \"18-0\": \"void AddItem(string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData)\",\n    \"19-0\": \"void AddItem(IItemCacheLineItem lineItem)\",\n    \"20-0\": \"void UpdateQuantity(Guid key, int quantity)\",\n    \"21-0\": \"void UpdateQuantity(string sku, int quantity)\",\n    \"22-0\": \"void UpdateQuantity(IProductVariant productVariant, int quantity)\",\n    \"23-0\": \"void RemoveItem(Guid itemKey)\",\n    \"24-0\": \"void RemoveItem(string sku)\",\n    \"25-0\": \"void RemoveItem(IProductVariant productVariant)\",\n    \"26-0\": \"void Empty()\",\n    \"27-0\": \"void Refresh()\",\n    \"28-0\": \"bool Validate()\",\n    \"29-0\": \"void Accept(ILineItemVisitor visitor)\",\n    \"29-1\": \"Accepts visitor class to visit item cache items\",\n    \"28-1\": \"Validates values stored in the internal item cache to make certain items being purchase\\nreflect most recent values in the back office.\",\n    \"27-1\": \"Refreshes cache with database values\",\n    \"26-1\": \"Empties the item cache\",\n    \"25-1\": \"Removes a product variant from the item cache\",\n    \"24-1\": \"Removes a product variant from the item cache\",\n    \"23-1\": \"Removes a product variant from the item cache\",\n    \"22-1\": \"Updates the quantity of an item in the item cache\",\n    \"21-1\": \"Updates the quantity of an item in the item cache\",\n    \"20-1\": \"Updates the quantity of an item in the item cache\",\n    \"2-1\": \"Adds a IProduct to the item cache\",\n    \"3-1\": \"Adds a IProduct to the item cache\",\n    \"4-1\": \"Adds a ProductDisplay to the item cache\",\n    \"5-1\": \"Adds a ProductDisplay to the item cache\",\n    \"6-1\": \"Adds a ProductDisplay to the item cache\",\n    \"7-1\": \"Adds a ProductDisplay to the item cache\",\n    \"8-1\": \"Adds a IProductVariant to the item cache\",\n    \"9-1\": \"Adds a IProductVariant to the item cache\",\n    \"10-1\": \"Adds a IProduct to the item cache\",\n    \"11-1\": \"Adds a IProductVariant to the item cache\",\n    \"12-1\": \"Adds a IProductVariant to the item cache\",\n    \"13-1\": \"Adds a ProductVariantDisplay to the item cache\",\n    \"14-1\": \"Adds a ProductVariantDisplay to the item cache\",\n    \"15-1\": \"Adds a ProductVariantDisplay to the item cache\",\n    \"16-1\": \"Adds a item to the item cache\",\n    \"17-1\": \"Adds a item to the item cache\",\n    \"18-1\": \"Adds a item to the item cache\",\n    \"19-1\": \"Adds a item to the item cache\"\n  },\n  \"cols\": 2,\n  \"rows\": 30\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Examples - Adding an Item to the Basket\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n    /// Simple Model for the Add To Cart form.\\n    /// </summary>\\n    public partial class AddItemModel\\n    {\\n        /// <summary>\\n        /// Gets or sets the Content Id of the ProductDetail page\\n        /// </summary>\\n        public int ContentId { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the basket page id.\\n        /// </summary>\\n        public int BasketPageId { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the wish list page id.\\n        /// </summary>\\n        public int WishListPageId { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the product.\\n        /// </summary>\\n        public ProductDisplay Product { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the option choices (if there are any), used to determine the variant \\n        /// </summary>\\n        public Guid[] OptionChoices { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether show wish list.\\n        /// </summary>\\n        public bool ShowWishList { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the currency.\\n        /// </summary>\\n        public ICurrency Currency { get; set; }\\n    }\",\n      \"language\": \"csharp\",\n      \"name\": \"AddItemModel\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[HttpPost]\\npublic ActionResult AddToBasket(AddItemModel model)\\n{\\n\\n\\n  // We've added some data modifiers that can handle such things as including taxes in product\\n  // pricing.  The data modifiers can either get executed when the item is added to the basket or\\n  // as a result from a MerchelloHelper query - you just don't want them to execute twice.\\n\\n  var merchello = new MerchelloHelper(false);\\n\\n  var product = merchello.Query.Product.GetByKey(model.Product.Key);\\n\\n  // In the event the product has options we want to add the \\\"variant\\\" to the basket.\\n  // -- If a product that has variants is defined, the FIRST variant will be added to the cart. \\n  // -- This was done so that we did not have to throw an error since the Master variant   is no\\n  // -- longer valid for sale.\\n  if (model.OptionChoices != null && model.OptionChoices.Any())\\n  {\\n   var variant = product.GetProductVariantDisplayWithAttributes(model.OptionChoices);\\n                this.Basket.AddItem(variant, variant.Name, 1, extendedData);\\n  }\\n  else\\n  {\\n     this.Basket.AddItem(product, product.Name, 1, extendedData);\\n  }\\n\\n   this.Basket.Save();\\n}\",\n      \"language\": \"csharp\",\n      \"name\": \"Adding an item to the Basket\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example - Updating Basket Quantities\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n/// The basket table model.\\n/// </summary>\\npublic partial class BasketTableModel : ItemCollectionTable\\n{\\n        /// <summary>\\n        /// Gets or sets the checkout page.\\n        /// </summary>\\n        public IPublishedContent CheckoutPage { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the currency.\\n        /// </summary>\\n        public ICurrency Currency { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets the basket line items.\\n        /// </summary>\\n        public BasketLineItem[] Items { get; set; }\\n\\n        /// <summary>\\n        /// Gets the total price.\\n        /// </summary>\\n        public decimal TotalPrice { get; internal set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether show wish list buttons.\\n        /// </summary>\\n        public bool ShowWishList { get; set; }\\n}\",\n      \"language\": \"csharp\",\n      \"name\": \"BasketTableModel\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n/// Responsible for updating the quantities of items in the basket\\n/// </summary>\\n/// <param name=\\\"model\\\">The <see cref=\\\"IEnumerable{T}\\\"/></param>\\n/// <returns>Redirects to the current Umbraco page (the basket page)</returns>\\n[HttpPost]\\npublic ActionResult UpdateBasket(BasketTableModel model)\\n{\\n     if (!this.ModelState.IsValid) return this.CurrentUmbracoPage();\\n\\n     // The only thing that can be updated in this basket is the quantity\\n     foreach (var item in model.Items.Where(item => this.Basket.Items.First(x => x.Key == item.Key).Quantity != item.Quantity))\\n     {\\n         this.Basket.UpdateQuantity(item.Key, item.Quantity);\\n     }\\n\\n     this.Basket.Save();\\n\\n     return this.CurrentUmbracoPage();\\n}\",\n      \"language\": \"csharp\",\n      \"name\": \"UpdateBasket\"\n    }\n  ]\n}\n[/block]","title":"Basket","updates":[],"hidden":false,"excerpt":"Documentation for the Merchello Basket object","project":"56421bcdb48bdf19006a4c97","link_external":false,"githubsync":"","slug":"basket","category":"56b92aff08d8b20d00bc3b07","createdAt":"2015-11-13T18:20:30.740Z","link_url":"","sync_unique":"","type":"basic","__v":0,"childrenPages":[]}

Basket

Documentation for the Merchello Basket object

[block:callout] { "type": "info", "title": "CustomerItemCacheBase classes", "body": "Basket, WishList" } [/block] [block:api-header] { "type": "basic", "title": "Accessing a customer basket", "sidebar": true } [/block] [block:textarea] { "text": "The basket is accessed through an extension method off of the `CurrentCustomer` property of the [CustomerContext](doc:customercontext).", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var basket = CustomerContext.CurrentCustomer.Basket();", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "decimal TotalBasketPrice", "0-1": "Gets the sum of all basket item \"amount\" multiplied by quantity (price)", "1-0": "bool EnableDataModifiers", "1-1": "Gets or sets a value indicating whether enable data modifiers.", "2-0": "Guid VersionKey", "2-1": "Read only - Gets the item caches version key", "3-0": "ICustomerBase Customer", "3-1": "Read only - Gets the customer associated with the item cache", "4-0": "LineItemCollection Items", "4-1": "Read only - Gets the item cache line items", "5-0": "int TotalItemCount", "5-1": "Read only - Gets the item cache's item count", "6-0": "int TotalQuantityCount", "6-1": "Read only - Gets the sum of all item cache item quantities", "7-0": "decimal TotalItemCachePrice", "7-1": "Read only - Gets the sum of all item cache item \"amount\" multiplied by quantity (price)", "8-0": "bool IsEmpty", "8-1": "Read only - Gets a value indicating whether or not the item cache contains any items" }, "cols": 2, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "void AddItem(IProduct product)", "0-1": "Adds a IProduct to the item cache", "1-0": "void AddItem(IProduct product, int quantity)", "1-1": "Adds a IProduct to the item cache", "2-0": "void AddItem(IProduct product, string name, int quantity)", "3-0": "void AddItem(IProduct product, string name, int quantity, ExtendedDataCollection extendedData)", "4-0": "void AddItem(ProductDisplay product)", "5-0": "void AddItem(ProductDisplay product, int quantity)", "6-0": "void AddItem(ProductDisplay product, string name, int quantity)", "7-0": "void AddItem(ProductDisplay product, string name, int quantity, ExtendedDataCollection extendedData)", "8-0": "void AddItem(IProductVariant productVariant)", "9-0": "void AddItem(IProductVariant productVariant, int quantity)", "10-0": "void AddItem(IProductVariant productVariant, string name, int quantity)", "11-0": "void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)", "12-0": "void AddItem(ProductVariantDisplay productVariant)", "13-0": "void AddItem(ProductVariantDisplay productVariant, int quantity)", "14-0": "void AddItem(ProductVariantDisplay productVariant, string name, int quantity)", "15-0": "void AddItem(ProductVariantDisplay productVariant, string name, int quantity, ExtendedDataCollection extendedData)", "16-0": "void AddItem(string name, string sku, decimal price)", "17-0": "void AddItem(string name, string sku, int quantity, decimal price)", "18-0": "void AddItem(string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData)", "19-0": "void AddItem(IItemCacheLineItem lineItem)", "20-0": "void UpdateQuantity(Guid key, int quantity)", "21-0": "void UpdateQuantity(string sku, int quantity)", "22-0": "void UpdateQuantity(IProductVariant productVariant, int quantity)", "23-0": "void RemoveItem(Guid itemKey)", "24-0": "void RemoveItem(string sku)", "25-0": "void RemoveItem(IProductVariant productVariant)", "26-0": "void Empty()", "27-0": "void Refresh()", "28-0": "bool Validate()", "29-0": "void Accept(ILineItemVisitor visitor)", "29-1": "Accepts visitor class to visit item cache items", "28-1": "Validates values stored in the internal item cache to make certain items being purchase\nreflect most recent values in the back office.", "27-1": "Refreshes cache with database values", "26-1": "Empties the item cache", "25-1": "Removes a product variant from the item cache", "24-1": "Removes a product variant from the item cache", "23-1": "Removes a product variant from the item cache", "22-1": "Updates the quantity of an item in the item cache", "21-1": "Updates the quantity of an item in the item cache", "20-1": "Updates the quantity of an item in the item cache", "2-1": "Adds a IProduct to the item cache", "3-1": "Adds a IProduct to the item cache", "4-1": "Adds a ProductDisplay to the item cache", "5-1": "Adds a ProductDisplay to the item cache", "6-1": "Adds a ProductDisplay to the item cache", "7-1": "Adds a ProductDisplay to the item cache", "8-1": "Adds a IProductVariant to the item cache", "9-1": "Adds a IProductVariant to the item cache", "10-1": "Adds a IProduct to the item cache", "11-1": "Adds a IProductVariant to the item cache", "12-1": "Adds a IProductVariant to the item cache", "13-1": "Adds a ProductVariantDisplay to the item cache", "14-1": "Adds a ProductVariantDisplay to the item cache", "15-1": "Adds a ProductVariantDisplay to the item cache", "16-1": "Adds a item to the item cache", "17-1": "Adds a item to the item cache", "18-1": "Adds a item to the item cache", "19-1": "Adds a item to the item cache" }, "cols": 2, "rows": 30 } [/block] [block:api-header] { "type": "basic", "title": "Examples - Adding an Item to the Basket" } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n /// Simple Model for the Add To Cart form.\n /// </summary>\n public partial class AddItemModel\n {\n /// <summary>\n /// Gets or sets the Content Id of the ProductDetail page\n /// </summary>\n public int ContentId { get; set; }\n\n /// <summary>\n /// Gets or sets the basket page id.\n /// </summary>\n public int BasketPageId { get; set; }\n\n /// <summary>\n /// Gets or sets the wish list page id.\n /// </summary>\n public int WishListPageId { get; set; }\n\n /// <summary>\n /// Gets or sets the product.\n /// </summary>\n public ProductDisplay Product { get; set; }\n\n /// <summary>\n /// Gets or sets the option choices (if there are any), used to determine the variant \n /// </summary>\n public Guid[] OptionChoices { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether show wish list.\n /// </summary>\n public bool ShowWishList { get; set; }\n\n /// <summary>\n /// Gets or sets the currency.\n /// </summary>\n public ICurrency Currency { get; set; }\n }", "language": "csharp", "name": "AddItemModel" } ] } [/block] [block:code] { "codes": [ { "code": "[HttpPost]\npublic ActionResult AddToBasket(AddItemModel model)\n{\n\n\n // We've added some data modifiers that can handle such things as including taxes in product\n // pricing. The data modifiers can either get executed when the item is added to the basket or\n // as a result from a MerchelloHelper query - you just don't want them to execute twice.\n\n var merchello = new MerchelloHelper(false);\n\n var product = merchello.Query.Product.GetByKey(model.Product.Key);\n\n // In the event the product has options we want to add the \"variant\" to the basket.\n // -- If a product that has variants is defined, the FIRST variant will be added to the cart. \n // -- This was done so that we did not have to throw an error since the Master variant is no\n // -- longer valid for sale.\n if (model.OptionChoices != null && model.OptionChoices.Any())\n {\n var variant = product.GetProductVariantDisplayWithAttributes(model.OptionChoices);\n this.Basket.AddItem(variant, variant.Name, 1, extendedData);\n }\n else\n {\n this.Basket.AddItem(product, product.Name, 1, extendedData);\n }\n\n this.Basket.Save();\n}", "language": "csharp", "name": "Adding an item to the Basket" } ] } [/block] [block:api-header] { "type": "basic", "title": "Example - Updating Basket Quantities" } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// The basket table model.\n/// </summary>\npublic partial class BasketTableModel : ItemCollectionTable\n{\n /// <summary>\n /// Gets or sets the checkout page.\n /// </summary>\n public IPublishedContent CheckoutPage { get; set; }\n\n /// <summary>\n /// Gets or sets the currency.\n /// </summary>\n public ICurrency Currency { get; set; }\n\n /// <summary>\n /// Gets or sets the basket line items.\n /// </summary>\n public BasketLineItem[] Items { get; set; }\n\n /// <summary>\n /// Gets the total price.\n /// </summary>\n public decimal TotalPrice { get; internal set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether show wish list buttons.\n /// </summary>\n public bool ShowWishList { get; set; }\n}", "language": "csharp", "name": "BasketTableModel" } ] } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// Responsible for updating the quantities of items in the basket\n/// </summary>\n/// <param name=\"model\">The <see cref=\"IEnumerable{T}\"/></param>\n/// <returns>Redirects to the current Umbraco page (the basket page)</returns>\n[HttpPost]\npublic ActionResult UpdateBasket(BasketTableModel model)\n{\n if (!this.ModelState.IsValid) return this.CurrentUmbracoPage();\n\n // The only thing that can be updated in this basket is the quantity\n foreach (var item in model.Items.Where(item => this.Basket.Items.First(x => x.Key == item.Key).Quantity != item.Quantity))\n {\n this.Basket.UpdateQuantity(item.Key, item.Quantity);\n }\n\n this.Basket.Save();\n\n return this.CurrentUmbracoPage();\n}", "language": "csharp", "name": "UpdateBasket" } ] } [/block]
[block:callout] { "type": "info", "title": "CustomerItemCacheBase classes", "body": "Basket, WishList" } [/block] [block:api-header] { "type": "basic", "title": "Accessing a customer basket", "sidebar": true } [/block] [block:textarea] { "text": "The basket is accessed through an extension method off of the `CurrentCustomer` property of the [CustomerContext](doc:customercontext).", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var basket = CustomerContext.CurrentCustomer.Basket();", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "decimal TotalBasketPrice", "0-1": "Gets the sum of all basket item \"amount\" multiplied by quantity (price)", "1-0": "bool EnableDataModifiers", "1-1": "Gets or sets a value indicating whether enable data modifiers.", "2-0": "Guid VersionKey", "2-1": "Read only - Gets the item caches version key", "3-0": "ICustomerBase Customer", "3-1": "Read only - Gets the customer associated with the item cache", "4-0": "LineItemCollection Items", "4-1": "Read only - Gets the item cache line items", "5-0": "int TotalItemCount", "5-1": "Read only - Gets the item cache's item count", "6-0": "int TotalQuantityCount", "6-1": "Read only - Gets the sum of all item cache item quantities", "7-0": "decimal TotalItemCachePrice", "7-1": "Read only - Gets the sum of all item cache item \"amount\" multiplied by quantity (price)", "8-0": "bool IsEmpty", "8-1": "Read only - Gets a value indicating whether or not the item cache contains any items" }, "cols": 2, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "void AddItem(IProduct product)", "0-1": "Adds a IProduct to the item cache", "1-0": "void AddItem(IProduct product, int quantity)", "1-1": "Adds a IProduct to the item cache", "2-0": "void AddItem(IProduct product, string name, int quantity)", "3-0": "void AddItem(IProduct product, string name, int quantity, ExtendedDataCollection extendedData)", "4-0": "void AddItem(ProductDisplay product)", "5-0": "void AddItem(ProductDisplay product, int quantity)", "6-0": "void AddItem(ProductDisplay product, string name, int quantity)", "7-0": "void AddItem(ProductDisplay product, string name, int quantity, ExtendedDataCollection extendedData)", "8-0": "void AddItem(IProductVariant productVariant)", "9-0": "void AddItem(IProductVariant productVariant, int quantity)", "10-0": "void AddItem(IProductVariant productVariant, string name, int quantity)", "11-0": "void AddItem(IProductVariant productVariant, string name, int quantity, ExtendedDataCollection extendedData)", "12-0": "void AddItem(ProductVariantDisplay productVariant)", "13-0": "void AddItem(ProductVariantDisplay productVariant, int quantity)", "14-0": "void AddItem(ProductVariantDisplay productVariant, string name, int quantity)", "15-0": "void AddItem(ProductVariantDisplay productVariant, string name, int quantity, ExtendedDataCollection extendedData)", "16-0": "void AddItem(string name, string sku, decimal price)", "17-0": "void AddItem(string name, string sku, int quantity, decimal price)", "18-0": "void AddItem(string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData)", "19-0": "void AddItem(IItemCacheLineItem lineItem)", "20-0": "void UpdateQuantity(Guid key, int quantity)", "21-0": "void UpdateQuantity(string sku, int quantity)", "22-0": "void UpdateQuantity(IProductVariant productVariant, int quantity)", "23-0": "void RemoveItem(Guid itemKey)", "24-0": "void RemoveItem(string sku)", "25-0": "void RemoveItem(IProductVariant productVariant)", "26-0": "void Empty()", "27-0": "void Refresh()", "28-0": "bool Validate()", "29-0": "void Accept(ILineItemVisitor visitor)", "29-1": "Accepts visitor class to visit item cache items", "28-1": "Validates values stored in the internal item cache to make certain items being purchase\nreflect most recent values in the back office.", "27-1": "Refreshes cache with database values", "26-1": "Empties the item cache", "25-1": "Removes a product variant from the item cache", "24-1": "Removes a product variant from the item cache", "23-1": "Removes a product variant from the item cache", "22-1": "Updates the quantity of an item in the item cache", "21-1": "Updates the quantity of an item in the item cache", "20-1": "Updates the quantity of an item in the item cache", "2-1": "Adds a IProduct to the item cache", "3-1": "Adds a IProduct to the item cache", "4-1": "Adds a ProductDisplay to the item cache", "5-1": "Adds a ProductDisplay to the item cache", "6-1": "Adds a ProductDisplay to the item cache", "7-1": "Adds a ProductDisplay to the item cache", "8-1": "Adds a IProductVariant to the item cache", "9-1": "Adds a IProductVariant to the item cache", "10-1": "Adds a IProduct to the item cache", "11-1": "Adds a IProductVariant to the item cache", "12-1": "Adds a IProductVariant to the item cache", "13-1": "Adds a ProductVariantDisplay to the item cache", "14-1": "Adds a ProductVariantDisplay to the item cache", "15-1": "Adds a ProductVariantDisplay to the item cache", "16-1": "Adds a item to the item cache", "17-1": "Adds a item to the item cache", "18-1": "Adds a item to the item cache", "19-1": "Adds a item to the item cache" }, "cols": 2, "rows": 30 } [/block] [block:api-header] { "type": "basic", "title": "Examples - Adding an Item to the Basket" } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n /// Simple Model for the Add To Cart form.\n /// </summary>\n public partial class AddItemModel\n {\n /// <summary>\n /// Gets or sets the Content Id of the ProductDetail page\n /// </summary>\n public int ContentId { get; set; }\n\n /// <summary>\n /// Gets or sets the basket page id.\n /// </summary>\n public int BasketPageId { get; set; }\n\n /// <summary>\n /// Gets or sets the wish list page id.\n /// </summary>\n public int WishListPageId { get; set; }\n\n /// <summary>\n /// Gets or sets the product.\n /// </summary>\n public ProductDisplay Product { get; set; }\n\n /// <summary>\n /// Gets or sets the option choices (if there are any), used to determine the variant \n /// </summary>\n public Guid[] OptionChoices { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether show wish list.\n /// </summary>\n public bool ShowWishList { get; set; }\n\n /// <summary>\n /// Gets or sets the currency.\n /// </summary>\n public ICurrency Currency { get; set; }\n }", "language": "csharp", "name": "AddItemModel" } ] } [/block] [block:code] { "codes": [ { "code": "[HttpPost]\npublic ActionResult AddToBasket(AddItemModel model)\n{\n\n\n // We've added some data modifiers that can handle such things as including taxes in product\n // pricing. The data modifiers can either get executed when the item is added to the basket or\n // as a result from a MerchelloHelper query - you just don't want them to execute twice.\n\n var merchello = new MerchelloHelper(false);\n\n var product = merchello.Query.Product.GetByKey(model.Product.Key);\n\n // In the event the product has options we want to add the \"variant\" to the basket.\n // -- If a product that has variants is defined, the FIRST variant will be added to the cart. \n // -- This was done so that we did not have to throw an error since the Master variant is no\n // -- longer valid for sale.\n if (model.OptionChoices != null && model.OptionChoices.Any())\n {\n var variant = product.GetProductVariantDisplayWithAttributes(model.OptionChoices);\n this.Basket.AddItem(variant, variant.Name, 1, extendedData);\n }\n else\n {\n this.Basket.AddItem(product, product.Name, 1, extendedData);\n }\n\n this.Basket.Save();\n}", "language": "csharp", "name": "Adding an item to the Basket" } ] } [/block] [block:api-header] { "type": "basic", "title": "Example - Updating Basket Quantities" } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// The basket table model.\n/// </summary>\npublic partial class BasketTableModel : ItemCollectionTable\n{\n /// <summary>\n /// Gets or sets the checkout page.\n /// </summary>\n public IPublishedContent CheckoutPage { get; set; }\n\n /// <summary>\n /// Gets or sets the currency.\n /// </summary>\n public ICurrency Currency { get; set; }\n\n /// <summary>\n /// Gets or sets the basket line items.\n /// </summary>\n public BasketLineItem[] Items { get; set; }\n\n /// <summary>\n /// Gets the total price.\n /// </summary>\n public decimal TotalPrice { get; internal set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether show wish list buttons.\n /// </summary>\n public bool ShowWishList { get; set; }\n}", "language": "csharp", "name": "BasketTableModel" } ] } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// Responsible for updating the quantities of items in the basket\n/// </summary>\n/// <param name=\"model\">The <see cref=\"IEnumerable{T}\"/></param>\n/// <returns>Redirects to the current Umbraco page (the basket page)</returns>\n[HttpPost]\npublic ActionResult UpdateBasket(BasketTableModel model)\n{\n if (!this.ModelState.IsValid) return this.CurrentUmbracoPage();\n\n // The only thing that can be updated in this basket is the quantity\n foreach (var item in model.Items.Where(item => this.Basket.Items.First(x => x.Key == item.Key).Quantity != item.Quantity))\n {\n this.Basket.UpdateQuantity(item.Key, item.Quantity);\n }\n\n this.Basket.Save();\n\n return this.CurrentUmbracoPage();\n}", "language": "csharp", "name": "UpdateBasket" } ] } [/block]
{"_id":"56b92b0308d8b20d00bc3b21","githubsync":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"string GetValue(string key)\",\n    \"0-1\": \"Gets a value from the collection.\",\n    \"1-0\": \"void SetValue(string key, string value)\",\n    \"1-1\": \"Sets an extended data value.\",\n    \"2-0\": \"void RemoveValue(string key)\",\n    \"2-1\": \"Removes a value from extended data.\",\n    \"3-0\": \"void Clear()\",\n    \"3-1\": \"Clears the collection.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Product Line Items\",\n  \"body\": \"When a product is added to a basket, the product information is added to the extended data collection associated with the basket line item.  In this way, Merchello is able to decouple the product catalog from the checkout process.\"\n}\n[/block]","__v":0,"version":"56b92afe08d8b20d00bc3afd","updates":[],"slug":"extendeddatacollection","type":"basic","user":"564136b9f424a10d001181e1","link_external":false,"link_url":"","excerpt":"A key value dictionary that gets serialized as XML into a single field and persisted to extended an associated data record.","hidden":false,"order":27,"title":"ExtendedDataCollection","category":"56b92aff08d8b20d00bc3b07","project":"56421bcdb48bdf19006a4c97","createdAt":"2015-11-13T21:58:46.829Z","sync_unique":"","childrenPages":[]}

ExtendedDataCollection

A key value dictionary that gets serialized as XML into a single field and persisted to extended an associated data record.

[block:api-header] { "type": "basic", "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "string GetValue(string key)", "0-1": "Gets a value from the collection.", "1-0": "void SetValue(string key, string value)", "1-1": "Sets an extended data value.", "2-0": "void RemoveValue(string key)", "2-1": "Removes a value from extended data.", "3-0": "void Clear()", "3-1": "Clears the collection." }, "cols": 2, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "Product Line Items", "body": "When a product is added to a basket, the product information is added to the extended data collection associated with the basket line item. In this way, Merchello is able to decouple the product catalog from the checkout process." } [/block]
[block:api-header] { "type": "basic", "title": "Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "string GetValue(string key)", "0-1": "Gets a value from the collection.", "1-0": "void SetValue(string key, string value)", "1-1": "Sets an extended data value.", "2-0": "void RemoveValue(string key)", "2-1": "Removes a value from extended data.", "3-0": "void Clear()", "3-1": "Clears the collection." }, "cols": 2, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "Product Line Items", "body": "When a product is added to a basket, the product information is added to the extended data collection associated with the basket line item. In this way, Merchello is able to decouple the product catalog from the checkout process." } [/block]
{"_id":"56b92b0308d8b20d00bc3b22","version":"56b92afe08d8b20d00bc3afd","sync_unique":"","body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"CheckoutContext Version\",\n  \"body\": \"The CheckoutContext maintains a \\\"version\\\" to ensure that any changes the customer makes to their basket after entering into the checkout process, e.g. adds an additional item or adjusts the quantity of an item, are not missed in shipping and taxation calculations.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiation\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var basket = CurrentCustomer.Basket();\\n\\n// using default settings\\nvar context = CheckoutContext.CreateCheckoutContext(CurrentCustomer, basket.VersionKey);\",\n      \"language\": \"csharp\",\n      \"name\": \"Instantiating a CheckoutContext\"\n    }\n  ]\n}\n[/block]\nBy default all of the following settings are set to `true`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n    /// Defines checkout context settings.\\n    /// </summary>\\n    public interface ICheckoutContextSettings\\n    {\\n      /// <summary>\\n        /// Gets or sets the invoice number prefix to be added to the generated invoice in the invoice builder.\\n        /// </summary>\\n        string InvoiceNumberPrefix { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether or not to apply taxes to generated invoice.\\n        /// </summary>\\n        bool ApplyTaxesToInvoice { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether raise customer events.  Defaults to false\\n        /// </summary>\\n        /// <remarks>\\n        /// In some implementations, there may be quite a few saves to the customer record.  Use case for setting this to \\n        /// false would be an API notification on a customer record change to prevent spamming of the notification. \\n        /// </remarks>\\n        bool RaiseCustomerEvents { get; set; }\\n      \\n        /// <summary>\\n        /// Gets or sets a value indicating whether reset the customer manager data on version change.\\n        /// </summary>\\n        bool ResetCustomerManagerDataOnVersionChange { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether reset the payment manager data on version change.\\n        /// </summary>\\n        bool ResetPaymentManagerDataOnVersionChange { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether reset the extended manager data on version change.\\n        /// </summary>\\n        bool ResetExtendedManagerDataOnVersionChange { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether reset the shipping manager data on version change.\\n        /// </summary>\\n        bool ResetShippingManagerDataOnVersionChange { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether reset the offer manager data on version change.\\n        /// </summary>\\n        bool ResetOfferManagerDataOnVersionChange { get; set; }\\n\\n        /// <summary>\\n        /// Gets or sets a value indicating whether to empty the basket on payment success.\\n        /// </summary>\\n        bool EmptyBasketOnPaymentSuccess { get; set; }\\n    }\",\n      \"language\": \"csharp\",\n      \"name\": \"ICheckoutContextChangeSettings\"\n    }\n  ]\n}\n[/block]\nTo override the default settings\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var settings = new CheckoutContextSettings()\\n{\\n  ResetCustomerManagerDataOnVersionChange = false,\\n  RaiseCustomerEvents = true,\\n  EmptyBasketOnPaymentSuccess = false\\n};\\n\\nvar basket = CurrentCustomer.Basket();\\n\\n// using custom settings\\nvar context = CheckoutContext.CreateCheckoutContext(CurrentCustomer, basket.VersionKey, settings);\",\n      \"language\": \"csharp\",\n      \"name\": \"Instantiating the CheckoutContext with custom settings\"\n    }\n  ]\n}\n[/block]\nIn most cases, developers will not need to programatically instantiate the CheckoutContext as it is handled internally when instantiating the [BasketCheckoutManager (Checkout)](doc:basketcheckoutmanager) with the `GetCheckoutManager([optional settings])` extension method.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Whats going on internally?\"\n}\n[/block]\nWhen the CheckoutContext first gets instantiated, a copy is made of all items in customers `ItemCache` (in most cases basket contents) so that it can be manipulated without actually affecting the users basket.  Additional line items that are not specifically associated with the customer, such as shipping line items, are added to this internal copy.  \n\nThe version key (GUID) is checked between the basket and the copy whenever the context is instantiated.  Every `Basket.Save()` generates a new basket version which will in turn force a re-synchronization of the ItemCache copy maintained in the CheckoutContext.  \n\nThe CheckoutContextChangeSettings are used to determine which additional objects, such as stored customer addresses, invoice notes, etc. when the CheckoutContext gets reset.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"MerchelloContext\",\n    \"0-1\": \"Gets the current `IMerchelloContext` (singleton)\",\n    \"1-0\": \"Services\",\n    \"1-1\": \"Gets the Merchello `ServiceContext` (singleton)\",\n    \"2-0\": \"Gateways\",\n    \"2-1\": \"Gets the Merchello `GatewayContext` (singleton)\",\n    \"3-0\": \"ItemCache\",\n    \"3-1\": \"Gets the `IItemCache`.  This is a temporary collection of line items that is generally copied from the basket that can be modified while preparing the final invoice.\",\n    \"4-0\": \"Customer\",\n    \"4-1\": \"Gets the `ICustomerBase` associated with the checkout.\",\n    \"5-0\": \"VersionKey\",\n    \"5-1\": \"Gets the checkout version key.  Generally used to ensure version consistency between the checkout manager and the basket.\",\n    \"6-0\": \"IsNewVersion\",\n    \"6-1\": \"Gets a value indicating whether this context is a new checkout version.\",\n    \"7-0\": \"Cache\",\n    \"7-1\": \"Gets Umbraco's IRuntimeCacheProvider - exposed for use in testing and [Task Chains](doc:overview-2) but generally is just a reference to `ApplicationContext.Current.ApplicationCache.RuntimeCache`\",\n    \"8-0\": \"Settings\",\n    \"8-1\": \"Gets the `ICheckoutContextSettings`\"\n  },\n  \"cols\": 2,\n  \"rows\": 9\n}\n[/block]","__v":0,"project":"56421bcdb48bdf19006a4c97","link_external":false,"hidden":false,"excerpt":"A class responsible for sharing information between various *CheckoutManagers*.","slug":"checkoutcontext","type":"basic","title":"CheckoutContext","user":"564136b9f424a10d001181e1","updates":[],"createdAt":"2016-01-13T20:43:51.007Z","link_url":"","order":28,"category":"56b92aff08d8b20d00bc3b07","githubsync":"","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"childrenPages":[]}

CheckoutContext

A class responsible for sharing information between various *CheckoutManagers*.

[block:callout] { "type": "info", "title": "CheckoutContext Version", "body": "The CheckoutContext maintains a \"version\" to ensure that any changes the customer makes to their basket after entering into the checkout process, e.g. adds an additional item or adjusts the quantity of an item, are not missed in shipping and taxation calculations." } [/block] [block:api-header] { "type": "basic", "title": "Instantiation" } [/block] [block:code] { "codes": [ { "code": "var basket = CurrentCustomer.Basket();\n\n// using default settings\nvar context = CheckoutContext.CreateCheckoutContext(CurrentCustomer, basket.VersionKey);", "language": "csharp", "name": "Instantiating a CheckoutContext" } ] } [/block] By default all of the following settings are set to `true`. [block:code] { "codes": [ { "code": "/// <summary>\n /// Defines checkout context settings.\n /// </summary>\n public interface ICheckoutContextSettings\n {\n /// <summary>\n /// Gets or sets the invoice number prefix to be added to the generated invoice in the invoice builder.\n /// </summary>\n string InvoiceNumberPrefix { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether or not to apply taxes to generated invoice.\n /// </summary>\n bool ApplyTaxesToInvoice { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether raise customer events. Defaults to false\n /// </summary>\n /// <remarks>\n /// In some implementations, there may be quite a few saves to the customer record. Use case for setting this to \n /// false would be an API notification on a customer record change to prevent spamming of the notification. \n /// </remarks>\n bool RaiseCustomerEvents { get; set; }\n \n /// <summary>\n /// Gets or sets a value indicating whether reset the customer manager data on version change.\n /// </summary>\n bool ResetCustomerManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the payment manager data on version change.\n /// </summary>\n bool ResetPaymentManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the extended manager data on version change.\n /// </summary>\n bool ResetExtendedManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the shipping manager data on version change.\n /// </summary>\n bool ResetShippingManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the offer manager data on version change.\n /// </summary>\n bool ResetOfferManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether to empty the basket on payment success.\n /// </summary>\n bool EmptyBasketOnPaymentSuccess { get; set; }\n }", "language": "csharp", "name": "ICheckoutContextChangeSettings" } ] } [/block] To override the default settings [block:code] { "codes": [ { "code": "var settings = new CheckoutContextSettings()\n{\n ResetCustomerManagerDataOnVersionChange = false,\n RaiseCustomerEvents = true,\n EmptyBasketOnPaymentSuccess = false\n};\n\nvar basket = CurrentCustomer.Basket();\n\n// using custom settings\nvar context = CheckoutContext.CreateCheckoutContext(CurrentCustomer, basket.VersionKey, settings);", "language": "csharp", "name": "Instantiating the CheckoutContext with custom settings" } ] } [/block] In most cases, developers will not need to programatically instantiate the CheckoutContext as it is handled internally when instantiating the [BasketCheckoutManager (Checkout)](doc:basketcheckoutmanager) with the `GetCheckoutManager([optional settings])` extension method. [block:api-header] { "type": "basic", "title": "Whats going on internally?" } [/block] When the CheckoutContext first gets instantiated, a copy is made of all items in customers `ItemCache` (in most cases basket contents) so that it can be manipulated without actually affecting the users basket. Additional line items that are not specifically associated with the customer, such as shipping line items, are added to this internal copy. The version key (GUID) is checked between the basket and the copy whenever the context is instantiated. Every `Basket.Save()` generates a new basket version which will in turn force a re-synchronization of the ItemCache copy maintained in the CheckoutContext. The CheckoutContextChangeSettings are used to determine which additional objects, such as stored customer addresses, invoice notes, etc. when the CheckoutContext gets reset. [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "MerchelloContext", "0-1": "Gets the current `IMerchelloContext` (singleton)", "1-0": "Services", "1-1": "Gets the Merchello `ServiceContext` (singleton)", "2-0": "Gateways", "2-1": "Gets the Merchello `GatewayContext` (singleton)", "3-0": "ItemCache", "3-1": "Gets the `IItemCache`. This is a temporary collection of line items that is generally copied from the basket that can be modified while preparing the final invoice.", "4-0": "Customer", "4-1": "Gets the `ICustomerBase` associated with the checkout.", "5-0": "VersionKey", "5-1": "Gets the checkout version key. Generally used to ensure version consistency between the checkout manager and the basket.", "6-0": "IsNewVersion", "6-1": "Gets a value indicating whether this context is a new checkout version.", "7-0": "Cache", "7-1": "Gets Umbraco's IRuntimeCacheProvider - exposed for use in testing and [Task Chains](doc:overview-2) but generally is just a reference to `ApplicationContext.Current.ApplicationCache.RuntimeCache`", "8-0": "Settings", "8-1": "Gets the `ICheckoutContextSettings`" }, "cols": 2, "rows": 9 } [/block]
[block:callout] { "type": "info", "title": "CheckoutContext Version", "body": "The CheckoutContext maintains a \"version\" to ensure that any changes the customer makes to their basket after entering into the checkout process, e.g. adds an additional item or adjusts the quantity of an item, are not missed in shipping and taxation calculations." } [/block] [block:api-header] { "type": "basic", "title": "Instantiation" } [/block] [block:code] { "codes": [ { "code": "var basket = CurrentCustomer.Basket();\n\n// using default settings\nvar context = CheckoutContext.CreateCheckoutContext(CurrentCustomer, basket.VersionKey);", "language": "csharp", "name": "Instantiating a CheckoutContext" } ] } [/block] By default all of the following settings are set to `true`. [block:code] { "codes": [ { "code": "/// <summary>\n /// Defines checkout context settings.\n /// </summary>\n public interface ICheckoutContextSettings\n {\n /// <summary>\n /// Gets or sets the invoice number prefix to be added to the generated invoice in the invoice builder.\n /// </summary>\n string InvoiceNumberPrefix { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether or not to apply taxes to generated invoice.\n /// </summary>\n bool ApplyTaxesToInvoice { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether raise customer events. Defaults to false\n /// </summary>\n /// <remarks>\n /// In some implementations, there may be quite a few saves to the customer record. Use case for setting this to \n /// false would be an API notification on a customer record change to prevent spamming of the notification. \n /// </remarks>\n bool RaiseCustomerEvents { get; set; }\n \n /// <summary>\n /// Gets or sets a value indicating whether reset the customer manager data on version change.\n /// </summary>\n bool ResetCustomerManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the payment manager data on version change.\n /// </summary>\n bool ResetPaymentManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the extended manager data on version change.\n /// </summary>\n bool ResetExtendedManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the shipping manager data on version change.\n /// </summary>\n bool ResetShippingManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether reset the offer manager data on version change.\n /// </summary>\n bool ResetOfferManagerDataOnVersionChange { get; set; }\n\n /// <summary>\n /// Gets or sets a value indicating whether to empty the basket on payment success.\n /// </summary>\n bool EmptyBasketOnPaymentSuccess { get; set; }\n }", "language": "csharp", "name": "ICheckoutContextChangeSettings" } ] } [/block] To override the default settings [block:code] { "codes": [ { "code": "var settings = new CheckoutContextSettings()\n{\n ResetCustomerManagerDataOnVersionChange = false,\n RaiseCustomerEvents = true,\n EmptyBasketOnPaymentSuccess = false\n};\n\nvar basket = CurrentCustomer.Basket();\n\n// using custom settings\nvar context = CheckoutContext.CreateCheckoutContext(CurrentCustomer, basket.VersionKey, settings);", "language": "csharp", "name": "Instantiating the CheckoutContext with custom settings" } ] } [/block] In most cases, developers will not need to programatically instantiate the CheckoutContext as it is handled internally when instantiating the [BasketCheckoutManager (Checkout)](doc:basketcheckoutmanager) with the `GetCheckoutManager([optional settings])` extension method. [block:api-header] { "type": "basic", "title": "Whats going on internally?" } [/block] When the CheckoutContext first gets instantiated, a copy is made of all items in customers `ItemCache` (in most cases basket contents) so that it can be manipulated without actually affecting the users basket. Additional line items that are not specifically associated with the customer, such as shipping line items, are added to this internal copy. The version key (GUID) is checked between the basket and the copy whenever the context is instantiated. Every `Basket.Save()` generates a new basket version which will in turn force a re-synchronization of the ItemCache copy maintained in the CheckoutContext. The CheckoutContextChangeSettings are used to determine which additional objects, such as stored customer addresses, invoice notes, etc. when the CheckoutContext gets reset. [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "MerchelloContext", "0-1": "Gets the current `IMerchelloContext` (singleton)", "1-0": "Services", "1-1": "Gets the Merchello `ServiceContext` (singleton)", "2-0": "Gateways", "2-1": "Gets the Merchello `GatewayContext` (singleton)", "3-0": "ItemCache", "3-1": "Gets the `IItemCache`. This is a temporary collection of line items that is generally copied from the basket that can be modified while preparing the final invoice.", "4-0": "Customer", "4-1": "Gets the `ICustomerBase` associated with the checkout.", "5-0": "VersionKey", "5-1": "Gets the checkout version key. Generally used to ensure version consistency between the checkout manager and the basket.", "6-0": "IsNewVersion", "6-1": "Gets a value indicating whether this context is a new checkout version.", "7-0": "Cache", "7-1": "Gets Umbraco's IRuntimeCacheProvider - exposed for use in testing and [Task Chains](doc:overview-2) but generally is just a reference to `ApplicationContext.Current.ApplicationCache.RuntimeCache`", "8-0": "Settings", "8-1": "Gets the `ICheckoutContextSettings`" }, "cols": 2, "rows": 9 } [/block]
{"_id":"56b92b0308d8b20d00bc3b23","excerpt":"","category":"56b92aff08d8b20d00bc3b07","link_external":false,"body":"`CheckoutManagers` are used to manage the most aspects of the checkout workflow.  Merchello's default CheckoutManager is the `BasketCheckoutManager` which is intended to be used for basket checkout outs.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"CheckoutManager supersede the SalePreparation in earlier versions.\",\n  \"body\": \"Prior to Merchello 1.14.0, the SalePreparation class was used to manage the checkout workflow.\"\n}\n[/block]\nThe CheckoutManager breaks down the checkout workflow into several logical areas which can be seen in the `ICheckoutManagerBase` interface.  Each area is managed by a specific lazy loaded area checkout manager.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"    /// <summary>\\n    /// Defines the base checkout workflow.\\n    /// </summary>\\n    public interface ICheckoutManagerBase : ICheckoutContextManagerBase\\n    {\\n        /// <summary>\\n        /// Gets the checkout manager for customer information.\\n        /// </summary>\\n        ICheckoutCustomerManager Customer { get; }\\n\\n        /// <summary>\\n        /// Gets the checkout extended manager for custom invoicing.\\n        /// </summary>\\n        ICheckoutExtendedManager Extended { get; }\\n\\n        /// <summary>\\n        /// Gets the checkout manager for marketing offers.\\n        /// </summary>\\n        ICheckoutOfferManager Offer { get; }\\n\\n        /// <summary>\\n        /// Gets the checkout manager for shipping.\\n        /// </summary>\\n        ICheckoutShippingManager Shipping { get; }\\n\\n        /// <summary>\\n        /// Gets the payment.\\n        /// </summary>\\n        ICheckoutPaymentManager Payment { get; }\\n    }\",\n      \"language\": \"csharp\",\n      \"name\": \"ICheckoutManagerBase\"\n    }\n  ]\n}\n[/block]\nContextual information is shared between the managers via a [CheckoutContext](doc:checkoutcontext) .\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n// IBasket extension method\\nvar checkoutManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]);\",\n      \"language\": \"csharp\",\n      \"name\": \"Instantiating the BasketCheckoutManager\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ICheckoutCustomerManager\"\n}\n[/block]\nICheckoutCustomerManager(s) are responsible for temporarily saving and retrieving previously saved customer information during the course of a checkout workflow.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n// ICheckoutCustomerManager of type BasketCheckoutCustomerManager\\nvar customerManager = CurrentCustomer.Basket().GetCheckoutManager().Customer;\",\n      \"language\": \"csharp\",\n      \"name\": \"BasketCheckoutCustomerManager\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"SaveBillToAddress(IAddress billToAddress)\",\n    \"0-1\": \"Saves the bill to address\",\n    \"1-0\": \"SaveShipToAddress(IAddress shipToAddress)\",\n    \"1-1\": \"Saves the ship to address\",\n    \"2-1\": \"Gets the bill to address\",\n    \"2-0\": \"IAddress GetBillToAddress()\",\n    \"3-0\": \"IAddress GetShipToAddress()\",\n    \"3-1\": \"Gets the bill to address\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CheckoutContext.ChangeSettings.ResetCustomerManagerDataOnVersionChange = true;\",\n      \"language\": \"csharp\",\n      \"name\": \"Default CheckoutContext setting\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Default context behavior for BasketCheckoutCustomerManager\",\n  \"body\": \"When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutCustomerManager` is to purge any previously saved billing and shipping addresses.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ICheckoutExtendedManager\"\n}\n[/block]\nICheckoutExtendedManager(s) are responsible for handling optional bits of a checkout workflow, such as adding custom line items and adding notes to an invoice.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var checkoutExtendedManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Extended;\",\n      \"language\": \"csharp\",\n      \"name\": \"BasketCheckoutExtendedManager\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"AddItem(ILineItem lineItem)\",\n    \"0-1\": \"Adds a <see cref=\\\"ILineItem\\\"/> to the collection of items.  *Intended for custom line item types.*\",\n    \"1-0\": \"RemoveItem(ILineItem lineItem)\",\n    \"1-1\": \"Removes a line item from the collection of items. *The line item to be removed.*\",\n    \"2-0\": \"ClearNotes()\",\n    \"2-1\": \"Clears all notes\",\n    \"3-0\": \"SaveNotes(IEnumerable<string> messages)\",\n    \"3-1\": \"Saves a list of messages for creating individual invoice notes\",\n    \"4-0\": \"AddNote(string message)\",\n    \"4-1\": \"Adds to get associated with the invoice as a note on invoice creation.\",\n    \"5-0\": \"IEnumerable<string> GetNotes()\",\n    \"5-1\": \"Gets any previously added notes.\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CheckoutContext.ChangeSettings.ResetExtendedManagerDataOnVersionChange = true;\",\n      \"language\": \"csharp\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Default context behavior for BasketCheckoutExtendedManager\",\n  \"body\": \"When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutExtendedManager` is to purge any previously saved notes.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ICheckoutOfferManager\"\n}\n[/block]\nICheckoutOfferManager(s) are responsible for temporarily saving, retrieving and applying marketing offers, coupon offers by default, respective to a sale during the course of a checkout workflow.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var checkoutOfferManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Offer;\",\n      \"language\": \"csharp\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"OfferCodes\",\n    \"0-1\": \"Gets the collection of previously saved offer codes.\",\n    \"1-0\": \"RemoveOfferCode(string offerCode)\",\n    \"1-1\": \"Removes an offer code from the OfferCodes collection.\",\n    \"2-0\": \"ClearOfferCodes()\",\n    \"2-1\": \"Clears the offer codes collection\",\n    \"3-0\": \"RedeemCouponOffer(string offerCode)\",\n    \"3-1\": \"Attempts to redeem an offer to the sale.  **Returns** IOfferRedemptionResult<ILineItem> where a successful result containing a discount line item.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CheckoutContext.ChangeSettings.ResetOfferManagerDataOnVersionChange = true;\",\n      \"language\": \"csharp\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Default context behavior for BasketCheckoutOfferManager\",\n  \"body\": \"When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutOfferManager` is to purge any previously saved offer codes.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ICheckoutShippingManager\"\n}\n[/block]\nICheckoutShippingManager(s) are responsible for saving and retrieving shipping rate quotes during the course of a checkout workflow.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var checkoutShippingManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Shipping;\",\n      \"language\": \"csharp\",\n      \"name\": \"BasketCheckoutShippingManager\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"SaveShipmentRateQuote(IShipmentRateQuote approvedShipmentRateQuote)\",\n    \"0-1\": \"Saves a `IShipmentRateQuote` as a shipment line item\",\n    \"1-0\": \"SaveShipmentRateQuote(IEnumerable<IShipmentRateQuote> approvedShipmentRateQuotes)\",\n    \"1-1\": \"Saves a collection of `IShipmentRateQuote`s as shipment line items\",\n    \"2-0\": \"ClearShipmentRateQuotes()\",\n    \"2-1\": \"Clears all `IShipmentRateQuote`s previously saved\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CheckoutContext.ChangeSettings.ResetShippingManagerDataOnVersionChange = true;\",\n      \"language\": \"csharp\",\n      \"name\": \"Default CustomerContext setting\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Default context behavior for BasketCheckoutShippingManager\",\n  \"body\": \"When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutShippingManager` is to purge any previously saved shipping rate quotes.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ICheckoutPaymentManager\"\n}\n[/block]\nICheckoutShippingManager(s) are responsible for saving and retrieving payment methods during the course of a checkout workflow.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"IsReadyToInvoice()\",\n    \"0-1\": \"True/false indicating whether or not the `ICheckoutPaymentManager` is ready to prepare an `IInvoice`\",\n    \"1-0\": \"PrepareInvoice()\",\n    \"1-1\": \"Generates an `IInvoice`\",\n    \"2-0\": \"PrepareInvoice(IBuilderChain<IInvoice> invoiceBuilder)\",\n    \"2-1\": \"Generates an `IInvoice` representing the bill for the current \\\"checkout order\\\"\",\n    \"3-0\": \"ClearPaymentMethod()\",\n    \"3-1\": \"Removes a previously saved payment method\",\n    \"4-0\": \"SavePaymentMethod(IPaymentMethod paymentMethod)\",\n    \"4-1\": \"Saves a `IPaymentMethod`\",\n    \"5-0\": \"GetPaymentGatewayMethods()\",\n    \"5-1\": \"Gets a list of all possible Payment Methods\",\n    \"6-0\": \"GetPaymentMethod()\",\n    \"6-1\": \"Gets the previously saved `IPaymentMethod`\",\n    \"7-0\": \"AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args)\",\n    \"7-1\": \"Attempts to process a payment\",\n    \"8-0\": \"AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod)\",\n    \"8-1\": \"Attempts to process a payment\",\n    \"9-0\": \"AuthorizePayment(Guid paymentMethodKey, ProcessorArgumentCollection args)\",\n    \"9-1\": \"Attempts to process a payment\",\n    \"10-0\": \"AuthorizePayment(Guid paymentMethodKey)\",\n    \"10-1\": \"Attempts to process a payment\",\n    \"11-0\": \"AuthorizeCapturePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args)\",\n    \"11-1\": \"Attempts to Authorize and Capture a Payment\",\n    \"12-0\": \"AuthorizeCapturePayment(IPaymentGatewayMethod paymentGatewayMethod)\",\n    \"12-1\": \"Attempts to Authorize and Capture a Payment\",\n    \"13-0\": \"AuthorizeCapturePayment(Guid paymentMethodKey, ProcessorArgumentCollection args)\",\n    \"14-0\": \"AuthorizeCapturePayment(Guid paymentMethodKey)\",\n    \"13-1\": \"Attempts to Authorize and Capture a Payment\",\n    \"14-1\": \"Attempts to Authorize and Capture a Payment\"\n  },\n  \"cols\": 2,\n  \"rows\": 15\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CheckoutContext.ChangeSettings.ResetPaymentManagerDataOnVersionChange = true;\",\n      \"language\": \"csharp\",\n      \"name\": \"BasketCheckoutPaymentManager\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Default context behavior for BasketCheckoutPaymentManager\",\n  \"body\": \"When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutPaymentManager` is to purge any previously saved payment methods.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Replacing the default CheckoutManager(s)\"\n}\n[/block]\nDevelopers can write their own area managers to augment the default behavior and provide additional application specific functionality by implementing the following \n[block:parameters]\n{\n  \"data\": {\n    \"h-1\": \"Base class\",\n    \"0-1\": \"CheckoutCustomerManagerBase\",\n    \"0-0\": \"Customer\",\n    \"h-0\": \"Checkout area\",\n    \"1-1\": \"CheckoutExtendedManagerBase\",\n    \"1-0\": \"Extended\",\n    \"2-1\": \"CheckoutOfferManagerBase\",\n    \"2-0\": \"Offer\",\n    \"3-1\": \"CheckoutPaymentManagerBase\",\n    \"3-0\": \"Payment\",\n    \"4-1\": \"CheckoutShippingManagerBase\",\n    \"4-0\": \"Shipping\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\nAfter you've created your class, you can then modify the type reference in the `Merchello.config`\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"  <pluggable>\\n    <object alias=\\\"CustomerContext\\\" type=\\\"Merchello.Web.CustomerContext, Merchello.Web\\\" />\\n    <object alias=\\\"BasketCheckoutCustomerManager\\\" type=\\\"Merchello.Web.Workflow.Checkout.BasketCheckoutCustomerManager, Merchello.Web\\\" />\\n    <object alias=\\\"BasketCheckoutOfferManager\\\" type=\\\"Merchello.Web.Workflow.Checkout.BasketCheckoutOfferManager, Merchello.Web\\\" />\\n    <object alias=\\\"BasketCheckoutShippingManager\\\" type=\\\"Merchello.Web.Workflow.Checkout.BasketCheckoutShippingManager, Merchello.Web\\\" />\\n    <object alias=\\\"BasketCheckoutExtendedManager\\\" type=\\\"Merchello.Web.Workflow.Checkout.BasketCheckoutExtendedManager, Merchello.Web\\\" />\\n    <object alias=\\\"BasketCheckoutPaymentManager\\\" type=\\\"Merchello.Web.Workflow.Checkout.BasketCheckoutPaymentManager, Merchello.Web\\\" />\\n  </pluggable>\",\n      \"language\": \"xml\",\n      \"name\": \"merchello.config\"\n    }\n  ]\n}\n[/block]","createdAt":"2015-11-13T18:20:46.144Z","sync_unique":"","user":"564136b9f424a10d001181e1","updates":[],"slug":"checkoutmanager","type":"basic","title":"ICheckoutManagerBase (Checkout)","__v":0,"version":"56b92afe08d8b20d00bc3afd","link_url":"","hidden":false,"order":29,"project":"56421bcdb48bdf19006a4c97","githubsync":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"childrenPages":[]}

ICheckoutManagerBase (Checkout)


`CheckoutManagers` are used to manage the most aspects of the checkout workflow. Merchello's default CheckoutManager is the `BasketCheckoutManager` which is intended to be used for basket checkout outs. [block:callout] { "type": "warning", "title": "CheckoutManager supersede the SalePreparation in earlier versions.", "body": "Prior to Merchello 1.14.0, the SalePreparation class was used to manage the checkout workflow." } [/block] The CheckoutManager breaks down the checkout workflow into several logical areas which can be seen in the `ICheckoutManagerBase` interface. Each area is managed by a specific lazy loaded area checkout manager. [block:code] { "codes": [ { "code": " /// <summary>\n /// Defines the base checkout workflow.\n /// </summary>\n public interface ICheckoutManagerBase : ICheckoutContextManagerBase\n {\n /// <summary>\n /// Gets the checkout manager for customer information.\n /// </summary>\n ICheckoutCustomerManager Customer { get; }\n\n /// <summary>\n /// Gets the checkout extended manager for custom invoicing.\n /// </summary>\n ICheckoutExtendedManager Extended { get; }\n\n /// <summary>\n /// Gets the checkout manager for marketing offers.\n /// </summary>\n ICheckoutOfferManager Offer { get; }\n\n /// <summary>\n /// Gets the checkout manager for shipping.\n /// </summary>\n ICheckoutShippingManager Shipping { get; }\n\n /// <summary>\n /// Gets the payment.\n /// </summary>\n ICheckoutPaymentManager Payment { get; }\n }", "language": "csharp", "name": "ICheckoutManagerBase" } ] } [/block] Contextual information is shared between the managers via a [CheckoutContext](doc:checkoutcontext) . [block:code] { "codes": [ { "code": "\n// IBasket extension method\nvar checkoutManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]);", "language": "csharp", "name": "Instantiating the BasketCheckoutManager" } ] } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutCustomerManager" } [/block] ICheckoutCustomerManager(s) are responsible for temporarily saving and retrieving previously saved customer information during the course of a checkout workflow. [block:code] { "codes": [ { "code": "\n// ICheckoutCustomerManager of type BasketCheckoutCustomerManager\nvar customerManager = CurrentCustomer.Basket().GetCheckoutManager().Customer;", "language": "csharp", "name": "BasketCheckoutCustomerManager" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "SaveBillToAddress(IAddress billToAddress)", "0-1": "Saves the bill to address", "1-0": "SaveShipToAddress(IAddress shipToAddress)", "1-1": "Saves the ship to address", "2-1": "Gets the bill to address", "2-0": "IAddress GetBillToAddress()", "3-0": "IAddress GetShipToAddress()", "3-1": "Gets the bill to address" }, "cols": 2, "rows": 4 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetCustomerManagerDataOnVersionChange = true;", "language": "csharp", "name": "Default CheckoutContext setting" } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutCustomerManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutCustomerManager` is to purge any previously saved billing and shipping addresses." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutExtendedManager" } [/block] ICheckoutExtendedManager(s) are responsible for handling optional bits of a checkout workflow, such as adding custom line items and adding notes to an invoice. [block:code] { "codes": [ { "code": "var checkoutExtendedManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Extended;", "language": "csharp", "name": "BasketCheckoutExtendedManager" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddItem(ILineItem lineItem)", "0-1": "Adds a <see cref=\"ILineItem\"/> to the collection of items. *Intended for custom line item types.*", "1-0": "RemoveItem(ILineItem lineItem)", "1-1": "Removes a line item from the collection of items. *The line item to be removed.*", "2-0": "ClearNotes()", "2-1": "Clears all notes", "3-0": "SaveNotes(IEnumerable<string> messages)", "3-1": "Saves a list of messages for creating individual invoice notes", "4-0": "AddNote(string message)", "4-1": "Adds to get associated with the invoice as a note on invoice creation.", "5-0": "IEnumerable<string> GetNotes()", "5-1": "Gets any previously added notes." }, "cols": 2, "rows": 6 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetExtendedManagerDataOnVersionChange = true;", "language": "csharp", "name": null } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutExtendedManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutExtendedManager` is to purge any previously saved notes." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutOfferManager" } [/block] ICheckoutOfferManager(s) are responsible for temporarily saving, retrieving and applying marketing offers, coupon offers by default, respective to a sale during the course of a checkout workflow. [block:code] { "codes": [ { "code": "var checkoutOfferManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Offer;", "language": "csharp", "name": null } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "OfferCodes", "0-1": "Gets the collection of previously saved offer codes.", "1-0": "RemoveOfferCode(string offerCode)", "1-1": "Removes an offer code from the OfferCodes collection.", "2-0": "ClearOfferCodes()", "2-1": "Clears the offer codes collection", "3-0": "RedeemCouponOffer(string offerCode)", "3-1": "Attempts to redeem an offer to the sale. **Returns** IOfferRedemptionResult<ILineItem> where a successful result containing a discount line item." }, "cols": 2, "rows": 4 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetOfferManagerDataOnVersionChange = true;", "language": "csharp", "name": null } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutOfferManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutOfferManager` is to purge any previously saved offer codes." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutShippingManager" } [/block] ICheckoutShippingManager(s) are responsible for saving and retrieving shipping rate quotes during the course of a checkout workflow. [block:code] { "codes": [ { "code": "var checkoutShippingManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Shipping;", "language": "csharp", "name": "BasketCheckoutShippingManager" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "SaveShipmentRateQuote(IShipmentRateQuote approvedShipmentRateQuote)", "0-1": "Saves a `IShipmentRateQuote` as a shipment line item", "1-0": "SaveShipmentRateQuote(IEnumerable<IShipmentRateQuote> approvedShipmentRateQuotes)", "1-1": "Saves a collection of `IShipmentRateQuote`s as shipment line items", "2-0": "ClearShipmentRateQuotes()", "2-1": "Clears all `IShipmentRateQuote`s previously saved" }, "cols": 2, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetShippingManagerDataOnVersionChange = true;", "language": "csharp", "name": "Default CustomerContext setting" } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutShippingManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutShippingManager` is to purge any previously saved shipping rate quotes." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutPaymentManager" } [/block] ICheckoutShippingManager(s) are responsible for saving and retrieving payment methods during the course of a checkout workflow. [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "IsReadyToInvoice()", "0-1": "True/false indicating whether or not the `ICheckoutPaymentManager` is ready to prepare an `IInvoice`", "1-0": "PrepareInvoice()", "1-1": "Generates an `IInvoice`", "2-0": "PrepareInvoice(IBuilderChain<IInvoice> invoiceBuilder)", "2-1": "Generates an `IInvoice` representing the bill for the current \"checkout order\"", "3-0": "ClearPaymentMethod()", "3-1": "Removes a previously saved payment method", "4-0": "SavePaymentMethod(IPaymentMethod paymentMethod)", "4-1": "Saves a `IPaymentMethod`", "5-0": "GetPaymentGatewayMethods()", "5-1": "Gets a list of all possible Payment Methods", "6-0": "GetPaymentMethod()", "6-1": "Gets the previously saved `IPaymentMethod`", "7-0": "AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args)", "7-1": "Attempts to process a payment", "8-0": "AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod)", "8-1": "Attempts to process a payment", "9-0": "AuthorizePayment(Guid paymentMethodKey, ProcessorArgumentCollection args)", "9-1": "Attempts to process a payment", "10-0": "AuthorizePayment(Guid paymentMethodKey)", "10-1": "Attempts to process a payment", "11-0": "AuthorizeCapturePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args)", "11-1": "Attempts to Authorize and Capture a Payment", "12-0": "AuthorizeCapturePayment(IPaymentGatewayMethod paymentGatewayMethod)", "12-1": "Attempts to Authorize and Capture a Payment", "13-0": "AuthorizeCapturePayment(Guid paymentMethodKey, ProcessorArgumentCollection args)", "14-0": "AuthorizeCapturePayment(Guid paymentMethodKey)", "13-1": "Attempts to Authorize and Capture a Payment", "14-1": "Attempts to Authorize and Capture a Payment" }, "cols": 2, "rows": 15 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetPaymentManagerDataOnVersionChange = true;", "language": "csharp", "name": "BasketCheckoutPaymentManager" } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutPaymentManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutPaymentManager` is to purge any previously saved payment methods." } [/block] [block:api-header] { "type": "basic", "title": "Replacing the default CheckoutManager(s)" } [/block] Developers can write their own area managers to augment the default behavior and provide additional application specific functionality by implementing the following [block:parameters] { "data": { "h-1": "Base class", "0-1": "CheckoutCustomerManagerBase", "0-0": "Customer", "h-0": "Checkout area", "1-1": "CheckoutExtendedManagerBase", "1-0": "Extended", "2-1": "CheckoutOfferManagerBase", "2-0": "Offer", "3-1": "CheckoutPaymentManagerBase", "3-0": "Payment", "4-1": "CheckoutShippingManagerBase", "4-0": "Shipping" }, "cols": 2, "rows": 5 } [/block] After you've created your class, you can then modify the type reference in the `Merchello.config` [block:code] { "codes": [ { "code": " <pluggable>\n <object alias=\"CustomerContext\" type=\"Merchello.Web.CustomerContext, Merchello.Web\" />\n <object alias=\"BasketCheckoutCustomerManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutCustomerManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutOfferManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutOfferManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutShippingManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutShippingManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutExtendedManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutExtendedManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutPaymentManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutPaymentManager, Merchello.Web\" />\n </pluggable>", "language": "xml", "name": "merchello.config" } ] } [/block]
`CheckoutManagers` are used to manage the most aspects of the checkout workflow. Merchello's default CheckoutManager is the `BasketCheckoutManager` which is intended to be used for basket checkout outs. [block:callout] { "type": "warning", "title": "CheckoutManager supersede the SalePreparation in earlier versions.", "body": "Prior to Merchello 1.14.0, the SalePreparation class was used to manage the checkout workflow." } [/block] The CheckoutManager breaks down the checkout workflow into several logical areas which can be seen in the `ICheckoutManagerBase` interface. Each area is managed by a specific lazy loaded area checkout manager. [block:code] { "codes": [ { "code": " /// <summary>\n /// Defines the base checkout workflow.\n /// </summary>\n public interface ICheckoutManagerBase : ICheckoutContextManagerBase\n {\n /// <summary>\n /// Gets the checkout manager for customer information.\n /// </summary>\n ICheckoutCustomerManager Customer { get; }\n\n /// <summary>\n /// Gets the checkout extended manager for custom invoicing.\n /// </summary>\n ICheckoutExtendedManager Extended { get; }\n\n /// <summary>\n /// Gets the checkout manager for marketing offers.\n /// </summary>\n ICheckoutOfferManager Offer { get; }\n\n /// <summary>\n /// Gets the checkout manager for shipping.\n /// </summary>\n ICheckoutShippingManager Shipping { get; }\n\n /// <summary>\n /// Gets the payment.\n /// </summary>\n ICheckoutPaymentManager Payment { get; }\n }", "language": "csharp", "name": "ICheckoutManagerBase" } ] } [/block] Contextual information is shared between the managers via a [CheckoutContext](doc:checkoutcontext) . [block:code] { "codes": [ { "code": "\n// IBasket extension method\nvar checkoutManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]);", "language": "csharp", "name": "Instantiating the BasketCheckoutManager" } ] } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutCustomerManager" } [/block] ICheckoutCustomerManager(s) are responsible for temporarily saving and retrieving previously saved customer information during the course of a checkout workflow. [block:code] { "codes": [ { "code": "\n// ICheckoutCustomerManager of type BasketCheckoutCustomerManager\nvar customerManager = CurrentCustomer.Basket().GetCheckoutManager().Customer;", "language": "csharp", "name": "BasketCheckoutCustomerManager" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "SaveBillToAddress(IAddress billToAddress)", "0-1": "Saves the bill to address", "1-0": "SaveShipToAddress(IAddress shipToAddress)", "1-1": "Saves the ship to address", "2-1": "Gets the bill to address", "2-0": "IAddress GetBillToAddress()", "3-0": "IAddress GetShipToAddress()", "3-1": "Gets the bill to address" }, "cols": 2, "rows": 4 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetCustomerManagerDataOnVersionChange = true;", "language": "csharp", "name": "Default CheckoutContext setting" } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutCustomerManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutCustomerManager` is to purge any previously saved billing and shipping addresses." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutExtendedManager" } [/block] ICheckoutExtendedManager(s) are responsible for handling optional bits of a checkout workflow, such as adding custom line items and adding notes to an invoice. [block:code] { "codes": [ { "code": "var checkoutExtendedManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Extended;", "language": "csharp", "name": "BasketCheckoutExtendedManager" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddItem(ILineItem lineItem)", "0-1": "Adds a <see cref=\"ILineItem\"/> to the collection of items. *Intended for custom line item types.*", "1-0": "RemoveItem(ILineItem lineItem)", "1-1": "Removes a line item from the collection of items. *The line item to be removed.*", "2-0": "ClearNotes()", "2-1": "Clears all notes", "3-0": "SaveNotes(IEnumerable<string> messages)", "3-1": "Saves a list of messages for creating individual invoice notes", "4-0": "AddNote(string message)", "4-1": "Adds to get associated with the invoice as a note on invoice creation.", "5-0": "IEnumerable<string> GetNotes()", "5-1": "Gets any previously added notes." }, "cols": 2, "rows": 6 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetExtendedManagerDataOnVersionChange = true;", "language": "csharp", "name": null } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutExtendedManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutExtendedManager` is to purge any previously saved notes." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutOfferManager" } [/block] ICheckoutOfferManager(s) are responsible for temporarily saving, retrieving and applying marketing offers, coupon offers by default, respective to a sale during the course of a checkout workflow. [block:code] { "codes": [ { "code": "var checkoutOfferManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Offer;", "language": "csharp", "name": null } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "OfferCodes", "0-1": "Gets the collection of previously saved offer codes.", "1-0": "RemoveOfferCode(string offerCode)", "1-1": "Removes an offer code from the OfferCodes collection.", "2-0": "ClearOfferCodes()", "2-1": "Clears the offer codes collection", "3-0": "RedeemCouponOffer(string offerCode)", "3-1": "Attempts to redeem an offer to the sale. **Returns** IOfferRedemptionResult<ILineItem> where a successful result containing a discount line item." }, "cols": 2, "rows": 4 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetOfferManagerDataOnVersionChange = true;", "language": "csharp", "name": null } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutOfferManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutOfferManager` is to purge any previously saved offer codes." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutShippingManager" } [/block] ICheckoutShippingManager(s) are responsible for saving and retrieving shipping rate quotes during the course of a checkout workflow. [block:code] { "codes": [ { "code": "var checkoutShippingManager = CurrentCustomer.Basket().GetCheckoutManager([optional settings]).Shipping;", "language": "csharp", "name": "BasketCheckoutShippingManager" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "SaveShipmentRateQuote(IShipmentRateQuote approvedShipmentRateQuote)", "0-1": "Saves a `IShipmentRateQuote` as a shipment line item", "1-0": "SaveShipmentRateQuote(IEnumerable<IShipmentRateQuote> approvedShipmentRateQuotes)", "1-1": "Saves a collection of `IShipmentRateQuote`s as shipment line items", "2-0": "ClearShipmentRateQuotes()", "2-1": "Clears all `IShipmentRateQuote`s previously saved" }, "cols": 2, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetShippingManagerDataOnVersionChange = true;", "language": "csharp", "name": "Default CustomerContext setting" } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutShippingManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutShippingManager` is to purge any previously saved shipping rate quotes." } [/block] [block:api-header] { "type": "basic", "title": "ICheckoutPaymentManager" } [/block] ICheckoutShippingManager(s) are responsible for saving and retrieving payment methods during the course of a checkout workflow. [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "IsReadyToInvoice()", "0-1": "True/false indicating whether or not the `ICheckoutPaymentManager` is ready to prepare an `IInvoice`", "1-0": "PrepareInvoice()", "1-1": "Generates an `IInvoice`", "2-0": "PrepareInvoice(IBuilderChain<IInvoice> invoiceBuilder)", "2-1": "Generates an `IInvoice` representing the bill for the current \"checkout order\"", "3-0": "ClearPaymentMethod()", "3-1": "Removes a previously saved payment method", "4-0": "SavePaymentMethod(IPaymentMethod paymentMethod)", "4-1": "Saves a `IPaymentMethod`", "5-0": "GetPaymentGatewayMethods()", "5-1": "Gets a list of all possible Payment Methods", "6-0": "GetPaymentMethod()", "6-1": "Gets the previously saved `IPaymentMethod`", "7-0": "AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args)", "7-1": "Attempts to process a payment", "8-0": "AuthorizePayment(IPaymentGatewayMethod paymentGatewayMethod)", "8-1": "Attempts to process a payment", "9-0": "AuthorizePayment(Guid paymentMethodKey, ProcessorArgumentCollection args)", "9-1": "Attempts to process a payment", "10-0": "AuthorizePayment(Guid paymentMethodKey)", "10-1": "Attempts to process a payment", "11-0": "AuthorizeCapturePayment(IPaymentGatewayMethod paymentGatewayMethod, ProcessorArgumentCollection args)", "11-1": "Attempts to Authorize and Capture a Payment", "12-0": "AuthorizeCapturePayment(IPaymentGatewayMethod paymentGatewayMethod)", "12-1": "Attempts to Authorize and Capture a Payment", "13-0": "AuthorizeCapturePayment(Guid paymentMethodKey, ProcessorArgumentCollection args)", "14-0": "AuthorizeCapturePayment(Guid paymentMethodKey)", "13-1": "Attempts to Authorize and Capture a Payment", "14-1": "Attempts to Authorize and Capture a Payment" }, "cols": 2, "rows": 15 } [/block] [block:code] { "codes": [ { "code": "CheckoutContext.ChangeSettings.ResetPaymentManagerDataOnVersionChange = true;", "language": "csharp", "name": "BasketCheckoutPaymentManager" } ] } [/block] [block:callout] { "type": "info", "title": "Default context behavior for BasketCheckoutPaymentManager", "body": "When the `CheckoutContext` resets to a new version, the default behavior for the `BasketCheckoutPaymentManager` is to purge any previously saved payment methods." } [/block] [block:api-header] { "type": "basic", "title": "Replacing the default CheckoutManager(s)" } [/block] Developers can write their own area managers to augment the default behavior and provide additional application specific functionality by implementing the following [block:parameters] { "data": { "h-1": "Base class", "0-1": "CheckoutCustomerManagerBase", "0-0": "Customer", "h-0": "Checkout area", "1-1": "CheckoutExtendedManagerBase", "1-0": "Extended", "2-1": "CheckoutOfferManagerBase", "2-0": "Offer", "3-1": "CheckoutPaymentManagerBase", "3-0": "Payment", "4-1": "CheckoutShippingManagerBase", "4-0": "Shipping" }, "cols": 2, "rows": 5 } [/block] After you've created your class, you can then modify the type reference in the `Merchello.config` [block:code] { "codes": [ { "code": " <pluggable>\n <object alias=\"CustomerContext\" type=\"Merchello.Web.CustomerContext, Merchello.Web\" />\n <object alias=\"BasketCheckoutCustomerManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutCustomerManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutOfferManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutOfferManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutShippingManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutShippingManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutExtendedManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutExtendedManager, Merchello.Web\" />\n <object alias=\"BasketCheckoutPaymentManager\" type=\"Merchello.Web.Workflow.Checkout.BasketCheckoutPaymentManager, Merchello.Web\" />\n </pluggable>", "language": "xml", "name": "merchello.config" } ] } [/block]
{"_id":"56b92b0308d8b20d00bc3b24","title":"MerchelloHelper","category":"56b92aff08d8b20d00bc3b07","version":"56b92afe08d8b20d00bc3afd","link_external":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"sync_unique":"","hidden":false,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// new instance of the MerchelloHelper with data modifiers enabled\\nvar merchello = new MerchelloHelper();\\n\\n// new instance of the MerchelloHelper without data modifiers enabled\\nvar merchello = new MerchelloHelper(false);\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Query\",\n    \"0-1\": \"Gets an instance of the ICachedQueryProvider\",\n    \"1-0\": \"Validation\",\n    \"1-1\": \"Gets an instance of the [IValidationHelper](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Web/Validation/IValidatationHelper.cs)\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ICachedQueryProvider Properties\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Examine backed queries\",\n  \"body\": \"Generally speaking CachedQueryProviders in Merchello have to workflows.\\n\\n1) 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.\\n\\n2) Queries that return a collection, like Search( ... ) will first query the database for a Page<GUID> which then searches the Examine index using the GetByKey method described above.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Query.Customer Methods\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" var merchello = new MerchelloHelper();\\n\\nvar customerQuery = merchello.Query.Customer;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GetByKey\",\n    \"0-1\": \"Gets an CustomerDisplay by it's key\",\n    \"1-0\": \"GetFromCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"2-0\": \"GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"3-0\": \"GetNotInCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"4-0\": \"GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"5-0\": \"Search(Int64, Int64, String, SortDirection)\",\n    \"6-0\": \"Search(String, Int64, Int64, String, SortDirection)\",\n    \"7-0\": \"Search(DateTime, DateTime, Int64, Int64, String, SortDirection)\",\n    \"7-1\": \"Searches customers that have customer dates within a specified date range.  Returns QueryResultDisplay<CustomerDisplay>\",\n    \"6-1\": \"Searches all customers filtered by a search term.  Returns QueryResultDisplay<CustomerDisplay>\",\n    \"5-1\": \"Searches all customers. Returns QueryResultDisplay<CustomerDisplay>\",\n    \"4-1\": \"Gets customers not in the collection filtered by a search term.  Returns QueryResultDisplay<CustomerDisplay>\",\n    \"3-1\": \"Gets customers not in the collection.  Returns QueryResultDisplay<CustomerDisplay>\",\n    \"2-1\": \"Gets customers in the collection filtered by a search term.  Returns QueryResultDisplay<CustomerDisplay>\",\n    \"1-1\": \"Gets customers from a collection.  Returns QueryResultDisplay<CustomerDisplay>\"\n  },\n  \"cols\": 2,\n  \"rows\": 8\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Query.Invoice Methods\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \" var merchello = new MerchelloHelper();\\n\\nvar invoiceQuery = merchello.Query.Invoice;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GetByCustomerKey\",\n    \"1-0\": \"GetByKey\",\n    \"2-0\": \"GetFromCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"3-0\": \"GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"4-0\": \"GetNotInCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"5-0\": \"GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"6-0\": \"Search(Int64, Int64, String, SortDirection)\",\n    \"7-0\": \"Search(String, Int64, Int64, String, SortDirection)\",\n    \"8-0\": \"Search(DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)\",\n    \"9-0\": \"Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection, Boolean)\",\n    \"10-0\": \"Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection, Boolean)\",\n    \"11-0\": \"Search(String, DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)\",\n    \"12-0\": \"Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection, Boolean)\",\n    \"13-0\": \"SearchByCustomer(Guid, Int64, Int64, String, SortDirection)\",\n    \"14-0\": \"SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)\",\n    \"15-0\": \"SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)\",\n    \"16-0\": \"SearchByInvoiceStatus(Guid, Boolean, Int64, Int64, String, SortDirection)\",\n    \"16-1\": \"Searches for invoices by invoice status and exported value\",\n    \"15-1\": \"Searches for invoices by invoice status.\",\n    \"14-1\": \"Searches for invoices associated with a customer and invoice status\",\n    \"13-1\": \"Searches for invoices associated with a customer\",\n    \"12-1\": \"Searches invoices that have invoice dates within a specified date range with a particular invoice status and export value\",\n    \"11-1\": \"Searches invoices that have invoice dates within a specified date range and a specific term\",\n    \"10-1\": \"Searches invoices that have invoice dates within a specified date range with a particular invoice status\",\n    \"9-1\": \"Searches invoices that have invoice dates within a specified date range with an export value\",\n    \"8-1\": \"Searches invoices that have invoice dates within a specified date range\",\n    \"7-1\": \"Searches all invoices by a term\",\n    \"6-1\": \"Searches all invoices\",\n    \"5-1\": \"Gets entities not in the collection filtered by a search term.\",\n    \"4-1\": \"Gets entities not in the collection.\",\n    \"3-1\": \"Gets entities in the collection filtered by a search term\",\n    \"2-1\": \"Gets entities from a collection.\",\n    \"1-1\": \"Gets an InvoiceDisplay by it's key\",\n    \"0-1\": \"Gets the collection of all customer invoices\"\n  },\n  \"cols\": 2,\n  \"rows\": 17\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Query.Order Methods\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var merchello = new MerchelloHelper();\\n\\nvar orderQuery = merchello.Query.Order;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GetByInvoiceKey\",\n    \"1-0\": \"GetByInvoiceKey\",\n    \"2-0\": \"Search(Int64, Int64, String, SortDirection)\",\n    \"3-0\": \"Search(DateTime, DateTime, Int64, Int64, String, SortDirection)\",\n    \"4-0\": \"Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection)\",\n    \"5-0\": \"Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection)\",\n    \"6-0\": \"Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection)\",\n    \"7-0\": \"SearchByOrderStatus(Guid, Int64, Int64, String, SortDirection)\",\n    \"8-0\": \"SearchByOrderStatus(Guid, Boolean, Int64, Int64, String, SortDirection)\",\n    \"8-1\": \"Searches for orders by order status and exported value\",\n    \"7-1\": \"Searches for orders by order status.\",\n    \"6-1\": \"Searches orders that have order dates within a specified date range with a particular order status and export value\",\n    \"5-1\": \"Searches order that have order dates within a specified date range with a particular order status\",\n    \"4-1\": \"Searches orders that have order dates within a specified date range with an export value\",\n    \"3-1\": \"Searches orders that have order dates within a specified date range\",\n    \"2-1\": \"Searches all orders\",\n    \"1-1\": \"Gets an OrderDisplay by it's key.\",\n    \"0-1\": \"Gets a collection of orders by the invoice key.\"\n  },\n  \"cols\": 2,\n  \"rows\": 9\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Query.Product Methods\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"// with data modifiers\\nvar merchello = new MerchelloHelper();\\n\\n// or \\n\\n// without data modifiers\\nvar merchello = new MerchelloHelper(false);\\n\\nvar productQuery = merchello.Query.Product;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\"\n  },\n  \"cols\": 2,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"TypedProductContent(string key)\",\n    \"1-0\": \"TypedProductContent(Guid key)\",\n    \"2-0\": \"TypedProductContentBySlug(string slug)\",\n    \"3-0\": \"TypeProductContentBySku(string sku)\",\n    \"4-0\": \"TypedProductContentFromCollection(Guid collectionKey)\",\n    \"6-0\": \"GetValidProductVariants(Guid productKey, Guid[] attributeKeys)\",\n    \"6-1\": \"Gets a list of valid variants based on partial attribute selection\",\n    \"5-0\": \"GetProductVariantWithAttributes(Guid productKey, Guid[] attributeKeys)\",\n    \"5-1\": \"Get a product variant from a product by it's collection of attributes\",\n    \"4-1\": \"Gets a collection IProductContent from a product collection.\",\n    \"3-1\": \"Gets IProductContent by sku\",\n    \"2-1\": \"Gets IProductContent by it's slug\",\n    \"1-1\": \"Gets IProductContent by it's unique key\",\n    \"0-1\": \"Gets IProductContent by it's unique key (as string)\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]","excerpt":"","updates":[],"link_url":"","githubsync":"","type":"basic","createdAt":"2015-11-10T20:15:00.294Z","__v":0,"project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","order":30,"slug":"merchellohelper","childrenPages":[]}

MerchelloHelper


[block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "// new instance of the MerchelloHelper with data modifiers enabled\nvar merchello = new MerchelloHelper();\n\n// new instance of the MerchelloHelper without data modifiers enabled\nvar merchello = new MerchelloHelper(false);", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Query", "0-1": "Gets an instance of the ICachedQueryProvider", "1-0": "Validation", "1-1": "Gets an instance of the [IValidationHelper](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Web/Validation/IValidatationHelper.cs)" }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "ICachedQueryProvider Properties" } [/block] [block:callout] { "type": "info", "title": "Examine backed queries", "body": "Generally speaking CachedQueryProviders in Merchello have to workflows.\n\n1) 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.\n\n2) Queries that return a collection, like Search( ... ) will first query the database for a Page<GUID> which then searches the Examine index using the GetByKey method described above." } [/block] [block:api-header] { "type": "basic", "title": "Query.Customer Methods" } [/block] [block:code] { "codes": [ { "code": " var merchello = new MerchelloHelper();\n\nvar customerQuery = merchello.Query.Customer;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetByKey", "0-1": "Gets an CustomerDisplay by it's key", "1-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "2-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "3-0": "GetNotInCollection(Guid, Int64, Int64, String, SortDirection)", "4-0": "GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)", "5-0": "Search(Int64, Int64, String, SortDirection)", "6-0": "Search(String, Int64, Int64, String, SortDirection)", "7-0": "Search(DateTime, DateTime, Int64, Int64, String, SortDirection)", "7-1": "Searches customers that have customer dates within a specified date range. Returns QueryResultDisplay<CustomerDisplay>", "6-1": "Searches all customers filtered by a search term. Returns QueryResultDisplay<CustomerDisplay>", "5-1": "Searches all customers. Returns QueryResultDisplay<CustomerDisplay>", "4-1": "Gets customers not in the collection filtered by a search term. Returns QueryResultDisplay<CustomerDisplay>", "3-1": "Gets customers not in the collection. Returns QueryResultDisplay<CustomerDisplay>", "2-1": "Gets customers in the collection filtered by a search term. Returns QueryResultDisplay<CustomerDisplay>", "1-1": "Gets customers from a collection. Returns QueryResultDisplay<CustomerDisplay>" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Query.Invoice Methods" } [/block] [block:code] { "codes": [ { "code": " var merchello = new MerchelloHelper();\n\nvar invoiceQuery = merchello.Query.Invoice;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetByCustomerKey", "1-0": "GetByKey", "2-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "3-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "4-0": "GetNotInCollection(Guid, Int64, Int64, String, SortDirection)", "5-0": "GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)", "6-0": "Search(Int64, Int64, String, SortDirection)", "7-0": "Search(String, Int64, Int64, String, SortDirection)", "8-0": "Search(DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)", "9-0": "Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection, Boolean)", "10-0": "Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection, Boolean)", "11-0": "Search(String, DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)", "12-0": "Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection, Boolean)", "13-0": "SearchByCustomer(Guid, Int64, Int64, String, SortDirection)", "14-0": "SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)", "15-0": "SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)", "16-0": "SearchByInvoiceStatus(Guid, Boolean, Int64, Int64, String, SortDirection)", "16-1": "Searches for invoices by invoice status and exported value", "15-1": "Searches for invoices by invoice status.", "14-1": "Searches for invoices associated with a customer and invoice status", "13-1": "Searches for invoices associated with a customer", "12-1": "Searches invoices that have invoice dates within a specified date range with a particular invoice status and export value", "11-1": "Searches invoices that have invoice dates within a specified date range and a specific term", "10-1": "Searches invoices that have invoice dates within a specified date range with a particular invoice status", "9-1": "Searches invoices that have invoice dates within a specified date range with an export value", "8-1": "Searches invoices that have invoice dates within a specified date range", "7-1": "Searches all invoices by a term", "6-1": "Searches all invoices", "5-1": "Gets entities not in the collection filtered by a search term.", "4-1": "Gets entities not in the collection.", "3-1": "Gets entities in the collection filtered by a search term", "2-1": "Gets entities from a collection.", "1-1": "Gets an InvoiceDisplay by it's key", "0-1": "Gets the collection of all customer invoices" }, "cols": 2, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Query.Order Methods" } [/block] [block:code] { "codes": [ { "code": "var merchello = new MerchelloHelper();\n\nvar orderQuery = merchello.Query.Order;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetByInvoiceKey", "1-0": "GetByInvoiceKey", "2-0": "Search(Int64, Int64, String, SortDirection)", "3-0": "Search(DateTime, DateTime, Int64, Int64, String, SortDirection)", "4-0": "Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection)", "5-0": "Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection)", "6-0": "Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection)", "7-0": "SearchByOrderStatus(Guid, Int64, Int64, String, SortDirection)", "8-0": "SearchByOrderStatus(Guid, Boolean, Int64, Int64, String, SortDirection)", "8-1": "Searches for orders by order status and exported value", "7-1": "Searches for orders by order status.", "6-1": "Searches orders that have order dates within a specified date range with a particular order status and export value", "5-1": "Searches order that have order dates within a specified date range with a particular order status", "4-1": "Searches orders that have order dates within a specified date range with an export value", "3-1": "Searches orders that have order dates within a specified date range", "2-1": "Searches all orders", "1-1": "Gets an OrderDisplay by it's key.", "0-1": "Gets a collection of orders by the invoice key." }, "cols": 2, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Query.Product Methods" } [/block] [block:code] { "codes": [ { "code": "// with data modifiers\nvar merchello = new MerchelloHelper();\n\n// or \n\n// without data modifiers\nvar merchello = new MerchelloHelper(false);\n\nvar productQuery = merchello.Query.Product;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description" }, "cols": 2, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "0-0": "TypedProductContent(string key)", "1-0": "TypedProductContent(Guid key)", "2-0": "TypedProductContentBySlug(string slug)", "3-0": "TypeProductContentBySku(string sku)", "4-0": "TypedProductContentFromCollection(Guid collectionKey)", "6-0": "GetValidProductVariants(Guid productKey, Guid[] attributeKeys)", "6-1": "Gets a list of valid variants based on partial attribute selection", "5-0": "GetProductVariantWithAttributes(Guid productKey, Guid[] attributeKeys)", "5-1": "Get a product variant from a product by it's collection of attributes", "4-1": "Gets a collection IProductContent from a product collection.", "3-1": "Gets IProductContent by sku", "2-1": "Gets IProductContent by it's slug", "1-1": "Gets IProductContent by it's unique key", "0-1": "Gets IProductContent by it's unique key (as string)" }, "cols": 2, "rows": 7 } [/block]
[block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "// new instance of the MerchelloHelper with data modifiers enabled\nvar merchello = new MerchelloHelper();\n\n// new instance of the MerchelloHelper without data modifiers enabled\nvar merchello = new MerchelloHelper(false);", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Query", "0-1": "Gets an instance of the ICachedQueryProvider", "1-0": "Validation", "1-1": "Gets an instance of the [IValidationHelper](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Web/Validation/IValidatationHelper.cs)" }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "ICachedQueryProvider Properties" } [/block] [block:callout] { "type": "info", "title": "Examine backed queries", "body": "Generally speaking CachedQueryProviders in Merchello have to workflows.\n\n1) 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.\n\n2) Queries that return a collection, like Search( ... ) will first query the database for a Page<GUID> which then searches the Examine index using the GetByKey method described above." } [/block] [block:api-header] { "type": "basic", "title": "Query.Customer Methods" } [/block] [block:code] { "codes": [ { "code": " var merchello = new MerchelloHelper();\n\nvar customerQuery = merchello.Query.Customer;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetByKey", "0-1": "Gets an CustomerDisplay by it's key", "1-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "2-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "3-0": "GetNotInCollection(Guid, Int64, Int64, String, SortDirection)", "4-0": "GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)", "5-0": "Search(Int64, Int64, String, SortDirection)", "6-0": "Search(String, Int64, Int64, String, SortDirection)", "7-0": "Search(DateTime, DateTime, Int64, Int64, String, SortDirection)", "7-1": "Searches customers that have customer dates within a specified date range. Returns QueryResultDisplay<CustomerDisplay>", "6-1": "Searches all customers filtered by a search term. Returns QueryResultDisplay<CustomerDisplay>", "5-1": "Searches all customers. Returns QueryResultDisplay<CustomerDisplay>", "4-1": "Gets customers not in the collection filtered by a search term. Returns QueryResultDisplay<CustomerDisplay>", "3-1": "Gets customers not in the collection. Returns QueryResultDisplay<CustomerDisplay>", "2-1": "Gets customers in the collection filtered by a search term. Returns QueryResultDisplay<CustomerDisplay>", "1-1": "Gets customers from a collection. Returns QueryResultDisplay<CustomerDisplay>" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Query.Invoice Methods" } [/block] [block:code] { "codes": [ { "code": " var merchello = new MerchelloHelper();\n\nvar invoiceQuery = merchello.Query.Invoice;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetByCustomerKey", "1-0": "GetByKey", "2-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "3-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "4-0": "GetNotInCollection(Guid, Int64, Int64, String, SortDirection)", "5-0": "GetNotInCollection(Guid, String, Int64, Int64, String, SortDirection)", "6-0": "Search(Int64, Int64, String, SortDirection)", "7-0": "Search(String, Int64, Int64, String, SortDirection)", "8-0": "Search(DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)", "9-0": "Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection, Boolean)", "10-0": "Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection, Boolean)", "11-0": "Search(String, DateTime, DateTime, Int64, Int64, String, SortDirection, Boolean)", "12-0": "Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection, Boolean)", "13-0": "SearchByCustomer(Guid, Int64, Int64, String, SortDirection)", "14-0": "SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)", "15-0": "SearchByCustomer(Guid, Guid, Int64, Int64, String, SortDirection)", "16-0": "SearchByInvoiceStatus(Guid, Boolean, Int64, Int64, String, SortDirection)", "16-1": "Searches for invoices by invoice status and exported value", "15-1": "Searches for invoices by invoice status.", "14-1": "Searches for invoices associated with a customer and invoice status", "13-1": "Searches for invoices associated with a customer", "12-1": "Searches invoices that have invoice dates within a specified date range with a particular invoice status and export value", "11-1": "Searches invoices that have invoice dates within a specified date range and a specific term", "10-1": "Searches invoices that have invoice dates within a specified date range with a particular invoice status", "9-1": "Searches invoices that have invoice dates within a specified date range with an export value", "8-1": "Searches invoices that have invoice dates within a specified date range", "7-1": "Searches all invoices by a term", "6-1": "Searches all invoices", "5-1": "Gets entities not in the collection filtered by a search term.", "4-1": "Gets entities not in the collection.", "3-1": "Gets entities in the collection filtered by a search term", "2-1": "Gets entities from a collection.", "1-1": "Gets an InvoiceDisplay by it's key", "0-1": "Gets the collection of all customer invoices" }, "cols": 2, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Query.Order Methods" } [/block] [block:code] { "codes": [ { "code": "var merchello = new MerchelloHelper();\n\nvar orderQuery = merchello.Query.Order;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetByInvoiceKey", "1-0": "GetByInvoiceKey", "2-0": "Search(Int64, Int64, String, SortDirection)", "3-0": "Search(DateTime, DateTime, Int64, Int64, String, SortDirection)", "4-0": "Search(DateTime, DateTime, Boolean, Int64, Int64, String, SortDirection)", "5-0": "Search(DateTime, DateTime, Guid, Int64, Int64, String, SortDirection)", "6-0": "Search(DateTime, DateTime, Guid, Boolean, Int64, Int64, String, SortDirection)", "7-0": "SearchByOrderStatus(Guid, Int64, Int64, String, SortDirection)", "8-0": "SearchByOrderStatus(Guid, Boolean, Int64, Int64, String, SortDirection)", "8-1": "Searches for orders by order status and exported value", "7-1": "Searches for orders by order status.", "6-1": "Searches orders that have order dates within a specified date range with a particular order status and export value", "5-1": "Searches order that have order dates within a specified date range with a particular order status", "4-1": "Searches orders that have order dates within a specified date range with an export value", "3-1": "Searches orders that have order dates within a specified date range", "2-1": "Searches all orders", "1-1": "Gets an OrderDisplay by it's key.", "0-1": "Gets a collection of orders by the invoice key." }, "cols": 2, "rows": 9 } [/block] [block:api-header] { "type": "basic", "title": "Query.Product Methods" } [/block] [block:code] { "codes": [ { "code": "// with data modifiers\nvar merchello = new MerchelloHelper();\n\n// or \n\n// without data modifiers\nvar merchello = new MerchelloHelper(false);\n\nvar productQuery = merchello.Query.Product;", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description" }, "cols": 2, "rows": 1 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "0-0": "TypedProductContent(string key)", "1-0": "TypedProductContent(Guid key)", "2-0": "TypedProductContentBySlug(string slug)", "3-0": "TypeProductContentBySku(string sku)", "4-0": "TypedProductContentFromCollection(Guid collectionKey)", "6-0": "GetValidProductVariants(Guid productKey, Guid[] attributeKeys)", "6-1": "Gets a list of valid variants based on partial attribute selection", "5-0": "GetProductVariantWithAttributes(Guid productKey, Guid[] attributeKeys)", "5-1": "Get a product variant from a product by it's collection of attributes", "4-1": "Gets a collection IProductContent from a product collection.", "3-1": "Gets IProductContent by sku", "2-1": "Gets IProductContent by it's slug", "1-1": "Gets IProductContent by it's unique key", "0-1": "Gets IProductContent by it's unique key (as string)" }, "cols": 2, "rows": 7 } [/block]
{"_id":"56b92b0308d8b20d00bc3b25","createdAt":"2015-11-10T20:15:22.475Z","githubsync":"","slug":"merchellocontext","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","sync_unique":"","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":""},"body":"The `MerchelloContext` is a [singleton](https://en.wikipedia.org/wiki/Singleton_pattern) instantiated during the application startup.\n\nIn some ways the **MerchelloContext** is analogous to Umbraco's **ApplicationContext** but with respect to the Merchello package.\n\nIt provides access to Merchello Services, Gateways and Cache.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"MerchelloContext.Current.Cache\",\n  \"body\": \"Merchello's cache is Umbraco's cache:  `ApplicationContext.Current.ApplicationCache'.  The association is stored within the MerchelloContext mainly for control during testing.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"MerchelloContext.Current\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The current instance of the `MerchelloContext` can be accessed through `static` **Current** property.\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var merchelloContext = MerchelloContext.Current;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ServiceContext\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"Public services accessible via the `ServiceContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var services = MerchelloContext.Current.Services;\\n\\n// example for the customer service\\n\\nvar customerService = MerchelloContext.Current.Services.CustomerService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ServiceContext Properties\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"0-0\": \"[AuditLogService](doc:auditlogservice)\",\n    \"0-1\": \"The [AuditLogService](doc:auditlogservice) is intended to be used to log Merchello related informational records that would not otherwise be normally recorded in an application's generic logging system.\",\n    \"1-0\": \"[CustomerService](doc:customerservice)\",\n    \"1-1\": \"The [CustomerService](doc:customerservice)  is used to manage Merchello customers\",\n    \"2-0\": \"[EntityCollectionService](doc:entitycollectionservice)\",\n    \"3-0\": \"[GatewayProviderService](doc:gatewayproviderservice)\",\n    \"4-0\": \"[InvoiceService](doc:invoiceservice)\",\n    \"5-0\": \"[ItemCacheService](doc:itemcacheservice)\",\n    \"6-0\": \"[OrderService](doc:orderservice)\",\n    \"7-0\": \"[PaymentService](doc:paymentservice)\",\n    \"8-0\": \"[StoreSettingService](doc:storesettingservice)\",\n    \"9-0\": \"[ProductService](doc:productservice)\",\n    \"10-0\": \"[ShipmentService](doc:shipmentservice)\",\n    \"2-1\": \"This service is used to manage entity collections. Both Static and Dynamic Collections are managed with the [EntityCollectionService](doc:entitycollectionservice) .\",\n    \"3-1\": \"The [GatewayProviderService](doc:gatewayproviderservice)  allows you to get to the gateways in Merchello. Gateways.\",\n    \"4-1\": \"The [InvoiceService](doc:invoiceservice)  allows you to manage invoices.\",\n    \"5-1\": \"The [ItemCacheService](doc:itemcacheservice)  is used to manage ItemCache collections such as those in the [Basket](doc:basket) , Wishlist and [SalePreparation](doc:salepreparation)  objects.\",\n    \"6-1\": \"The [OrderService](doc:orderservice)  manages items that need to be shipped and fulfilled from a warehouse.\",\n    \"7-1\": \"The [PaymentService](doc:paymentservice)  is used manage payments.\",\n    \"8-1\": \"The [StoreSettingService](doc:storesettingservice)  manage global store settings, currency, currency formats, country and regional settings.\",\n    \"9-1\": \"The [ProductService](doc:productservice)  is used to manage products in the back office product catalog.\",\n    \"10-1\": \"The [ShipmentService](doc:shipmentservice)  is used to manage shipments in Merch.\"\n  },\n  \"cols\": 2,\n  \"rows\": 11\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"GatewayContext\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var gatewayContext = MerchelloContext.Current.Gateways;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"NotificationContext\",\n  \"body\": \"The `NotificationContext` is responsible for passing notification message to any *NotificationGatewayProviders* configured in the back office.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var notificationContext = MerchelloContext.Current.Gateways.Notification;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n#### Methods\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"GetNotificationMessagesByMonitorKey(Guid monitorKey)\",\n    \"0-1\": \"Gets a collection of INotificationMessage s by a Monitor Key (Guid)\",\n    \"1-0\": \"Send(INotificationMessage message)\",\n    \"1-1\": \"Sends a INotificationMessage\",\n    \"2-0\": \"Send(INotificationMessage message, IFormatter formatter);\",\n    \"2-1\": \"Sends a INotificationMessage with a designated formatter\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"PaymentContext\",\n  \"body\": \"The `PaymentContent` is responsible for managing payment methods across multiple *PaymentGatewayProvider(s)* configured in the back office.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var paymentContext = MerchelloContext.Current.Gateways.Payment;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n#### Methods\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GetPaymentGatewayMethods()\",\n    \"0-1\": \"Gets a list of all possible Payment Methods\",\n    \"1-0\": \"GetPaymentGatewayMethodByKey(Guid paymentMethodKey)\",\n    \"1-1\": \"Gets a IPaymentGatewayMethod by its unique key\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The `ShippingContext` is responsible for getting shipment (freight) rate quotes across all qualifying *ShippingGatewayProvider* methods for a given shipping destination - determined by shipping destination country.\",\n  \"title\": \"ShippingContext\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var shippingContext = MerchelloContext.Current.Gateways.Shipping;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n#### Methods\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"GetShipRateQuotesForShipment(IShipment shipment, bool tryGetCached = true)\",\n    \"0-1\": \"Returns a collection of all IShipmentRateQuote that are available for the IShipment\",\n    \"1-0\": \"GetAllowedShipmentDestinationCountries()\",\n    \"1-1\": \"Returns a list of all countries that can be assigned to a shipment\",\n    \"2-0\": \"GetGatewayProvidersByShipCountry(IShipCountry shipCountry)\",\n    \"2-1\": \"Gets a collection of ShippingGatewayProviders for a particular ship country\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"TaxationContext\",\n  \"body\": \"The `TaxationContext` is responsible for providing taxation calculation for either an invoice or product based taxation.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var taxationContext = MerchelloContext.Current.Gateways.Taxation;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n#### Properties\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"ProductPricingEnabled\",\n    \"0-1\": \"Returns a value indicating whether the product based tax pricing is enabled.  (Set in the back office)\",\n    \"1-0\": \"TaxationApplication\",\n    \"1-1\": \"Returns an `enum` value - Invoice or Product\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n#### Methods\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"CalculateTaxesForInvoice(IInvoice invoice, bool quoteOnly = false)\",\n    \"1-0\": \"CalculateTaxesForInvoice(IInvoice invoice, IAddress taxAddress, bool quoteOnly = false)\",\n    \"2-0\": \"CalculateTaxesForProduct(IProductVariantDataModifierData product)\",\n    \"3-0\": \"GetTaxMethodForTaxAddress(IAddress taxAddress)\",\n    \"4-0\": \"GetTaxMethodForCountryCode(string countryCode)\",\n    \"4-1\": \"Gets the tax method for country code.\",\n    \"3-1\": \"Gets the tax method for a given tax address\",\n    \"2-1\": \"Calculate taxes for a product when product based taxation is enabled.\",\n    \"1-1\": \"Calculates taxes for an invoice.\",\n    \"0-1\": \"Calculates taxes for an invoice.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]","category":"56b92aff08d8b20d00bc3b07","user":"564136b9f424a10d001181e1","updates":[],"link_external":false,"order":31,"title":"MerchelloContext","__v":0,"link_url":"","hidden":false,"excerpt":"Documentation for the MerchelloContext","type":"basic","childrenPages":[]}

MerchelloContext

Documentation for the MerchelloContext

The `MerchelloContext` is a [singleton](https://en.wikipedia.org/wiki/Singleton_pattern) instantiated during the application startup. In some ways the **MerchelloContext** is analogous to Umbraco's **ApplicationContext** but with respect to the Merchello package. It provides access to Merchello Services, Gateways and Cache. [block:callout] { "type": "info", "title": "MerchelloContext.Current.Cache", "body": "Merchello's cache is Umbraco's cache: `ApplicationContext.Current.ApplicationCache'. The association is stored within the MerchelloContext mainly for control during testing." } [/block] [block:api-header] { "type": "basic", "title": "MerchelloContext.Current", "sidebar": true } [/block] [block:textarea] { "text": "The current instance of the `MerchelloContext` can be accessed through `static` **Current** property.", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var merchelloContext = MerchelloContext.Current;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "ServiceContext", "sidebar": true } [/block] [block:textarea] { "text": "Public services accessible via the `ServiceContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var services = MerchelloContext.Current.Services;\n\n// example for the customer service\n\nvar customerService = MerchelloContext.Current.Services.CustomerService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "ServiceContext Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "0-0": "[AuditLogService](doc:auditlogservice)", "0-1": "The [AuditLogService](doc:auditlogservice) is intended to be used to log Merchello related informational records that would not otherwise be normally recorded in an application's generic logging system.", "1-0": "[CustomerService](doc:customerservice)", "1-1": "The [CustomerService](doc:customerservice) is used to manage Merchello customers", "2-0": "[EntityCollectionService](doc:entitycollectionservice)", "3-0": "[GatewayProviderService](doc:gatewayproviderservice)", "4-0": "[InvoiceService](doc:invoiceservice)", "5-0": "[ItemCacheService](doc:itemcacheservice)", "6-0": "[OrderService](doc:orderservice)", "7-0": "[PaymentService](doc:paymentservice)", "8-0": "[StoreSettingService](doc:storesettingservice)", "9-0": "[ProductService](doc:productservice)", "10-0": "[ShipmentService](doc:shipmentservice)", "2-1": "This service is used to manage entity collections. Both Static and Dynamic Collections are managed with the [EntityCollectionService](doc:entitycollectionservice) .", "3-1": "The [GatewayProviderService](doc:gatewayproviderservice) allows you to get to the gateways in Merchello. Gateways.", "4-1": "The [InvoiceService](doc:invoiceservice) allows you to manage invoices.", "5-1": "The [ItemCacheService](doc:itemcacheservice) is used to manage ItemCache collections such as those in the [Basket](doc:basket) , Wishlist and [SalePreparation](doc:salepreparation) objects.", "6-1": "The [OrderService](doc:orderservice) manages items that need to be shipped and fulfilled from a warehouse.", "7-1": "The [PaymentService](doc:paymentservice) is used manage payments.", "8-1": "The [StoreSettingService](doc:storesettingservice) manage global store settings, currency, currency formats, country and regional settings.", "9-1": "The [ProductService](doc:productservice) is used to manage products in the back office product catalog.", "10-1": "The [ShipmentService](doc:shipmentservice) is used to manage shipments in Merch." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "type": "basic", "title": "GatewayContext" } [/block] [block:code] { "codes": [ { "code": "var gatewayContext = MerchelloContext.Current.Gateways;", "language": "csharp" } ] } [/block] [block:callout] { "type": "info", "title": "NotificationContext", "body": "The `NotificationContext` is responsible for passing notification message to any *NotificationGatewayProviders* configured in the back office." } [/block] [block:code] { "codes": [ { "code": "var notificationContext = MerchelloContext.Current.Gateways.Notification;", "language": "csharp" } ] } [/block] #### Methods [block:parameters] { "data": { "0-0": "GetNotificationMessagesByMonitorKey(Guid monitorKey)", "0-1": "Gets a collection of INotificationMessage s by a Monitor Key (Guid)", "1-0": "Send(INotificationMessage message)", "1-1": "Sends a INotificationMessage", "2-0": "Send(INotificationMessage message, IFormatter formatter);", "2-1": "Sends a INotificationMessage with a designated formatter" }, "cols": 2, "rows": 3 } [/block] [block:callout] { "type": "info", "title": "PaymentContext", "body": "The `PaymentContent` is responsible for managing payment methods across multiple *PaymentGatewayProvider(s)* configured in the back office." } [/block] [block:code] { "codes": [ { "code": "var paymentContext = MerchelloContext.Current.Gateways.Payment;", "language": "csharp" } ] } [/block] #### Methods [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetPaymentGatewayMethods()", "0-1": "Gets a list of all possible Payment Methods", "1-0": "GetPaymentGatewayMethodByKey(Guid paymentMethodKey)", "1-1": "Gets a IPaymentGatewayMethod by its unique key" }, "cols": 2, "rows": 2 } [/block] [block:callout] { "type": "info", "body": "The `ShippingContext` is responsible for getting shipment (freight) rate quotes across all qualifying *ShippingGatewayProvider* methods for a given shipping destination - determined by shipping destination country.", "title": "ShippingContext" } [/block] [block:code] { "codes": [ { "code": "var shippingContext = MerchelloContext.Current.Gateways.Shipping;", "language": "csharp" } ] } [/block] #### Methods [block:parameters] { "data": { "0-0": "GetShipRateQuotesForShipment(IShipment shipment, bool tryGetCached = true)", "0-1": "Returns a collection of all IShipmentRateQuote that are available for the IShipment", "1-0": "GetAllowedShipmentDestinationCountries()", "1-1": "Returns a list of all countries that can be assigned to a shipment", "2-0": "GetGatewayProvidersByShipCountry(IShipCountry shipCountry)", "2-1": "Gets a collection of ShippingGatewayProviders for a particular ship country" }, "cols": 2, "rows": 3 } [/block] [block:callout] { "type": "info", "title": "TaxationContext", "body": "The `TaxationContext` is responsible for providing taxation calculation for either an invoice or product based taxation." } [/block] [block:code] { "codes": [ { "code": "var taxationContext = MerchelloContext.Current.Gateways.Taxation;", "language": "csharp" } ] } [/block] #### Properties [block:parameters] { "data": { "0-0": "ProductPricingEnabled", "0-1": "Returns a value indicating whether the product based tax pricing is enabled. (Set in the back office)", "1-0": "TaxationApplication", "1-1": "Returns an `enum` value - Invoice or Product" }, "cols": 2, "rows": 2 } [/block] #### Methods [block:parameters] { "data": { "0-0": "CalculateTaxesForInvoice(IInvoice invoice, bool quoteOnly = false)", "1-0": "CalculateTaxesForInvoice(IInvoice invoice, IAddress taxAddress, bool quoteOnly = false)", "2-0": "CalculateTaxesForProduct(IProductVariantDataModifierData product)", "3-0": "GetTaxMethodForTaxAddress(IAddress taxAddress)", "4-0": "GetTaxMethodForCountryCode(string countryCode)", "4-1": "Gets the tax method for country code.", "3-1": "Gets the tax method for a given tax address", "2-1": "Calculate taxes for a product when product based taxation is enabled.", "1-1": "Calculates taxes for an invoice.", "0-1": "Calculates taxes for an invoice." }, "cols": 2, "rows": 5 } [/block]
The `MerchelloContext` is a [singleton](https://en.wikipedia.org/wiki/Singleton_pattern) instantiated during the application startup. In some ways the **MerchelloContext** is analogous to Umbraco's **ApplicationContext** but with respect to the Merchello package. It provides access to Merchello Services, Gateways and Cache. [block:callout] { "type": "info", "title": "MerchelloContext.Current.Cache", "body": "Merchello's cache is Umbraco's cache: `ApplicationContext.Current.ApplicationCache'. The association is stored within the MerchelloContext mainly for control during testing." } [/block] [block:api-header] { "type": "basic", "title": "MerchelloContext.Current", "sidebar": true } [/block] [block:textarea] { "text": "The current instance of the `MerchelloContext` can be accessed through `static` **Current** property.", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var merchelloContext = MerchelloContext.Current;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "ServiceContext", "sidebar": true } [/block] [block:textarea] { "text": "Public services accessible via the `ServiceContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var services = MerchelloContext.Current.Services;\n\n// example for the customer service\n\nvar customerService = MerchelloContext.Current.Services.CustomerService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "ServiceContext Properties" } [/block] [block:parameters] { "data": { "h-0": "Name", "0-0": "[AuditLogService](doc:auditlogservice)", "0-1": "The [AuditLogService](doc:auditlogservice) is intended to be used to log Merchello related informational records that would not otherwise be normally recorded in an application's generic logging system.", "1-0": "[CustomerService](doc:customerservice)", "1-1": "The [CustomerService](doc:customerservice) is used to manage Merchello customers", "2-0": "[EntityCollectionService](doc:entitycollectionservice)", "3-0": "[GatewayProviderService](doc:gatewayproviderservice)", "4-0": "[InvoiceService](doc:invoiceservice)", "5-0": "[ItemCacheService](doc:itemcacheservice)", "6-0": "[OrderService](doc:orderservice)", "7-0": "[PaymentService](doc:paymentservice)", "8-0": "[StoreSettingService](doc:storesettingservice)", "9-0": "[ProductService](doc:productservice)", "10-0": "[ShipmentService](doc:shipmentservice)", "2-1": "This service is used to manage entity collections. Both Static and Dynamic Collections are managed with the [EntityCollectionService](doc:entitycollectionservice) .", "3-1": "The [GatewayProviderService](doc:gatewayproviderservice) allows you to get to the gateways in Merchello. Gateways.", "4-1": "The [InvoiceService](doc:invoiceservice) allows you to manage invoices.", "5-1": "The [ItemCacheService](doc:itemcacheservice) is used to manage ItemCache collections such as those in the [Basket](doc:basket) , Wishlist and [SalePreparation](doc:salepreparation) objects.", "6-1": "The [OrderService](doc:orderservice) manages items that need to be shipped and fulfilled from a warehouse.", "7-1": "The [PaymentService](doc:paymentservice) is used manage payments.", "8-1": "The [StoreSettingService](doc:storesettingservice) manage global store settings, currency, currency formats, country and regional settings.", "9-1": "The [ProductService](doc:productservice) is used to manage products in the back office product catalog.", "10-1": "The [ShipmentService](doc:shipmentservice) is used to manage shipments in Merch." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "type": "basic", "title": "GatewayContext" } [/block] [block:code] { "codes": [ { "code": "var gatewayContext = MerchelloContext.Current.Gateways;", "language": "csharp" } ] } [/block] [block:callout] { "type": "info", "title": "NotificationContext", "body": "The `NotificationContext` is responsible for passing notification message to any *NotificationGatewayProviders* configured in the back office." } [/block] [block:code] { "codes": [ { "code": "var notificationContext = MerchelloContext.Current.Gateways.Notification;", "language": "csharp" } ] } [/block] #### Methods [block:parameters] { "data": { "0-0": "GetNotificationMessagesByMonitorKey(Guid monitorKey)", "0-1": "Gets a collection of INotificationMessage s by a Monitor Key (Guid)", "1-0": "Send(INotificationMessage message)", "1-1": "Sends a INotificationMessage", "2-0": "Send(INotificationMessage message, IFormatter formatter);", "2-1": "Sends a INotificationMessage with a designated formatter" }, "cols": 2, "rows": 3 } [/block] [block:callout] { "type": "info", "title": "PaymentContext", "body": "The `PaymentContent` is responsible for managing payment methods across multiple *PaymentGatewayProvider(s)* configured in the back office." } [/block] [block:code] { "codes": [ { "code": "var paymentContext = MerchelloContext.Current.Gateways.Payment;", "language": "csharp" } ] } [/block] #### Methods [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GetPaymentGatewayMethods()", "0-1": "Gets a list of all possible Payment Methods", "1-0": "GetPaymentGatewayMethodByKey(Guid paymentMethodKey)", "1-1": "Gets a IPaymentGatewayMethod by its unique key" }, "cols": 2, "rows": 2 } [/block] [block:callout] { "type": "info", "body": "The `ShippingContext` is responsible for getting shipment (freight) rate quotes across all qualifying *ShippingGatewayProvider* methods for a given shipping destination - determined by shipping destination country.", "title": "ShippingContext" } [/block] [block:code] { "codes": [ { "code": "var shippingContext = MerchelloContext.Current.Gateways.Shipping;", "language": "csharp" } ] } [/block] #### Methods [block:parameters] { "data": { "0-0": "GetShipRateQuotesForShipment(IShipment shipment, bool tryGetCached = true)", "0-1": "Returns a collection of all IShipmentRateQuote that are available for the IShipment", "1-0": "GetAllowedShipmentDestinationCountries()", "1-1": "Returns a list of all countries that can be assigned to a shipment", "2-0": "GetGatewayProvidersByShipCountry(IShipCountry shipCountry)", "2-1": "Gets a collection of ShippingGatewayProviders for a particular ship country" }, "cols": 2, "rows": 3 } [/block] [block:callout] { "type": "info", "title": "TaxationContext", "body": "The `TaxationContext` is responsible for providing taxation calculation for either an invoice or product based taxation." } [/block] [block:code] { "codes": [ { "code": "var taxationContext = MerchelloContext.Current.Gateways.Taxation;", "language": "csharp" } ] } [/block] #### Properties [block:parameters] { "data": { "0-0": "ProductPricingEnabled", "0-1": "Returns a value indicating whether the product based tax pricing is enabled. (Set in the back office)", "1-0": "TaxationApplication", "1-1": "Returns an `enum` value - Invoice or Product" }, "cols": 2, "rows": 2 } [/block] #### Methods [block:parameters] { "data": { "0-0": "CalculateTaxesForInvoice(IInvoice invoice, bool quoteOnly = false)", "1-0": "CalculateTaxesForInvoice(IInvoice invoice, IAddress taxAddress, bool quoteOnly = false)", "2-0": "CalculateTaxesForProduct(IProductVariantDataModifierData product)", "3-0": "GetTaxMethodForTaxAddress(IAddress taxAddress)", "4-0": "GetTaxMethodForCountryCode(string countryCode)", "4-1": "Gets the tax method for country code.", "3-1": "Gets the tax method for a given tax address", "2-1": "Calculate taxes for a product when product based taxation is enabled.", "1-1": "Calculates taxes for an invoice.", "0-1": "Calculates taxes for an invoice." }, "cols": 2, "rows": 5 } [/block]
{"_id":"56b92b0108d8b20d00bc3b19","category":"56b92aff08d8b20d00bc3b08","link_external":false,"githubsync":"","hidden":false,"order":32,"excerpt":"","version":"56b92afe08d8b20d00bc3afd","sync_unique":"","body":"The Merchello Bazaar is a simple, example store which has been developed to help get you up and running quickly with Merchello. It's designed to show you how to implement common features, and you can grab the source code from **[here](https://github.com/Merchello/Merchello)**, just fork/clone/download and open up Merchello.Bazaar.sln","project":"56421bcdb48bdf19006a4c97","api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"slug":"bazaar","__v":0,"user":"564136b9f424a10d001181e1","updates":[],"createdAt":"2015-11-10T20:57:09.855Z","link_url":"","type":"basic","title":"Bazaar","childrenPages":[]}

Bazaar


The Merchello Bazaar is a simple, example store which has been developed to help get you up and running quickly with Merchello. It's designed to show you how to implement common features, and you can grab the source code from **[here](https://github.com/Merchello/Merchello)**, just fork/clone/download and open up Merchello.Bazaar.sln
The Merchello Bazaar is a simple, example store which has been developed to help get you up and running quickly with Merchello. It's designed to show you how to implement common features, and you can grab the source code from **[here](https://github.com/Merchello/Merchello)**, just fork/clone/download and open up Merchello.Bazaar.sln
{"_id":"56b92b0408d8b20d00bc3b27","version":"56b92afe08d8b20d00bc3afd","link_external":false,"sync_unique":"","title":"Services","createdAt":"2015-11-10T20:52:00.489Z","link_url":"","githubsync":"","hidden":false,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Event Model\"\n}\n[/block]\nIn general, Merchello follows [Umbraco's service event model](https://our.umbraco.org/documentation/Reference/Events) in that most services expose:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Saving\",\n    \"2-1\": \"Occurs before saving\",\n    \"3-0\": \"Saved\",\n    \"3-1\": \"Occurs after saved\",\n    \"4-0\": \"Deleting\",\n    \"4-1\": \"Occurs before deleting\",\n    \"5-0\": \"Deleted\",\n    \"5-1\": \"Occurs after delete\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Service Event Usage\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/// <summary>\\n/// The umbraco event handler.\\n/// </summary>\\npublic class UmbracoEventHandler : ApplicationEventHandler\\n{\\n\\n  /// <summary>\\n  /// Handles Umbraco Events.\\n  /// </summary>\\n  /// <param name=\\\"umbracoApplication\\\">\\n  /// The <see cref=\\\"UmbracoApplicationBase\\\"/>.\\n  /// </param>\\n  /// <param name=\\\"applicationContext\\\">\\n  /// Umbraco <see cref=\\\"ApplicationContext\\\"/>.\\n  /// </param>\\n  protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\\n  {\\n      StoreSettingService.Saved += StoreSettingServiceOnSaved;\\n  }\\n  \\n  /// <summary>\\n  /// Clears the Bazaar currency if Merchello store settings are saved.\\n  /// </summary>\\n  /// <param name=\\\"sender\\\">\\n  /// The sender.\\n  /// </param>\\n  /// <param name=\\\"e\\\">\\n  /// The save event args.\\n  /// </param>\\n  private static void StoreSettingServiceOnSaved(IStoreSettingService sender, SaveEventArgs<IStoreSetting> e)\\n  {\\n    // do something when a setting is saved\\n  }\\n}\\n\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","excerpt":"","slug":"services","user":"564136b9f424a10d001181e1","updates":[],"order":33,"category":"56b92aff08d8b20d00bc3b09","project":"56421bcdb48bdf19006a4c97","api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required"},"type":"basic","__v":0,"childrenPages":[]}

Services


[block:api-header] { "type": "basic", "title": "Event Model" } [/block] In general, Merchello follows [Umbraco's service event model](https://our.umbraco.org/documentation/Reference/Events) in that most services expose: [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Saving", "2-1": "Occurs before saving", "3-0": "Saved", "3-1": "Occurs after saved", "4-0": "Deleting", "4-1": "Occurs before deleting", "5-0": "Deleted", "5-1": "Occurs after delete" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Example Service Event Usage", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// The umbraco event handler.\n/// </summary>\npublic class UmbracoEventHandler : ApplicationEventHandler\n{\n\n /// <summary>\n /// Handles Umbraco Events.\n /// </summary>\n /// <param name=\"umbracoApplication\">\n /// The <see cref=\"UmbracoApplicationBase\"/>.\n /// </param>\n /// <param name=\"applicationContext\">\n /// Umbraco <see cref=\"ApplicationContext\"/>.\n /// </param>\n protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\n {\n StoreSettingService.Saved += StoreSettingServiceOnSaved;\n }\n \n /// <summary>\n /// Clears the Bazaar currency if Merchello store settings are saved.\n /// </summary>\n /// <param name=\"sender\">\n /// The sender.\n /// </param>\n /// <param name=\"e\">\n /// The save event args.\n /// </param>\n private static void StoreSettingServiceOnSaved(IStoreSettingService sender, SaveEventArgs<IStoreSetting> e)\n {\n // do something when a setting is saved\n }\n}\n", "language": "csharp" } ], "sidebar": true } [/block]
[block:api-header] { "type": "basic", "title": "Event Model" } [/block] In general, Merchello follows [Umbraco's service event model](https://our.umbraco.org/documentation/Reference/Events) in that most services expose: [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Saving", "2-1": "Occurs before saving", "3-0": "Saved", "3-1": "Occurs after saved", "4-0": "Deleting", "4-1": "Occurs before deleting", "5-0": "Deleted", "5-1": "Occurs after delete" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Example Service Event Usage", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "/// <summary>\n/// The umbraco event handler.\n/// </summary>\npublic class UmbracoEventHandler : ApplicationEventHandler\n{\n\n /// <summary>\n /// Handles Umbraco Events.\n /// </summary>\n /// <param name=\"umbracoApplication\">\n /// The <see cref=\"UmbracoApplicationBase\"/>.\n /// </param>\n /// <param name=\"applicationContext\">\n /// Umbraco <see cref=\"ApplicationContext\"/>.\n /// </param>\n protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)\n {\n StoreSettingService.Saved += StoreSettingServiceOnSaved;\n }\n \n /// <summary>\n /// Clears the Bazaar currency if Merchello store settings are saved.\n /// </summary>\n /// <param name=\"sender\">\n /// The sender.\n /// </param>\n /// <param name=\"e\">\n /// The save event args.\n /// </param>\n private static void StoreSettingServiceOnSaved(IStoreSettingService sender, SaveEventArgs<IStoreSetting> e)\n {\n // do something when a setting is saved\n }\n}\n", "language": "csharp" } ], "sidebar": true } [/block]
{"_id":"56b92b0408d8b20d00bc3b28","link_url":"","sync_unique":"","order":34,"body":"The AuditLogService is intended to be used to log Merchello related informational records that would not otherwise be normally recorded in an application's generic logging system.\n\n**Examples are**\n\nPayment authorized, Shipment Shipped and Order created records.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var auditLogService = MerchelloContext.Current.Services.AuditLogService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The AuditLogService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class AuditLogService : PageCachedServiceBase<IAuditLog>, \\n\\tIAuditLogService, IPageCachedService<IAuditLog>, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"AuditLogService()\",\n    \"1-0\": \"AuditLogService(ILogger)\",\n    \"2-0\": \"AuditLogService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)\",\n    \"0-1\": \"Initializes a new instance of the AuditLogService class.\",\n    \"1-1\": \"Initializes a new instance of the AuditLogService class.\",\n    \"2-1\": \"Initializes a new instance of the AuditLogService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"CreateAuditLogWithKey(String, ExtendedDataCollection, Boolean, Boolean)\",\n    \"0-1\": \"Creates an audit record and saves it to the database\",\n    \"1-0\": \"CreateAuditLogWithKey(Nullable(Guid), EntityType, String, Boolean, Boolean)\",\n    \"2-0\": \"CreateAuditLogWithKey(Nullable(Guid), Nullable(Guid), String, Boolean, Boolean)\",\n    \"3-0\": \"CreateAuditLogWithKey(Nullable(Guid), EntityType, String, ExtendedDataCollection, Boolean, Boolean)\",\n    \"4-0\": \"CreateAuditLogWithKey(Nullable(Guid), Nullable(Guid), String, ExtendedDataCollection, Boolean, Boolean)\",\n    \"1-1\": \"Creates an audit record and saves it to the database\",\n    \"2-1\": \"Creates an audit record and saves it to the database\",\n    \"3-1\": \"Creates an audit record and saves it to the database\",\n    \"4-1\": \"Creates an audit record and saves it to the database\",\n    \"5-0\": \"Delete(IAuditLog, Boolean)\",\n    \"6-0\": \"Delete(IEnumerable(IAuditLog), Boolean)\",\n    \"7-0\": \"DeleteErrorAuditLogs\",\n    \"5-1\": \"Deletes a IAuditLog\",\n    \"6-1\": \"Deletes a collection of IAuditLog\",\n    \"7-1\": \"Deletes all error logs\",\n    \"8-0\": \"GetAuditLogsByEntityKey\",\n    \"9-0\": \"GetAuditLogsByEntityTfKey\",\n    \"10-0\": \"GetByKey\",\n    \"11-0\": \"GetErrorAuditLogs\",\n    \"12-0\": \"GetPage\",\n    \"12-1\": \"Gets a Page of AuditLogs\",\n    \"11-1\": \"Gets a collection of IAuditLog where IsError == true\",\n    \"10-1\": \"Gets an IAuditLog by it's key\",\n    \"9-1\": \"Gets a collection of IAuditLog for an entity type\",\n    \"8-1\": \"Gets a collection of IAuditLog for a particular entity\"\n  },\n  \"cols\": 2,\n  \"rows\": 13\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"1-0\": \"Created\",\n    \"2-0\": \"Deleting\",\n    \"3-0\": \"Deleted\",\n    \"4-0\": \"Saving\",\n    \"5-0\": \"Saved\",\n    \"0-1\": \"Occurs before create\",\n    \"1-1\": \"Occurs after create\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-1\": \"Occurs before saving\",\n    \"5-1\": \"Occurs after saved\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\",\n  \"iframe\": false\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs)","title":"AuditLogService","__v":0,"createdAt":"2015-11-10T20:20:54.544Z","link_external":false,"excerpt":"Describes the AuditLogService","type":"basic","category":"56b92aff08d8b20d00bc3b09","project":"56421bcdb48bdf19006a4c97","updates":[],"hidden":false,"api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]}},"user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","githubsync":"","slug":"auditlogservice","childrenPages":[]}

AuditLogService

Describes the AuditLogService

The AuditLogService is intended to be used to log Merchello related informational records that would not otherwise be normally recorded in an application's generic logging system. **Examples are** Payment authorized, Shipment Shipped and Order created records. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var auditLogService = MerchelloContext.Current.Services.AuditLogService;", "language": "csharp" } ], "sidebar": true } [/block] [block:textarea] { "text": "The AuditLogService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class AuditLogService : PageCachedServiceBase<IAuditLog>, \n\tIAuditLogService, IPageCachedService<IAuditLog>, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AuditLogService()", "1-0": "AuditLogService(ILogger)", "2-0": "AuditLogService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)", "0-1": "Initializes a new instance of the AuditLogService class.", "1-1": "Initializes a new instance of the AuditLogService class.", "2-1": "Initializes a new instance of the AuditLogService class." }, "cols": 2, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateAuditLogWithKey(String, ExtendedDataCollection, Boolean, Boolean)", "0-1": "Creates an audit record and saves it to the database", "1-0": "CreateAuditLogWithKey(Nullable(Guid), EntityType, String, Boolean, Boolean)", "2-0": "CreateAuditLogWithKey(Nullable(Guid), Nullable(Guid), String, Boolean, Boolean)", "3-0": "CreateAuditLogWithKey(Nullable(Guid), EntityType, String, ExtendedDataCollection, Boolean, Boolean)", "4-0": "CreateAuditLogWithKey(Nullable(Guid), Nullable(Guid), String, ExtendedDataCollection, Boolean, Boolean)", "1-1": "Creates an audit record and saves it to the database", "2-1": "Creates an audit record and saves it to the database", "3-1": "Creates an audit record and saves it to the database", "4-1": "Creates an audit record and saves it to the database", "5-0": "Delete(IAuditLog, Boolean)", "6-0": "Delete(IEnumerable(IAuditLog), Boolean)", "7-0": "DeleteErrorAuditLogs", "5-1": "Deletes a IAuditLog", "6-1": "Deletes a collection of IAuditLog", "7-1": "Deletes all error logs", "8-0": "GetAuditLogsByEntityKey", "9-0": "GetAuditLogsByEntityTfKey", "10-0": "GetByKey", "11-0": "GetErrorAuditLogs", "12-0": "GetPage", "12-1": "Gets a Page of AuditLogs", "11-1": "Gets a collection of IAuditLog where IsError == true", "10-1": "Gets an IAuditLog by it's key", "9-1": "Gets a collection of IAuditLog for an entity type", "8-1": "Gets a collection of IAuditLog for a particular entity" }, "cols": 2, "rows": 13 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "1-0": "Created", "2-0": "Deleting", "3-0": "Deleted", "4-0": "Saving", "5-0": "Saved", "0-1": "Occurs before create", "1-1": "Occurs after create", "2-1": "Occurs before delete", "3-1": "Occurs after delete", "4-1": "Occurs before saving", "5-1": "Occurs after saved" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400", "iframe": false } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs)
The AuditLogService is intended to be used to log Merchello related informational records that would not otherwise be normally recorded in an application's generic logging system. **Examples are** Payment authorized, Shipment Shipped and Order created records. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var auditLogService = MerchelloContext.Current.Services.AuditLogService;", "language": "csharp" } ], "sidebar": true } [/block] [block:textarea] { "text": "The AuditLogService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class AuditLogService : PageCachedServiceBase<IAuditLog>, \n\tIAuditLogService, IPageCachedService<IAuditLog>, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AuditLogService()", "1-0": "AuditLogService(ILogger)", "2-0": "AuditLogService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)", "0-1": "Initializes a new instance of the AuditLogService class.", "1-1": "Initializes a new instance of the AuditLogService class.", "2-1": "Initializes a new instance of the AuditLogService class." }, "cols": 2, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateAuditLogWithKey(String, ExtendedDataCollection, Boolean, Boolean)", "0-1": "Creates an audit record and saves it to the database", "1-0": "CreateAuditLogWithKey(Nullable(Guid), EntityType, String, Boolean, Boolean)", "2-0": "CreateAuditLogWithKey(Nullable(Guid), Nullable(Guid), String, Boolean, Boolean)", "3-0": "CreateAuditLogWithKey(Nullable(Guid), EntityType, String, ExtendedDataCollection, Boolean, Boolean)", "4-0": "CreateAuditLogWithKey(Nullable(Guid), Nullable(Guid), String, ExtendedDataCollection, Boolean, Boolean)", "1-1": "Creates an audit record and saves it to the database", "2-1": "Creates an audit record and saves it to the database", "3-1": "Creates an audit record and saves it to the database", "4-1": "Creates an audit record and saves it to the database", "5-0": "Delete(IAuditLog, Boolean)", "6-0": "Delete(IEnumerable(IAuditLog), Boolean)", "7-0": "DeleteErrorAuditLogs", "5-1": "Deletes a IAuditLog", "6-1": "Deletes a collection of IAuditLog", "7-1": "Deletes all error logs", "8-0": "GetAuditLogsByEntityKey", "9-0": "GetAuditLogsByEntityTfKey", "10-0": "GetByKey", "11-0": "GetErrorAuditLogs", "12-0": "GetPage", "12-1": "Gets a Page of AuditLogs", "11-1": "Gets a collection of IAuditLog where IsError == true", "10-1": "Gets an IAuditLog by it's key", "9-1": "Gets a collection of IAuditLog for an entity type", "8-1": "Gets a collection of IAuditLog for a particular entity" }, "cols": 2, "rows": 13 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "1-0": "Created", "2-0": "Deleting", "3-0": "Deleted", "4-0": "Saving", "5-0": "Saved", "0-1": "Occurs before create", "1-1": "Occurs after create", "2-1": "Occurs before delete", "3-1": "Occurs after delete", "4-1": "Occurs before saving", "5-1": "Occurs after saved" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400", "iframe": false } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IAuditLogService.cs)
{"_id":"56b92b0408d8b20d00bc3b29","user":"564136b9f424a10d001181e1","createdAt":"2015-11-11T21:59:13.546Z","sync_unique":"","hidden":false,"excerpt":"Describes the CustomerService","link_url":"","order":35,"type":"basic","__v":0,"project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","link_external":false,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"body":"These routines provide a way to generate new customer records.  In Merchello, we have two types of customers.  Anonymous customers are everyday shoppers who have not authenticated the site and use the AnonymousCustomer class.   Authenticated shoppers (members in the Umbraco world) use the Customer class.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The CustomerService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var customerService = MerchelloContext.Current.Services.CustomerService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class CustomerService : PageCachedServiceBase<ICustomer>, \\n\\tICustomerService, IPageCachedService<ICustomer>, IService, IStaticCollectionService<ICustomer>\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"CustomerService()\",\n    \"1-0\": \"CustomerService(ILogger)\",\n    \"2-0\": \"CustomerService(RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)\",\n    \"3-0\": \"CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)\",\n    \"4-0\": \"CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)\",\n    \"0-1\": \"Initializes a new instance of the CustomerService class.\",\n    \"1-1\": \"Initializes a new instance of the CustomerService class.\",\n    \"2-1\": \"Initializes a new instance of the CustomerService class.\",\n    \"3-1\": \"Initializes a new instance of the CustomerService class.\",\n    \"4-1\": \"Initializes a new instance of the CustomerService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"AddToCollection(Guid, Guid)\",\n    \"1-0\": \"AddToCollection(ICustomer, IEntityCollection)\",\n    \"2-0\": \"AddToCollection(ICustomer, Guid)\",\n    \"3-0\": \"CreateAnonymousCustomerWithKey\",\n    \"4-0\": \"CreateCustomer\",\n    \"5-0\": \"CreateCustomerWithKey(String)\",\n    \"6-0\": \"CreateCustomerWithKey(String, String, String, String)\",\n    \"7-0\": \"CustomerCount\",\n    \"8-0\": \"Delete(IAnonymousCustomer)\",\n    \"9-0\": \"Delete(IEnumerable(IAnonymousCustomer))\",\n    \"10-0\": \"Delete(ICustomerAddress)\",\n    \"11-0\": \"Delete(ICustomerAddress)\",\n    \"12-0\": \"Delete(IEnumerable(ICustomer), Boolean)\",\n    \"13-0\": \"ExistsInCollection\",\n    \"15-0\": \"GetAnyByKey\",\n    \"16-0\": \"GetByCustomerKey(Guid)\",\n    \"17-0\": \"GetByCustomerKey(Guid, AddressType)\",\n    \"18-0\": \"GetByKey\",\n    \"19-0\": \"GetByKeys\",\n    \"20-0\": \"GetByLoginName\",\n    \"21-0\": \"GetDefaultCustomerAddress\",\n    \"22-0\": \"GetFromCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"23-0\": \"GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"24-0\": \"GetPage\",\n    \"25-0\": \"RemoveFromCollection(Guid, Guid)\",\n    \"26-0\": \"RemoveFromCollection(ICustomer, IEntityCollection)\",\n    \"27-0\": \"RemoveFromCollection(ICustomer, Guid)\",\n    \"28-0\": \"Save(ICustomerAddress)\",\n    \"29-0\": \"Save(IEnumerable(ICustomerAddress))\",\n    \"30-0\": \"Save(IAnonymousCustomer, Boolean)\",\n    \"31-0\": \"Save(ICustomer, Boolean)\",\n    \"32-0\": \"Save(IEnumerable(ICustomer), Boolean)\",\n    \"0-1\": \"Add a customer to a collection.\",\n    \"1-1\": \"Add a customer to a collection.\",\n    \"2-1\": \"Add a customer to a collection.\",\n    \"3-1\": \"Creates an IAnonymousCustomer and saves it to the database\",\n    \"4-1\": \"Creates a customer without saving to the database\",\n    \"5-1\": \"Creates a customer with the Umbraco login name\",\n    \"6-1\": \"Creates a customer and saves the record to the database\",\n    \"7-1\": \"Gets the total customer count.\",\n    \"8-1\": \"Deletes a single IAnonymousCustomer\",\n    \"9-1\": \"Deletes a collection of IAnonymousCustomer objects\",\n    \"10-1\": \"Delete(ICustomerAddress)\",\n    \"11-1\": \"Deletes a single ICustomer\",\n    \"12-1\": \"Deletes a collection ICustomer\",\n    \"13-1\": \"Determines if an customer exists in a collection.\",\n    \"14-0\": \"GetAddressByKey\",\n    \"14-1\": \"Gets an address by it's key\",\n    \"15-1\": \"Gets an ICustomer or IAnonymousCustomer by its 'UniqueId'\",\n    \"16-1\": \"Gets a collection of ICustomerAddress by the customer ke\",\n    \"17-1\": \"Gets a collection of ICustomerAddress by the customer key filtered by an AddressType\",\n    \"18-1\": \"Gets a customer by its unique id\",\n    \"19-1\": \"Gets a list of customer give a list of unique keys\",\n    \"20-1\": \"Gets a list of customer give a list of unique keys\",\n    \"21-1\": \"Gets the default customer address of a certain type\",\n    \"22-1\": \"Gets a page of customers from a collection.\",\n    \"23-1\": \"Gets a page of customers from a collection with a search term.\",\n    \"24-1\": \"Gets a page of customers.\",\n    \"25-1\": \"Removes a customer from a collection\",\n    \"26-1\": \"Removes a customer from a collection\",\n    \"27-1\": \"Removes a customer from a collection\",\n    \"28-1\": \"Saves a single ICustomerAddress\",\n    \"29-1\": \"Saves a collection ICustomerAddress\",\n    \"30-1\": \"Saves a single IAnonymousCustomer\",\n    \"31-1\": \"Saves a single ICustomer\",\n    \"32-1\": \"Saves a collection of ICustomer\"\n  },\n  \"cols\": 2,\n  \"rows\": 33\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before saving\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after saved\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs)","slug":"customerservice","title":"CustomerService","category":"56b92aff08d8b20d00bc3b09","updates":[],"githubsync":"","childrenPages":[]}

CustomerService

Describes the CustomerService

These routines provide a way to generate new customer records. In Merchello, we have two types of customers. Anonymous customers are everyday shoppers who have not authenticated the site and use the AnonymousCustomer class. Authenticated shoppers (members in the Umbraco world) use the Customer class. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The CustomerService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var customerService = MerchelloContext.Current.Services.CustomerService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class CustomerService : PageCachedServiceBase<ICustomer>, \n\tICustomerService, IPageCachedService<ICustomer>, IService, IStaticCollectionService<ICustomer>", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CustomerService()", "1-0": "CustomerService(ILogger)", "2-0": "CustomerService(RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)", "3-0": "CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)", "4-0": "CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)", "0-1": "Initializes a new instance of the CustomerService class.", "1-1": "Initializes a new instance of the CustomerService class.", "2-1": "Initializes a new instance of the CustomerService class.", "3-1": "Initializes a new instance of the CustomerService class.", "4-1": "Initializes a new instance of the CustomerService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddToCollection(Guid, Guid)", "1-0": "AddToCollection(ICustomer, IEntityCollection)", "2-0": "AddToCollection(ICustomer, Guid)", "3-0": "CreateAnonymousCustomerWithKey", "4-0": "CreateCustomer", "5-0": "CreateCustomerWithKey(String)", "6-0": "CreateCustomerWithKey(String, String, String, String)", "7-0": "CustomerCount", "8-0": "Delete(IAnonymousCustomer)", "9-0": "Delete(IEnumerable(IAnonymousCustomer))", "10-0": "Delete(ICustomerAddress)", "11-0": "Delete(ICustomerAddress)", "12-0": "Delete(IEnumerable(ICustomer), Boolean)", "13-0": "ExistsInCollection", "15-0": "GetAnyByKey", "16-0": "GetByCustomerKey(Guid)", "17-0": "GetByCustomerKey(Guid, AddressType)", "18-0": "GetByKey", "19-0": "GetByKeys", "20-0": "GetByLoginName", "21-0": "GetDefaultCustomerAddress", "22-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "23-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "24-0": "GetPage", "25-0": "RemoveFromCollection(Guid, Guid)", "26-0": "RemoveFromCollection(ICustomer, IEntityCollection)", "27-0": "RemoveFromCollection(ICustomer, Guid)", "28-0": "Save(ICustomerAddress)", "29-0": "Save(IEnumerable(ICustomerAddress))", "30-0": "Save(IAnonymousCustomer, Boolean)", "31-0": "Save(ICustomer, Boolean)", "32-0": "Save(IEnumerable(ICustomer), Boolean)", "0-1": "Add a customer to a collection.", "1-1": "Add a customer to a collection.", "2-1": "Add a customer to a collection.", "3-1": "Creates an IAnonymousCustomer and saves it to the database", "4-1": "Creates a customer without saving to the database", "5-1": "Creates a customer with the Umbraco login name", "6-1": "Creates a customer and saves the record to the database", "7-1": "Gets the total customer count.", "8-1": "Deletes a single IAnonymousCustomer", "9-1": "Deletes a collection of IAnonymousCustomer objects", "10-1": "Delete(ICustomerAddress)", "11-1": "Deletes a single ICustomer", "12-1": "Deletes a collection ICustomer", "13-1": "Determines if an customer exists in a collection.", "14-0": "GetAddressByKey", "14-1": "Gets an address by it's key", "15-1": "Gets an ICustomer or IAnonymousCustomer by its 'UniqueId'", "16-1": "Gets a collection of ICustomerAddress by the customer ke", "17-1": "Gets a collection of ICustomerAddress by the customer key filtered by an AddressType", "18-1": "Gets a customer by its unique id", "19-1": "Gets a list of customer give a list of unique keys", "20-1": "Gets a list of customer give a list of unique keys", "21-1": "Gets the default customer address of a certain type", "22-1": "Gets a page of customers from a collection.", "23-1": "Gets a page of customers from a collection with a search term.", "24-1": "Gets a page of customers.", "25-1": "Removes a customer from a collection", "26-1": "Removes a customer from a collection", "27-1": "Removes a customer from a collection", "28-1": "Saves a single ICustomerAddress", "29-1": "Saves a collection ICustomerAddress", "30-1": "Saves a single IAnonymousCustomer", "31-1": "Saves a single ICustomer", "32-1": "Saves a collection of ICustomer" }, "cols": 2, "rows": 33 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before saving", "5-0": "Saved", "5-1": "Occurs after saved" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs)
These routines provide a way to generate new customer records. In Merchello, we have two types of customers. Anonymous customers are everyday shoppers who have not authenticated the site and use the AnonymousCustomer class. Authenticated shoppers (members in the Umbraco world) use the Customer class. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The CustomerService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var customerService = MerchelloContext.Current.Services.CustomerService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class CustomerService : PageCachedServiceBase<ICustomer>, \n\tICustomerService, IPageCachedService<ICustomer>, IService, IStaticCollectionService<ICustomer>", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CustomerService()", "1-0": "CustomerService(ILogger)", "2-0": "CustomerService(RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)", "3-0": "CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)", "4-0": "CustomerService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IAnonymousCustomerService, ICustomerAddressService, IInvoiceService, IPaymentService)", "0-1": "Initializes a new instance of the CustomerService class.", "1-1": "Initializes a new instance of the CustomerService class.", "2-1": "Initializes a new instance of the CustomerService class.", "3-1": "Initializes a new instance of the CustomerService class.", "4-1": "Initializes a new instance of the CustomerService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddToCollection(Guid, Guid)", "1-0": "AddToCollection(ICustomer, IEntityCollection)", "2-0": "AddToCollection(ICustomer, Guid)", "3-0": "CreateAnonymousCustomerWithKey", "4-0": "CreateCustomer", "5-0": "CreateCustomerWithKey(String)", "6-0": "CreateCustomerWithKey(String, String, String, String)", "7-0": "CustomerCount", "8-0": "Delete(IAnonymousCustomer)", "9-0": "Delete(IEnumerable(IAnonymousCustomer))", "10-0": "Delete(ICustomerAddress)", "11-0": "Delete(ICustomerAddress)", "12-0": "Delete(IEnumerable(ICustomer), Boolean)", "13-0": "ExistsInCollection", "15-0": "GetAnyByKey", "16-0": "GetByCustomerKey(Guid)", "17-0": "GetByCustomerKey(Guid, AddressType)", "18-0": "GetByKey", "19-0": "GetByKeys", "20-0": "GetByLoginName", "21-0": "GetDefaultCustomerAddress", "22-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "23-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "24-0": "GetPage", "25-0": "RemoveFromCollection(Guid, Guid)", "26-0": "RemoveFromCollection(ICustomer, IEntityCollection)", "27-0": "RemoveFromCollection(ICustomer, Guid)", "28-0": "Save(ICustomerAddress)", "29-0": "Save(IEnumerable(ICustomerAddress))", "30-0": "Save(IAnonymousCustomer, Boolean)", "31-0": "Save(ICustomer, Boolean)", "32-0": "Save(IEnumerable(ICustomer), Boolean)", "0-1": "Add a customer to a collection.", "1-1": "Add a customer to a collection.", "2-1": "Add a customer to a collection.", "3-1": "Creates an IAnonymousCustomer and saves it to the database", "4-1": "Creates a customer without saving to the database", "5-1": "Creates a customer with the Umbraco login name", "6-1": "Creates a customer and saves the record to the database", "7-1": "Gets the total customer count.", "8-1": "Deletes a single IAnonymousCustomer", "9-1": "Deletes a collection of IAnonymousCustomer objects", "10-1": "Delete(ICustomerAddress)", "11-1": "Deletes a single ICustomer", "12-1": "Deletes a collection ICustomer", "13-1": "Determines if an customer exists in a collection.", "14-0": "GetAddressByKey", "14-1": "Gets an address by it's key", "15-1": "Gets an ICustomer or IAnonymousCustomer by its 'UniqueId'", "16-1": "Gets a collection of ICustomerAddress by the customer ke", "17-1": "Gets a collection of ICustomerAddress by the customer key filtered by an AddressType", "18-1": "Gets a customer by its unique id", "19-1": "Gets a list of customer give a list of unique keys", "20-1": "Gets a list of customer give a list of unique keys", "21-1": "Gets the default customer address of a certain type", "22-1": "Gets a page of customers from a collection.", "23-1": "Gets a page of customers from a collection with a search term.", "24-1": "Gets a page of customers.", "25-1": "Removes a customer from a collection", "26-1": "Removes a customer from a collection", "27-1": "Removes a customer from a collection", "28-1": "Saves a single ICustomerAddress", "29-1": "Saves a collection ICustomerAddress", "30-1": "Saves a single IAnonymousCustomer", "31-1": "Saves a single ICustomer", "32-1": "Saves a collection of ICustomer" }, "cols": 2, "rows": 33 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before saving", "5-0": "Saved", "5-1": "Occurs after saved" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/ICustomerService.cs)
{"_id":"56b92b0408d8b20d00bc3b2a","updates":[],"api":{"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"order":36,"slug":"detachedcontenttypeservice","type":"basic","title":"DetachedContentTypeService","createdAt":"2015-11-17T21:14:32.425Z","excerpt":"Documentation for the DetachedContentTypeService","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","link_external":false,"link_url":"","githubsync":"","sync_unique":"","category":"56b92aff08d8b20d00bc3b09","user":"564136b9f424a10d001181e1","hidden":false,"body":"The DetachedContentTypeService is responsible for managing the association of Umbraco ContentType(s) and Merchello DetachedContentType.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var detachedContentService = MerchelloContext.Current.Services.DetachedContentTypeService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The DetachedContentTypeService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"CreateDetachedContentType(Guid, Guid, String, Boolean)\",\n    \"1-0\": \"CreateDetachedContentType(EntityType, Guid, String, Boolean)\",\n    \"2-0\": \"CreateDetachedContentTypeWithKey(Guid, Guid, String, Boolean)\",\n    \"3-0\": \"CreateDetachedContentTypeWithKey(EntityType, Guid, String, Boolean)\",\n    \"4-0\": \"Delete(IDetachedContentType, Boolean)\",\n    \"5-0\": \"GetAll\",\n    \"6-0\": \"GetByKey\",\n    \"7-0\": \"GetDetachedContentTypesByContentTypeKey\",\n    \"8-0\": \"GetDetachedContentTypesByEntityTfKey\",\n    \"9-0\": \"Save(IDetachedContentType, Boolean)\",\n    \"10-0\": \"Save(IEnumerable(IDetachedContentType), Boolean)\",\n    \"10-1\": \"Saves a collection of IDetachedContentType.\",\n    \"9-1\": \"Saves a single instance of IDetachedContentType.\",\n    \"8-1\": \"Gets a collection of IDetachedContentType by the entity type key.\",\n    \"7-1\": \"Gets a collection of IDetachedContentType by the Umbraco content type key.\",\n    \"6-1\": \"Gets a IDetachedContentType by it's unique key.\",\n    \"5-1\": \"Gets all IDetachedContentType(s).\",\n    \"4-1\": \"Deletes a single instance of IDetachedContentType.\",\n    \"3-1\": \"Creates a IDetachedContentType and saves to the database.\",\n    \"2-1\": \"Creates a IDetachedContentType and saves to the database.\",\n    \"1-1\": \"Creates a IDetachedContentType without saving it to the database.\",\n    \"0-1\": \"Creates a IDetachedContentType without saving it to the database.\"\n  },\n  \"cols\": 2,\n  \"rows\": 11\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Creating\",\n    \"1-0\": \"Created\",\n    \"2-0\": \"Deleting\",\n    \"3-0\": \"Deleted\",\n    \"4-0\": \"Saving\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after save\",\n    \"4-1\": \"Occurs before save\",\n    \"3-1\": \"Occurs after delete\",\n    \"2-1\": \"Occurs before delete\",\n    \"1-1\": \"Occurs after create\",\n    \"0-1\": \"Occurs before create\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]","__v":0,"childrenPages":[]}

DetachedContentTypeService

Documentation for the DetachedContentTypeService

The DetachedContentTypeService is responsible for managing the association of Umbraco ContentType(s) and Merchello DetachedContentType. [block:code] { "codes": [ { "code": "var detachedContentService = MerchelloContext.Current.Services.DetachedContentTypeService;", "language": "csharp" } ], "sidebar": true } [/block] [block:textarea] { "text": "The DetachedContentTypeService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "0-0": "CreateDetachedContentType(Guid, Guid, String, Boolean)", "1-0": "CreateDetachedContentType(EntityType, Guid, String, Boolean)", "2-0": "CreateDetachedContentTypeWithKey(Guid, Guid, String, Boolean)", "3-0": "CreateDetachedContentTypeWithKey(EntityType, Guid, String, Boolean)", "4-0": "Delete(IDetachedContentType, Boolean)", "5-0": "GetAll", "6-0": "GetByKey", "7-0": "GetDetachedContentTypesByContentTypeKey", "8-0": "GetDetachedContentTypesByEntityTfKey", "9-0": "Save(IDetachedContentType, Boolean)", "10-0": "Save(IEnumerable(IDetachedContentType), Boolean)", "10-1": "Saves a collection of IDetachedContentType.", "9-1": "Saves a single instance of IDetachedContentType.", "8-1": "Gets a collection of IDetachedContentType by the entity type key.", "7-1": "Gets a collection of IDetachedContentType by the Umbraco content type key.", "6-1": "Gets a IDetachedContentType by it's unique key.", "5-1": "Gets all IDetachedContentType(s).", "4-1": "Deletes a single instance of IDetachedContentType.", "3-1": "Creates a IDetachedContentType and saves to the database.", "2-1": "Creates a IDetachedContentType and saves to the database.", "1-1": "Creates a IDetachedContentType without saving it to the database.", "0-1": "Creates a IDetachedContentType without saving it to the database." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "0-0": "Creating", "1-0": "Created", "2-0": "Deleting", "3-0": "Deleted", "4-0": "Saving", "5-0": "Saved", "5-1": "Occurs after save", "4-1": "Occurs before save", "3-1": "Occurs after delete", "2-1": "Occurs before delete", "1-1": "Occurs after create", "0-1": "Occurs before create" }, "cols": 2, "rows": 6 } [/block]
The DetachedContentTypeService is responsible for managing the association of Umbraco ContentType(s) and Merchello DetachedContentType. [block:code] { "codes": [ { "code": "var detachedContentService = MerchelloContext.Current.Services.DetachedContentTypeService;", "language": "csharp" } ], "sidebar": true } [/block] [block:textarea] { "text": "The DetachedContentTypeService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "0-0": "CreateDetachedContentType(Guid, Guid, String, Boolean)", "1-0": "CreateDetachedContentType(EntityType, Guid, String, Boolean)", "2-0": "CreateDetachedContentTypeWithKey(Guid, Guid, String, Boolean)", "3-0": "CreateDetachedContentTypeWithKey(EntityType, Guid, String, Boolean)", "4-0": "Delete(IDetachedContentType, Boolean)", "5-0": "GetAll", "6-0": "GetByKey", "7-0": "GetDetachedContentTypesByContentTypeKey", "8-0": "GetDetachedContentTypesByEntityTfKey", "9-0": "Save(IDetachedContentType, Boolean)", "10-0": "Save(IEnumerable(IDetachedContentType), Boolean)", "10-1": "Saves a collection of IDetachedContentType.", "9-1": "Saves a single instance of IDetachedContentType.", "8-1": "Gets a collection of IDetachedContentType by the entity type key.", "7-1": "Gets a collection of IDetachedContentType by the Umbraco content type key.", "6-1": "Gets a IDetachedContentType by it's unique key.", "5-1": "Gets all IDetachedContentType(s).", "4-1": "Deletes a single instance of IDetachedContentType.", "3-1": "Creates a IDetachedContentType and saves to the database.", "2-1": "Creates a IDetachedContentType and saves to the database.", "1-1": "Creates a IDetachedContentType without saving it to the database.", "0-1": "Creates a IDetachedContentType without saving it to the database." }, "cols": 2, "rows": 11 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "0-0": "Creating", "1-0": "Created", "2-0": "Deleting", "3-0": "Deleted", "4-0": "Saving", "5-0": "Saved", "5-1": "Occurs after save", "4-1": "Occurs before save", "3-1": "Occurs after delete", "2-1": "Occurs before delete", "1-1": "Occurs after create", "0-1": "Occurs before create" }, "cols": 2, "rows": 6 } [/block]
{"_id":"56b92b0408d8b20d00bc3b2b","createdAt":"2015-11-10T20:21:47.172Z","githubsync":"","hidden":false,"category":"56b92aff08d8b20d00bc3b09","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","order":37,"body":"This service is used to manage entity collections.   Both Static and Dynamic Collections are managed with the EntityCollectionService.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The EntityCollectionService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var entityCollectionService = MerchelloContext.Current.Services.EntityCollectionService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class EntityCollectionService : MerchelloRepositoryService, \\n\\tIEntityCollectionService, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"EntityCollectionService()\",\n    \"1-0\": \"EntityCollectionService(ILogger)\",\n    \"2-0\": \"EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)\",\n    \"3-0\": \"EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)\",\n    \"0-1\": \"Initializes a new instance of the EntityCollectionService class.\",\n    \"1-1\": \"Initializes a new instance of the EntityCollectionService class.\",\n    \"2-1\": \"Initializes a new instance of the EntityCollectionService class.\",\n    \"3-1\": \"Initializes a new instance of the EntityCollectionService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ChildEntityCollectionCount\",\n    \"1-0\": \"CreateEntityCollection(EntityType, Guid, String, Boolean)\",\n    \"2-0\": \"CreateEntityCollectionWithKey(EntityType, Guid, String, Boolean)\",\n    \"3-0\": \"Delete(IEntityCollection, Boolean)\",\n    \"4-0\": \"ExistsInCollection\",\n    \"5-0\": \"GetAll\",\n    \"6-0\": \"GetByEntityTfKey\",\n    \"7-0\": \"GetByKey\",\n    \"8-0\": \"GetByProviderKey\",\n    \"9-0\": \"GetChildren\",\n    \"10-0\": \"GetFromCollection\",\n    \"11-0\": \"GetRootLevelEntityCollections()\",\n    \"12-0\": \"GetRootLevelEntityCollections(Guid)\",\n    \"13-0\": \"GetRootLevelEntityCollections(EntityType)\",\n    \"15-0\": \"Save(IEntityCollection, Boolean)\",\n    \"16-0\": \"Save(IEnumerable(IEntityCollection), Boolean)\",\n    \"16-1\": \"Saves a collection of entity collections.\",\n    \"15-1\": \"Saves a single entity collection.\",\n    \"13-1\": \"Gets the root level entity collections for a specific entity type.\",\n    \"14-0\": \"HasChildEntityCollections\",\n    \"14-1\": \"Returns a value indicating whether or not a collection has child collections\",\n    \"12-1\": \"Gets the root level entity collections for a specific entity type.\",\n    \"11-1\": \"Gets the root level entity collections\",\n    \"10-1\": \"Get an entity from a collection\",\n    \"9-1\": \"Gets a collection's child collections\",\n    \"8-1\": \"Gets collections for a given provider key\",\n    \"7-1\": \"Gets a collection by it's unique key\",\n    \"6-1\": \"Gets collections by entity type\",\n    \"5-1\": \"Gets all collection\",\n    \"4-1\": \"Returns a value indicating whether or not an entity exists in a collection\",\n    \"3-1\": \"Deletes a single entity collection.\",\n    \"2-1\": \"Creates an entity collection and saves it to the database\",\n    \"1-1\": \"Creates an entity collection without saving it to the database\",\n    \"0-1\": \"Returns the child collection count\"\n  },\n  \"cols\": 2,\n  \"rows\": 17\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before save\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after save\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs)","__v":0,"title":"EntityCollectionService","updates":[],"link_url":"","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"excerpt":"Documentation for the Merch EntityCollectionService","type":"basic","link_external":false,"sync_unique":"","slug":"entitycollectionservice","childrenPages":[]}

EntityCollectionService

Documentation for the Merch EntityCollectionService

This service is used to manage entity collections. Both Static and Dynamic Collections are managed with the EntityCollectionService. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The EntityCollectionService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var entityCollectionService = MerchelloContext.Current.Services.EntityCollectionService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class EntityCollectionService : MerchelloRepositoryService, \n\tIEntityCollectionService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "EntityCollectionService()", "1-0": "EntityCollectionService(ILogger)", "2-0": "EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)", "3-0": "EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)", "0-1": "Initializes a new instance of the EntityCollectionService class.", "1-1": "Initializes a new instance of the EntityCollectionService class.", "2-1": "Initializes a new instance of the EntityCollectionService class.", "3-1": "Initializes a new instance of the EntityCollectionService class." }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ChildEntityCollectionCount", "1-0": "CreateEntityCollection(EntityType, Guid, String, Boolean)", "2-0": "CreateEntityCollectionWithKey(EntityType, Guid, String, Boolean)", "3-0": "Delete(IEntityCollection, Boolean)", "4-0": "ExistsInCollection", "5-0": "GetAll", "6-0": "GetByEntityTfKey", "7-0": "GetByKey", "8-0": "GetByProviderKey", "9-0": "GetChildren", "10-0": "GetFromCollection", "11-0": "GetRootLevelEntityCollections()", "12-0": "GetRootLevelEntityCollections(Guid)", "13-0": "GetRootLevelEntityCollections(EntityType)", "15-0": "Save(IEntityCollection, Boolean)", "16-0": "Save(IEnumerable(IEntityCollection), Boolean)", "16-1": "Saves a collection of entity collections.", "15-1": "Saves a single entity collection.", "13-1": "Gets the root level entity collections for a specific entity type.", "14-0": "HasChildEntityCollections", "14-1": "Returns a value indicating whether or not a collection has child collections", "12-1": "Gets the root level entity collections for a specific entity type.", "11-1": "Gets the root level entity collections", "10-1": "Get an entity from a collection", "9-1": "Gets a collection's child collections", "8-1": "Gets collections for a given provider key", "7-1": "Gets a collection by it's unique key", "6-1": "Gets collections by entity type", "5-1": "Gets all collection", "4-1": "Returns a value indicating whether or not an entity exists in a collection", "3-1": "Deletes a single entity collection.", "2-1": "Creates an entity collection and saves it to the database", "1-1": "Creates an entity collection without saving it to the database", "0-1": "Returns the child collection count" }, "cols": 2, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs)
This service is used to manage entity collections. Both Static and Dynamic Collections are managed with the EntityCollectionService. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The EntityCollectionService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var entityCollectionService = MerchelloContext.Current.Services.EntityCollectionService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class EntityCollectionService : MerchelloRepositoryService, \n\tIEntityCollectionService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "EntityCollectionService()", "1-0": "EntityCollectionService(ILogger)", "2-0": "EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)", "3-0": "EntityCollectionService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)", "0-1": "Initializes a new instance of the EntityCollectionService class.", "1-1": "Initializes a new instance of the EntityCollectionService class.", "2-1": "Initializes a new instance of the EntityCollectionService class.", "3-1": "Initializes a new instance of the EntityCollectionService class." }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ChildEntityCollectionCount", "1-0": "CreateEntityCollection(EntityType, Guid, String, Boolean)", "2-0": "CreateEntityCollectionWithKey(EntityType, Guid, String, Boolean)", "3-0": "Delete(IEntityCollection, Boolean)", "4-0": "ExistsInCollection", "5-0": "GetAll", "6-0": "GetByEntityTfKey", "7-0": "GetByKey", "8-0": "GetByProviderKey", "9-0": "GetChildren", "10-0": "GetFromCollection", "11-0": "GetRootLevelEntityCollections()", "12-0": "GetRootLevelEntityCollections(Guid)", "13-0": "GetRootLevelEntityCollections(EntityType)", "15-0": "Save(IEntityCollection, Boolean)", "16-0": "Save(IEnumerable(IEntityCollection), Boolean)", "16-1": "Saves a collection of entity collections.", "15-1": "Saves a single entity collection.", "13-1": "Gets the root level entity collections for a specific entity type.", "14-0": "HasChildEntityCollections", "14-1": "Returns a value indicating whether or not a collection has child collections", "12-1": "Gets the root level entity collections for a specific entity type.", "11-1": "Gets the root level entity collections", "10-1": "Get an entity from a collection", "9-1": "Gets a collection's child collections", "8-1": "Gets collections for a given provider key", "7-1": "Gets a collection by it's unique key", "6-1": "Gets collections by entity type", "5-1": "Gets all collection", "4-1": "Returns a value indicating whether or not an entity exists in a collection", "3-1": "Deletes a single entity collection.", "2-1": "Creates an entity collection and saves it to the database", "1-1": "Creates an entity collection without saving it to the database", "0-1": "Returns the child collection count" }, "cols": 2, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/EntityCollectionService.cs)
{"_id":"56b92b0408d8b20d00bc3b2c","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","link_external":false,"hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"order":38,"__v":0,"updates":[],"createdAt":"2015-11-10T20:21:56.191Z","githubsync":"","sync_unique":"","body":"The GatewayProvider service allows you to get to the gateways in Merchello. Gateways.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Passed to all instantiated Gateway Providers\",\n  \"body\": \"This class will eventually be obsoleted.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Intantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The GatewayProviderService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var gatewayProviderService = MerchelloContext.Current.Services.GatewayProviderService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class GatewayProviderService : MerchelloRepositoryService, \\n\\tIGatewayProviderService, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GatewayProviderService()\",\n    \"1-0\": \"GatewayProviderService(ILogger)\",\n    \"0-1\": \"Initializes a new instance of the GatewayProviderService class.\",\n    \"1-1\": \"Initializes a new instance of the GatewayProviderService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ApplyPaymentToInvoice\",\n    \"1-0\": \"CreateNotificationMessageWithKey\",\n    \"2-0\": \"CreateNotificationMethodWithKey\",\n    \"3-0\": \"CreateNotificationMethodWithKey\",\n    \"4-0\": \"CreatePaymentMethodWithKey\",\n    \"5-0\": \"CreatePaymentWithKey\",\n    \"6-0\": \"CreateShipMethodWithKey\",\n    \"7-0\": \"CreateTaxMethodWithKey\",\n    \"8-0\": \"Delete(INotificationMessage)\",\n    \"9-0\": \"Delete(INotificationMethod)\",\n    \"10-0\": \"Delete(IPaymentMethod)\",\n    \"11-0\": \"Delete(IShipMethod)\",\n    \"12-0\": \"Delete(IShipRateTier)\",\n    \"13-0\": \"Delete(ITaxMethod)\",\n    \"14-0\": \"Delete(IGatewayProviderSettings, Boolean)\",\n    \"15-0\": \"GetAllGatewayProviders\",\n    \"16-0\": \"GetAllGatewayProviders\",\n    \"17-0\": \"GetAllOrderStatuses\",\n    \"18-0\": \"GetAllShipCountries\",\n    \"19-0\": \"GetAppliedPaymentsByInvoiceKey\",\n    \"20-0\": \"GetAppliedPaymentsByPaymentKey\",\n    \"21-0\": \"GetDefaultWarehouse\",\n    \"22-0\": \"GetGatewayProviderByKey\",\n    \"23-0\": \"GetGatewayProvidersByShipCountry\",\n    \"24-0\": \"GetGatewayProvidersByType\",\n    \"25-0\": \"GetNotificationMessageByKey\",\n    \"26-0\": \"GetNotificationMessageByKey\",\n    \"27-0\": \"GetNotificationMessagesByMonitorKey\",\n    \"28-0\": \"GetNotificationMethodsByProviderKey\",\n    \"29-0\": \"GetPaymentMethodsByProviderKey\",\n    \"30-0\": \"GetPaymentsForInvoice\",\n    \"32-0\": \"GetShipCountryByKey\",\n    \"33-0\": \"GetShipMethodByKey\",\n    \"34-0\": \"GetShipMethodsByShipCountryKey(Guid)\",\n    \"35-0\": \"GetShipMethodsByShipCountryKey(Guid, Guid)\",\n    \"36-0\": \"GetShipRateTiersByShipMethodKey\",\n    \"37-0\": \"GetTaxMethodByCountryCode\",\n    \"38-0\": \"GetTaxMethodForProductPricing\",\n    \"39-0\": \"GetTaxMethodsByCountryCode\",\n    \"40-0\": \"GetTaxMethodsByProviderKey\",\n    \"41-0\": \"Save(IAppliedPayment)\",\n    \"42-0\": \"Save(IInvoice)\",\n    \"43-0\": \"Save(INotificationMessage)\",\n    \"44-0\": \"Save(INotificationMessage)\",\n    \"45-0\": \"Save(IPayment)\",\n    \"46-0\": \"Save(IPaymentMethod)\",\n    \"47-0\": \"Save(IShipMethod)\",\n    \"48-0\": \"Save(IEnumerable(IShipMethod))\",\n    \"49-0\": \"Save(IShipRateTier)\",\n    \"50-0\": \"Save(IShipRateTier)\",\n    \"51-0\": \"Save(ITaxMethod)\",\n    \"52-0\": \"Save(IGatewayProviderSettings, Boolean)\",\n    \"52-1\": \"Saves a single instance of a IGatewayProviderSettings\",\n    \"51-1\": \"Saves a single ITaxMethod\",\n    \"50-1\": \"Saves a collection of IShipRateTier\",\n    \"49-1\": \"Saves a single IShipRateTier\",\n    \"48-1\": \"Saves a collection of IShipMethod\",\n    \"47-1\": \"Saves a single IShipMethod\",\n    \"46-1\": \"Saves a single IPaymentMethod\",\n    \"45-1\": \"Saves a single IPayment\",\n    \"44-1\": \"Saves a INotificationMethod\",\n    \"43-1\": \"Saves a INotificationMessage\",\n    \"42-1\": \"Saves a single IInvoice\",\n    \"41-1\": \"Saves a single IAppliedPayme\",\n    \"40-1\": \"Gets a collection of ITaxMethod for a given TaxationGatewayProvider\",\n    \"39-1\": \"Gets a ITaxMethod based on a provider and country code\",\n    \"38-1\": \"Get tax method for product pricing.\",\n    \"37-1\": \"Gets a ITaxMethod based on a provider and country code\",\n    \"36-1\": \"Gets a list of IShipRateTier objects given a IShipMethod key\",\n    \"35-1\": \"Gets a list of IShipMethod objects given a IGatewayProviderSettings key and a IShipCountry key\",\n    \"34-1\": \"Gets a list of all IShipMethod objects given a IGatewayProviderSettings key\",\n    \"33-1\": \"Gets a IShipMethod by it's unique key\",\n    \"32-1\": \"Gets a IShipCountry by it's unique key (Guid)\",\n    \"31-0\": \"GetShipCountry\",\n    \"31-1\": \"Gets a IShipCountry by CatalogKey and CountryCode\",\n    \"30-1\": \"Gets a collection of IPayment for a given invoice\",\n    \"29-1\": \"Gets a collection of IPaymentMethod for a given PaymentGatewayProvider\",\n    \"28-1\": \"Gets a collection of INotificationMethod for a give NotificationGatewayProvider\",\n    \"27-1\": \"Gets a collection of INotificationMessages based on a monitor key\",\n    \"26-1\": \"Gets a collection of INotificationMessages based on a monitor key\",\n    \"25-1\": \"Gets a INotificationMethod by it's unique key(Guid)\",\n    \"24-1\": \"Gets a collection of IGatewayProviderSettings by its type (Shipping, Taxation, Payment)\",\n    \"23-1\": \"Gets a collection of IGatewayProviderSettings by ship country\",\n    \"22-1\": \"Gets a IGatewayProviderSettings by it's unique 'Key' (Guid)\",\n    \"21-1\": \"Gets the default IWarehouse\",\n    \"20-1\": \"Gets a collection of IAppliedPayments by the payment key\",\n    \"19-1\": \"Gets a collection of IAppliedPayments by the invoice key\",\n    \"18-1\": \"Returns a collection of all IShipCountry\",\n    \"17-1\": \"Returns a collection of all IOrderStatus\",\n    \"16-1\": \"Returns a collection of all IInvoiceStatus\",\n    \"15-1\": \"Gets a collection containing all IGatewayProviderSettings\",\n    \"14-1\": \"Deletes a IGatewayProviderSettings\",\n    \"13-1\": \"Deletes a ITaxMethod\",\n    \"12-1\": \"Deletes a IShipRateTier\",\n    \"11-1\": \"Deletes a IShipMethod\",\n    \"10-1\": \"Deletes a single IPaymentMethod\",\n    \"9-1\": \"Deletes a INotificationMethod\",\n    \"8-1\": \"Deletes a INotificationMessage\",\n    \"7-1\": \"Attempts to create a ITaxMethod for a given provider and country. If the provider already defines a tax rate for the country, the creation fails.\",\n    \"6-1\": \"Creates a IShipMethod. This is useful due to the data constraint preventing two ShipMethods being created with the same ShipCountry and ServiceCode for any provider.\",\n    \"5-1\": \"Creates and saves a payment\",\n    \"4-1\": \"Attempts to create a IPaymentMethod for a given provider. If the provider already defines a paymentCode, the creation fails.\",\n    \"3-1\": \"Creates a payment without saving it to the database\",\n    \"2-1\": \"Creates a INotificationMethod and saves it to the database\",\n    \"1-1\": \"Creates a INotificationMessage and saves it to the database\",\n    \"0-1\": \"Creates and saves an AppliedPayment\"\n  },\n  \"cols\": 2,\n  \"rows\": 53\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Deleting\",\n    \"0-1\": \"Occurs before delete\",\n    \"1-0\": \"Deleted\",\n    \"1-1\": \"Occurs after delete\",\n    \"2-0\": \"Saving\",\n    \"2-1\": \"Occurs before saving\",\n    \"3-0\": \"Saved\",\n    \"3-1\": \"Occurs after saved\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"GatewayProviderSerivce\",\n  \"body\": \"Events associated with the GatewayProviderService are only fired for methods associated with `IGatewayProviderSettings`\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs)","slug":"gatewayproviderservice","title":"GatewayProviderService","user":"564136b9f424a10d001181e1","link_url":"","type":"basic","category":"56b92aff08d8b20d00bc3b09","excerpt":"","childrenPages":[]}

GatewayProviderService


The GatewayProvider service allows you to get to the gateways in Merchello. Gateways. [block:callout] { "type": "warning", "title": "Passed to all instantiated Gateway Providers", "body": "This class will eventually be obsoleted." } [/block] [block:api-header] { "type": "basic", "title": "Intantiating", "sidebar": true } [/block] [block:textarea] { "text": "The GatewayProviderService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var gatewayProviderService = MerchelloContext.Current.Services.GatewayProviderService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class GatewayProviderService : MerchelloRepositoryService, \n\tIGatewayProviderService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GatewayProviderService()", "1-0": "GatewayProviderService(ILogger)", "0-1": "Initializes a new instance of the GatewayProviderService class.", "1-1": "Initializes a new instance of the GatewayProviderService class." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ApplyPaymentToInvoice", "1-0": "CreateNotificationMessageWithKey", "2-0": "CreateNotificationMethodWithKey", "3-0": "CreateNotificationMethodWithKey", "4-0": "CreatePaymentMethodWithKey", "5-0": "CreatePaymentWithKey", "6-0": "CreateShipMethodWithKey", "7-0": "CreateTaxMethodWithKey", "8-0": "Delete(INotificationMessage)", "9-0": "Delete(INotificationMethod)", "10-0": "Delete(IPaymentMethod)", "11-0": "Delete(IShipMethod)", "12-0": "Delete(IShipRateTier)", "13-0": "Delete(ITaxMethod)", "14-0": "Delete(IGatewayProviderSettings, Boolean)", "15-0": "GetAllGatewayProviders", "16-0": "GetAllGatewayProviders", "17-0": "GetAllOrderStatuses", "18-0": "GetAllShipCountries", "19-0": "GetAppliedPaymentsByInvoiceKey", "20-0": "GetAppliedPaymentsByPaymentKey", "21-0": "GetDefaultWarehouse", "22-0": "GetGatewayProviderByKey", "23-0": "GetGatewayProvidersByShipCountry", "24-0": "GetGatewayProvidersByType", "25-0": "GetNotificationMessageByKey", "26-0": "GetNotificationMessageByKey", "27-0": "GetNotificationMessagesByMonitorKey", "28-0": "GetNotificationMethodsByProviderKey", "29-0": "GetPaymentMethodsByProviderKey", "30-0": "GetPaymentsForInvoice", "32-0": "GetShipCountryByKey", "33-0": "GetShipMethodByKey", "34-0": "GetShipMethodsByShipCountryKey(Guid)", "35-0": "GetShipMethodsByShipCountryKey(Guid, Guid)", "36-0": "GetShipRateTiersByShipMethodKey", "37-0": "GetTaxMethodByCountryCode", "38-0": "GetTaxMethodForProductPricing", "39-0": "GetTaxMethodsByCountryCode", "40-0": "GetTaxMethodsByProviderKey", "41-0": "Save(IAppliedPayment)", "42-0": "Save(IInvoice)", "43-0": "Save(INotificationMessage)", "44-0": "Save(INotificationMessage)", "45-0": "Save(IPayment)", "46-0": "Save(IPaymentMethod)", "47-0": "Save(IShipMethod)", "48-0": "Save(IEnumerable(IShipMethod))", "49-0": "Save(IShipRateTier)", "50-0": "Save(IShipRateTier)", "51-0": "Save(ITaxMethod)", "52-0": "Save(IGatewayProviderSettings, Boolean)", "52-1": "Saves a single instance of a IGatewayProviderSettings", "51-1": "Saves a single ITaxMethod", "50-1": "Saves a collection of IShipRateTier", "49-1": "Saves a single IShipRateTier", "48-1": "Saves a collection of IShipMethod", "47-1": "Saves a single IShipMethod", "46-1": "Saves a single IPaymentMethod", "45-1": "Saves a single IPayment", "44-1": "Saves a INotificationMethod", "43-1": "Saves a INotificationMessage", "42-1": "Saves a single IInvoice", "41-1": "Saves a single IAppliedPayme", "40-1": "Gets a collection of ITaxMethod for a given TaxationGatewayProvider", "39-1": "Gets a ITaxMethod based on a provider and country code", "38-1": "Get tax method for product pricing.", "37-1": "Gets a ITaxMethod based on a provider and country code", "36-1": "Gets a list of IShipRateTier objects given a IShipMethod key", "35-1": "Gets a list of IShipMethod objects given a IGatewayProviderSettings key and a IShipCountry key", "34-1": "Gets a list of all IShipMethod objects given a IGatewayProviderSettings key", "33-1": "Gets a IShipMethod by it's unique key", "32-1": "Gets a IShipCountry by it's unique key (Guid)", "31-0": "GetShipCountry", "31-1": "Gets a IShipCountry by CatalogKey and CountryCode", "30-1": "Gets a collection of IPayment for a given invoice", "29-1": "Gets a collection of IPaymentMethod for a given PaymentGatewayProvider", "28-1": "Gets a collection of INotificationMethod for a give NotificationGatewayProvider", "27-1": "Gets a collection of INotificationMessages based on a monitor key", "26-1": "Gets a collection of INotificationMessages based on a monitor key", "25-1": "Gets a INotificationMethod by it's unique key(Guid)", "24-1": "Gets a collection of IGatewayProviderSettings by its type (Shipping, Taxation, Payment)", "23-1": "Gets a collection of IGatewayProviderSettings by ship country", "22-1": "Gets a IGatewayProviderSettings by it's unique 'Key' (Guid)", "21-1": "Gets the default IWarehouse", "20-1": "Gets a collection of IAppliedPayments by the payment key", "19-1": "Gets a collection of IAppliedPayments by the invoice key", "18-1": "Returns a collection of all IShipCountry", "17-1": "Returns a collection of all IOrderStatus", "16-1": "Returns a collection of all IInvoiceStatus", "15-1": "Gets a collection containing all IGatewayProviderSettings", "14-1": "Deletes a IGatewayProviderSettings", "13-1": "Deletes a ITaxMethod", "12-1": "Deletes a IShipRateTier", "11-1": "Deletes a IShipMethod", "10-1": "Deletes a single IPaymentMethod", "9-1": "Deletes a INotificationMethod", "8-1": "Deletes a INotificationMessage", "7-1": "Attempts to create a ITaxMethod for a given provider and country. If the provider already defines a tax rate for the country, the creation fails.", "6-1": "Creates a IShipMethod. This is useful due to the data constraint preventing two ShipMethods being created with the same ShipCountry and ServiceCode for any provider.", "5-1": "Creates and saves a payment", "4-1": "Attempts to create a IPaymentMethod for a given provider. If the provider already defines a paymentCode, the creation fails.", "3-1": "Creates a payment without saving it to the database", "2-1": "Creates a INotificationMethod and saves it to the database", "1-1": "Creates a INotificationMessage and saves it to the database", "0-1": "Creates and saves an AppliedPayment" }, "cols": 2, "rows": 53 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Deleting", "0-1": "Occurs before delete", "1-0": "Deleted", "1-1": "Occurs after delete", "2-0": "Saving", "2-1": "Occurs before saving", "3-0": "Saved", "3-1": "Occurs after saved" }, "cols": 2, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "GatewayProviderSerivce", "body": "Events associated with the GatewayProviderService are only fired for methods associated with `IGatewayProviderSettings`" } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs)
The GatewayProvider service allows you to get to the gateways in Merchello. Gateways. [block:callout] { "type": "warning", "title": "Passed to all instantiated Gateway Providers", "body": "This class will eventually be obsoleted." } [/block] [block:api-header] { "type": "basic", "title": "Intantiating", "sidebar": true } [/block] [block:textarea] { "text": "The GatewayProviderService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var gatewayProviderService = MerchelloContext.Current.Services.GatewayProviderService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class GatewayProviderService : MerchelloRepositoryService, \n\tIGatewayProviderService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "GatewayProviderService()", "1-0": "GatewayProviderService(ILogger)", "0-1": "Initializes a new instance of the GatewayProviderService class.", "1-1": "Initializes a new instance of the GatewayProviderService class." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ApplyPaymentToInvoice", "1-0": "CreateNotificationMessageWithKey", "2-0": "CreateNotificationMethodWithKey", "3-0": "CreateNotificationMethodWithKey", "4-0": "CreatePaymentMethodWithKey", "5-0": "CreatePaymentWithKey", "6-0": "CreateShipMethodWithKey", "7-0": "CreateTaxMethodWithKey", "8-0": "Delete(INotificationMessage)", "9-0": "Delete(INotificationMethod)", "10-0": "Delete(IPaymentMethod)", "11-0": "Delete(IShipMethod)", "12-0": "Delete(IShipRateTier)", "13-0": "Delete(ITaxMethod)", "14-0": "Delete(IGatewayProviderSettings, Boolean)", "15-0": "GetAllGatewayProviders", "16-0": "GetAllGatewayProviders", "17-0": "GetAllOrderStatuses", "18-0": "GetAllShipCountries", "19-0": "GetAppliedPaymentsByInvoiceKey", "20-0": "GetAppliedPaymentsByPaymentKey", "21-0": "GetDefaultWarehouse", "22-0": "GetGatewayProviderByKey", "23-0": "GetGatewayProvidersByShipCountry", "24-0": "GetGatewayProvidersByType", "25-0": "GetNotificationMessageByKey", "26-0": "GetNotificationMessageByKey", "27-0": "GetNotificationMessagesByMonitorKey", "28-0": "GetNotificationMethodsByProviderKey", "29-0": "GetPaymentMethodsByProviderKey", "30-0": "GetPaymentsForInvoice", "32-0": "GetShipCountryByKey", "33-0": "GetShipMethodByKey", "34-0": "GetShipMethodsByShipCountryKey(Guid)", "35-0": "GetShipMethodsByShipCountryKey(Guid, Guid)", "36-0": "GetShipRateTiersByShipMethodKey", "37-0": "GetTaxMethodByCountryCode", "38-0": "GetTaxMethodForProductPricing", "39-0": "GetTaxMethodsByCountryCode", "40-0": "GetTaxMethodsByProviderKey", "41-0": "Save(IAppliedPayment)", "42-0": "Save(IInvoice)", "43-0": "Save(INotificationMessage)", "44-0": "Save(INotificationMessage)", "45-0": "Save(IPayment)", "46-0": "Save(IPaymentMethod)", "47-0": "Save(IShipMethod)", "48-0": "Save(IEnumerable(IShipMethod))", "49-0": "Save(IShipRateTier)", "50-0": "Save(IShipRateTier)", "51-0": "Save(ITaxMethod)", "52-0": "Save(IGatewayProviderSettings, Boolean)", "52-1": "Saves a single instance of a IGatewayProviderSettings", "51-1": "Saves a single ITaxMethod", "50-1": "Saves a collection of IShipRateTier", "49-1": "Saves a single IShipRateTier", "48-1": "Saves a collection of IShipMethod", "47-1": "Saves a single IShipMethod", "46-1": "Saves a single IPaymentMethod", "45-1": "Saves a single IPayment", "44-1": "Saves a INotificationMethod", "43-1": "Saves a INotificationMessage", "42-1": "Saves a single IInvoice", "41-1": "Saves a single IAppliedPayme", "40-1": "Gets a collection of ITaxMethod for a given TaxationGatewayProvider", "39-1": "Gets a ITaxMethod based on a provider and country code", "38-1": "Get tax method for product pricing.", "37-1": "Gets a ITaxMethod based on a provider and country code", "36-1": "Gets a list of IShipRateTier objects given a IShipMethod key", "35-1": "Gets a list of IShipMethod objects given a IGatewayProviderSettings key and a IShipCountry key", "34-1": "Gets a list of all IShipMethod objects given a IGatewayProviderSettings key", "33-1": "Gets a IShipMethod by it's unique key", "32-1": "Gets a IShipCountry by it's unique key (Guid)", "31-0": "GetShipCountry", "31-1": "Gets a IShipCountry by CatalogKey and CountryCode", "30-1": "Gets a collection of IPayment for a given invoice", "29-1": "Gets a collection of IPaymentMethod for a given PaymentGatewayProvider", "28-1": "Gets a collection of INotificationMethod for a give NotificationGatewayProvider", "27-1": "Gets a collection of INotificationMessages based on a monitor key", "26-1": "Gets a collection of INotificationMessages based on a monitor key", "25-1": "Gets a INotificationMethod by it's unique key(Guid)", "24-1": "Gets a collection of IGatewayProviderSettings by its type (Shipping, Taxation, Payment)", "23-1": "Gets a collection of IGatewayProviderSettings by ship country", "22-1": "Gets a IGatewayProviderSettings by it's unique 'Key' (Guid)", "21-1": "Gets the default IWarehouse", "20-1": "Gets a collection of IAppliedPayments by the payment key", "19-1": "Gets a collection of IAppliedPayments by the invoice key", "18-1": "Returns a collection of all IShipCountry", "17-1": "Returns a collection of all IOrderStatus", "16-1": "Returns a collection of all IInvoiceStatus", "15-1": "Gets a collection containing all IGatewayProviderSettings", "14-1": "Deletes a IGatewayProviderSettings", "13-1": "Deletes a ITaxMethod", "12-1": "Deletes a IShipRateTier", "11-1": "Deletes a IShipMethod", "10-1": "Deletes a single IPaymentMethod", "9-1": "Deletes a INotificationMethod", "8-1": "Deletes a INotificationMessage", "7-1": "Attempts to create a ITaxMethod for a given provider and country. If the provider already defines a tax rate for the country, the creation fails.", "6-1": "Creates a IShipMethod. This is useful due to the data constraint preventing two ShipMethods being created with the same ShipCountry and ServiceCode for any provider.", "5-1": "Creates and saves a payment", "4-1": "Attempts to create a IPaymentMethod for a given provider. If the provider already defines a paymentCode, the creation fails.", "3-1": "Creates a payment without saving it to the database", "2-1": "Creates a INotificationMethod and saves it to the database", "1-1": "Creates a INotificationMessage and saves it to the database", "0-1": "Creates and saves an AppliedPayment" }, "cols": 2, "rows": 53 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Deleting", "0-1": "Occurs before delete", "1-0": "Deleted", "1-1": "Occurs after delete", "2-0": "Saving", "2-1": "Occurs before saving", "3-0": "Saved", "3-1": "Occurs after saved" }, "cols": 2, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "GatewayProviderSerivce", "body": "Events associated with the GatewayProviderService are only fired for methods associated with `IGatewayProviderSettings`" } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IGatewayProviderService.cs)
{"_id":"56b92b0408d8b20d00bc3b2d","createdAt":"2015-11-10T20:22:04.633Z","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"type":"basic","__v":0,"category":"56b92aff08d8b20d00bc3b09","user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","githubsync":"","sync_unique":"","title":"InvoiceService","updates":[],"hidden":false,"excerpt":"","project":"56421bcdb48bdf19006a4c97","link_external":false,"link_url":"","order":39,"body":"The Invoice service allows you to manage invoices.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The InvoiceService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var invoiceService = MerchelloContext.Current.Services.InvoiceService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class InvoiceService : PageCachedServiceBase<IInvoice>, \\n\\tIInvoiceService, IStaticCollectionService<IInvoice>, IPageCachedService<IInvoice>, \\n\\tIService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"InvoiceService()\",\n    \"1-0\": \"InvoiceService(ILogger)\",\n    \"0-1\": \"Initializes a new instance of the InvoiceService class.\",\n    \"1-1\": \"Initializes a new instance of the InvoiceService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"AddToCollection(Guid, Guid)\",\n    \"1-0\": \"AddToCollection(IInvoice, IEntityCollection)\",\n    \"2-0\": \"AddToCollection(IInvoice, Guid)\",\n    \"3-0\": \"CountInvoices\",\n    \"4-0\": \"CreateInvoice(Guid, Boolean)\",\n    \"5-0\": \"CreateInvoice(Guid, Int32, Boolean)\",\n    \"6-0\": \"Delete(IInvoice, Boolean)\",\n    \"7-0\": \"Delete(IEnumerable(IInvoice), Boolean)\",\n    \"8-0\": \"ExistsInCollection\",\n    \"9-0\": \"GetAllInvoiceStatuses\",\n    \"10-0\": \"GetByInvoiceNumber\",\n    \"11-0\": \"GetByKey\",\n    \"12-0\": \"GetByKeys\",\n    \"14-0\": \"GetFromCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"15-0\": \"GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"16-0\": \"GetInvoicesByCustomerKey\",\n    \"17-0\": \"GetInvoicesByDateRange\",\n    \"18-0\": \"GetInvoicesByPaymentKey\",\n    \"19-0\": \"GetPage\",\n    \"20-0\": \"RemoveFromCollection(Guid, Guid)\",\n    \"21-0\": \"RemoveFromCollection(IInvoice, IEntityCollection)\",\n    \"22-0\": \"RemoveFromCollection(IInvoice, Guid)\",\n    \"23-0\": \"Save(IInvoice, Boolean)\",\n    \"24-0\": \"Save(IEnumerable(IInvoice), Boolean)\",\n    \"24-1\": \"Saves a collection of IInvoice\",\n    \"23-1\": \"Saves a single IInvoice\",\n    \"22-1\": \"Removes an invoice from a collection\",\n    \"21-1\": \"Removes an invoice from a collection\",\n    \"20-1\": \"Removes an invoice from a collection\",\n    \"19-1\": \"Gets a page of invoices\",\n    \"18-1\": \"Gets a collection of IInvoice objects that are associated with a IPayment by the payments 'key'\",\n    \"17-1\": \"GetInvoicesByDateRange\",\n    \"16-1\": \"GetInvoicesByDateRange\",\n    \"15-1\": \"Gets invoices from a collection\",\n    \"14-1\": \"Gets invoices from a collection\",\n    \"12-1\": \"Gets list of IInvoice objects given a list of Keys\",\n    \"11-1\": \"Gets a IInvoice given it's unique 'key' (GUID)\",\n    \"10-1\": \"Gets a IInvoice given it's unique 'InvoiceNumber'\",\n    \"9-1\": \"Returns a collection of all IInvoiceStatus\",\n    \"8-1\": \"Determines if an invoice exists in a collection.\",\n    \"7-1\": \"Deletes a collection IInvoice\",\n    \"6-1\": \"Deletes a single IInvoice\",\n    \"5-1\": \"Creates a IInvoice with an assigned invoice number without saving it to the database\",\n    \"4-1\": \"Creates a IInvoice without saving it to the database\",\n    \"3-1\": \"Gets the total count of all IInvoice\",\n    \"2-1\": \"Add an invoice to a collection.\",\n    \"1-1\": \"Add an invoice to a collection.\",\n    \"0-1\": \"Add an invoice to a collection.\",\n    \"13-0\": \"GetDistinctCurrencyCodes\",\n    \"13-1\": \"Gets distinct currency codes used in invoices\",\n    \"25-0\": \"SumInvoiceTotals\",\n    \"25-1\": \"Gets the totals of invoices in a date range for a specific currency code.\",\n    \"26-0\": \"SumLineItemTotalsBySku\",\n    \"26-1\": \"Gets the total of line items for a give SKU invoiced in a specific currency across the date range.\"\n  },\n  \"cols\": 2,\n  \"rows\": 27\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before deleting\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after deleted\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before saving\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after saved\",\n    \"6-0\": \"StatusChanging\",\n    \"6-1\": \"Occurs before invoice status change\",\n    \"7-0\": \"StatusChanged\",\n    \"7-1\": \"Occurs after invoice status change\"\n  },\n  \"cols\": 2,\n  \"rows\": 8\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs)","slug":"invoiceservice","childrenPages":[]}

InvoiceService


The Invoice service allows you to manage invoices. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The InvoiceService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var invoiceService = MerchelloContext.Current.Services.InvoiceService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class InvoiceService : PageCachedServiceBase<IInvoice>, \n\tIInvoiceService, IStaticCollectionService<IInvoice>, IPageCachedService<IInvoice>, \n\tIService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "InvoiceService()", "1-0": "InvoiceService(ILogger)", "0-1": "Initializes a new instance of the InvoiceService class.", "1-1": "Initializes a new instance of the InvoiceService class." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddToCollection(Guid, Guid)", "1-0": "AddToCollection(IInvoice, IEntityCollection)", "2-0": "AddToCollection(IInvoice, Guid)", "3-0": "CountInvoices", "4-0": "CreateInvoice(Guid, Boolean)", "5-0": "CreateInvoice(Guid, Int32, Boolean)", "6-0": "Delete(IInvoice, Boolean)", "7-0": "Delete(IEnumerable(IInvoice), Boolean)", "8-0": "ExistsInCollection", "9-0": "GetAllInvoiceStatuses", "10-0": "GetByInvoiceNumber", "11-0": "GetByKey", "12-0": "GetByKeys", "14-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "15-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "16-0": "GetInvoicesByCustomerKey", "17-0": "GetInvoicesByDateRange", "18-0": "GetInvoicesByPaymentKey", "19-0": "GetPage", "20-0": "RemoveFromCollection(Guid, Guid)", "21-0": "RemoveFromCollection(IInvoice, IEntityCollection)", "22-0": "RemoveFromCollection(IInvoice, Guid)", "23-0": "Save(IInvoice, Boolean)", "24-0": "Save(IEnumerable(IInvoice), Boolean)", "24-1": "Saves a collection of IInvoice", "23-1": "Saves a single IInvoice", "22-1": "Removes an invoice from a collection", "21-1": "Removes an invoice from a collection", "20-1": "Removes an invoice from a collection", "19-1": "Gets a page of invoices", "18-1": "Gets a collection of IInvoice objects that are associated with a IPayment by the payments 'key'", "17-1": "GetInvoicesByDateRange", "16-1": "GetInvoicesByDateRange", "15-1": "Gets invoices from a collection", "14-1": "Gets invoices from a collection", "12-1": "Gets list of IInvoice objects given a list of Keys", "11-1": "Gets a IInvoice given it's unique 'key' (GUID)", "10-1": "Gets a IInvoice given it's unique 'InvoiceNumber'", "9-1": "Returns a collection of all IInvoiceStatus", "8-1": "Determines if an invoice exists in a collection.", "7-1": "Deletes a collection IInvoice", "6-1": "Deletes a single IInvoice", "5-1": "Creates a IInvoice with an assigned invoice number without saving it to the database", "4-1": "Creates a IInvoice without saving it to the database", "3-1": "Gets the total count of all IInvoice", "2-1": "Add an invoice to a collection.", "1-1": "Add an invoice to a collection.", "0-1": "Add an invoice to a collection.", "13-0": "GetDistinctCurrencyCodes", "13-1": "Gets distinct currency codes used in invoices", "25-0": "SumInvoiceTotals", "25-1": "Gets the totals of invoices in a date range for a specific currency code.", "26-0": "SumLineItemTotalsBySku", "26-1": "Gets the total of line items for a give SKU invoiced in a specific currency across the date range." }, "cols": 2, "rows": 27 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before deleting", "3-0": "Deleted", "3-1": "Occurs after deleted", "4-0": "Saving", "4-1": "Occurs before saving", "5-0": "Saved", "5-1": "Occurs after saved", "6-0": "StatusChanging", "6-1": "Occurs before invoice status change", "7-0": "StatusChanged", "7-1": "Occurs after invoice status change" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs)
The Invoice service allows you to manage invoices. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The InvoiceService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var invoiceService = MerchelloContext.Current.Services.InvoiceService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class InvoiceService : PageCachedServiceBase<IInvoice>, \n\tIInvoiceService, IStaticCollectionService<IInvoice>, IPageCachedService<IInvoice>, \n\tIService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "InvoiceService()", "1-0": "InvoiceService(ILogger)", "0-1": "Initializes a new instance of the InvoiceService class.", "1-1": "Initializes a new instance of the InvoiceService class." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddToCollection(Guid, Guid)", "1-0": "AddToCollection(IInvoice, IEntityCollection)", "2-0": "AddToCollection(IInvoice, Guid)", "3-0": "CountInvoices", "4-0": "CreateInvoice(Guid, Boolean)", "5-0": "CreateInvoice(Guid, Int32, Boolean)", "6-0": "Delete(IInvoice, Boolean)", "7-0": "Delete(IEnumerable(IInvoice), Boolean)", "8-0": "ExistsInCollection", "9-0": "GetAllInvoiceStatuses", "10-0": "GetByInvoiceNumber", "11-0": "GetByKey", "12-0": "GetByKeys", "14-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "15-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "16-0": "GetInvoicesByCustomerKey", "17-0": "GetInvoicesByDateRange", "18-0": "GetInvoicesByPaymentKey", "19-0": "GetPage", "20-0": "RemoveFromCollection(Guid, Guid)", "21-0": "RemoveFromCollection(IInvoice, IEntityCollection)", "22-0": "RemoveFromCollection(IInvoice, Guid)", "23-0": "Save(IInvoice, Boolean)", "24-0": "Save(IEnumerable(IInvoice), Boolean)", "24-1": "Saves a collection of IInvoice", "23-1": "Saves a single IInvoice", "22-1": "Removes an invoice from a collection", "21-1": "Removes an invoice from a collection", "20-1": "Removes an invoice from a collection", "19-1": "Gets a page of invoices", "18-1": "Gets a collection of IInvoice objects that are associated with a IPayment by the payments 'key'", "17-1": "GetInvoicesByDateRange", "16-1": "GetInvoicesByDateRange", "15-1": "Gets invoices from a collection", "14-1": "Gets invoices from a collection", "12-1": "Gets list of IInvoice objects given a list of Keys", "11-1": "Gets a IInvoice given it's unique 'key' (GUID)", "10-1": "Gets a IInvoice given it's unique 'InvoiceNumber'", "9-1": "Returns a collection of all IInvoiceStatus", "8-1": "Determines if an invoice exists in a collection.", "7-1": "Deletes a collection IInvoice", "6-1": "Deletes a single IInvoice", "5-1": "Creates a IInvoice with an assigned invoice number without saving it to the database", "4-1": "Creates a IInvoice without saving it to the database", "3-1": "Gets the total count of all IInvoice", "2-1": "Add an invoice to a collection.", "1-1": "Add an invoice to a collection.", "0-1": "Add an invoice to a collection.", "13-0": "GetDistinctCurrencyCodes", "13-1": "Gets distinct currency codes used in invoices", "25-0": "SumInvoiceTotals", "25-1": "Gets the totals of invoices in a date range for a specific currency code.", "26-0": "SumLineItemTotalsBySku", "26-1": "Gets the total of line items for a give SKU invoiced in a specific currency across the date range." }, "cols": 2, "rows": 27 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before deleting", "3-0": "Deleted", "3-1": "Occurs after deleted", "4-0": "Saving", "4-1": "Occurs before saving", "5-0": "Saved", "5-1": "Occurs after saved", "6-0": "StatusChanging", "6-1": "Occurs before invoice status change", "7-0": "StatusChanged", "7-1": "Occurs after invoice status change" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IInvoiceService.cs)
{"_id":"56b92b0408d8b20d00bc3b2e","user":"564136b9f424a10d001181e1","hidden":false,"title":"ItemCacheService","link_external":false,"sync_unique":"","type":"basic","updates":[],"link_url":"","githubsync":"","order":40,"slug":"itemcacheservice","body":"The ItemCacheService is used to manage ItemCache collections such as those in the Basket, Wishlist and SalePreparation objects. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The ItemCacheService is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var itemCacheService = MerchelloContext.Current.Services.ItemCacheService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class ItemCacheService : MerchelloRepositoryService, \\n\\tIItemCacheService, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ItemCacheService()\",\n    \"1-0\": \"ItemCacheService(ILogger)\",\n    \"2-0\": \"ItemCacheService(RepositoryFactory, ILogger)\",\n    \"3-0\": \"ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)\",\n    \"4-0\": \"ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)\",\n    \"0-1\": \"Initializes a new instance of the ItemCacheService class.\",\n    \"1-1\": \"Initializes a new instance of the ItemCacheService class.\",\n    \"2-1\": \"Initializes a new instance of the ItemCacheService class.\",\n    \"3-1\": \"Initializes a new instance of the ItemCacheService class.\",\n    \"4-1\": \"Initializes a new instance of the ItemCacheService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Delete(IItemCache, Boolean)\",\n    \"1-0\": \"Delete(IEnumerable(IItemCache), Boolean)\",\n    \"2-0\": \"GetAll\",\n    \"3-0\": \"GetByKey\",\n    \"5-0\": \"GetByKeys\",\n    \"6-0\": \"GetItemCacheByCustomer(ICustomerBase)\",\n    \"7-0\": \"GetItemCacheByCustomer(ICustomerBase, ItemCacheType)\",\n    \"8-0\": \"GetItemCacheByCustomer(ICustomerBase, Guid)\",\n    \"9-0\": \"GetItemCacheWithKey(ICustomerBase, ItemCacheType)\",\n    \"10-0\": \"GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid)\",\n    \"11-0\": \"GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid)\",\n    \"12-0\": \"Save(IEnumerable(IItemCache), Boolean)\",\n    \"12-1\": \"Saves a collection of IItemCache.\",\n    \"11-1\": \"Saves a single IItemCache\",\n    \"10-1\": \"Creates a basket for a consumer with a given type\",\n    \"9-1\": \"Creates a basket for a consumer with a given type\",\n    \"8-1\": \"Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist.\",\n    \"7-1\": \"Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist.\",\n    \"6-1\": \"Returns a collection of item caches for the consumer\",\n    \"5-1\": \"Gets a list of Basket give a list of unique keys\",\n    \"3-1\": \"Gets a list of Basket give a list of unique keys\",\n    \"2-1\": \"Gets all IItemCache\",\n    \"1-1\": \"Deletes a collection IItemCache\",\n    \"0-1\": \"Deletes a single IItemCache\",\n    \"4-0\": \"Page<IItemCache> GetCustomerItemCachePage(ItemCacheType itemCacheType, DateTime startDate, DateTime endDate, long page, long itemsPerPage, string sortBy = \\\"\\\", SortDirection sortDirection = SortDirection.Descending)\",\n    \"4-1\": \"Get a paged collection of customer item caches (Basket and Wishlist contents)\"\n  },\n  \"cols\": 2,\n  \"rows\": 13\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before save\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after save\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs)","excerpt":"Documentation for Merch's ItemCacheService","__v":0,"category":"56b92aff08d8b20d00bc3b09","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","createdAt":"2015-11-10T20:22:13.012Z","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"childrenPages":[]}

ItemCacheService

Documentation for Merch's ItemCacheService

The ItemCacheService is used to manage ItemCache collections such as those in the Basket, Wishlist and SalePreparation objects. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The ItemCacheService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var itemCacheService = MerchelloContext.Current.Services.ItemCacheService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class ItemCacheService : MerchelloRepositoryService, \n\tIItemCacheService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ItemCacheService()", "1-0": "ItemCacheService(ILogger)", "2-0": "ItemCacheService(RepositoryFactory, ILogger)", "3-0": "ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)", "4-0": "ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)", "0-1": "Initializes a new instance of the ItemCacheService class.", "1-1": "Initializes a new instance of the ItemCacheService class.", "2-1": "Initializes a new instance of the ItemCacheService class.", "3-1": "Initializes a new instance of the ItemCacheService class.", "4-1": "Initializes a new instance of the ItemCacheService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Delete(IItemCache, Boolean)", "1-0": "Delete(IEnumerable(IItemCache), Boolean)", "2-0": "GetAll", "3-0": "GetByKey", "5-0": "GetByKeys", "6-0": "GetItemCacheByCustomer(ICustomerBase)", "7-0": "GetItemCacheByCustomer(ICustomerBase, ItemCacheType)", "8-0": "GetItemCacheByCustomer(ICustomerBase, Guid)", "9-0": "GetItemCacheWithKey(ICustomerBase, ItemCacheType)", "10-0": "GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid)", "11-0": "GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid)", "12-0": "Save(IEnumerable(IItemCache), Boolean)", "12-1": "Saves a collection of IItemCache.", "11-1": "Saves a single IItemCache", "10-1": "Creates a basket for a consumer with a given type", "9-1": "Creates a basket for a consumer with a given type", "8-1": "Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist.", "7-1": "Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist.", "6-1": "Returns a collection of item caches for the consumer", "5-1": "Gets a list of Basket give a list of unique keys", "3-1": "Gets a list of Basket give a list of unique keys", "2-1": "Gets all IItemCache", "1-1": "Deletes a collection IItemCache", "0-1": "Deletes a single IItemCache", "4-0": "Page<IItemCache> GetCustomerItemCachePage(ItemCacheType itemCacheType, DateTime startDate, DateTime endDate, long page, long itemsPerPage, string sortBy = \"\", SortDirection sortDirection = SortDirection.Descending)", "4-1": "Get a paged collection of customer item caches (Basket and Wishlist contents)" }, "cols": 2, "rows": 13 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs)
The ItemCacheService is used to manage ItemCache collections such as those in the Basket, Wishlist and SalePreparation objects. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The ItemCacheService is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var itemCacheService = MerchelloContext.Current.Services.ItemCacheService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class ItemCacheService : MerchelloRepositoryService, \n\tIItemCacheService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ItemCacheService()", "1-0": "ItemCacheService(ILogger)", "2-0": "ItemCacheService(RepositoryFactory, ILogger)", "3-0": "ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger)", "4-0": "ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory)", "0-1": "Initializes a new instance of the ItemCacheService class.", "1-1": "Initializes a new instance of the ItemCacheService class.", "2-1": "Initializes a new instance of the ItemCacheService class.", "3-1": "Initializes a new instance of the ItemCacheService class.", "4-1": "Initializes a new instance of the ItemCacheService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Delete(IItemCache, Boolean)", "1-0": "Delete(IEnumerable(IItemCache), Boolean)", "2-0": "GetAll", "3-0": "GetByKey", "5-0": "GetByKeys", "6-0": "GetItemCacheByCustomer(ICustomerBase)", "7-0": "GetItemCacheByCustomer(ICustomerBase, ItemCacheType)", "8-0": "GetItemCacheByCustomer(ICustomerBase, Guid)", "9-0": "GetItemCacheWithKey(ICustomerBase, ItemCacheType)", "10-0": "GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid)", "11-0": "GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid)", "12-0": "Save(IEnumerable(IItemCache), Boolean)", "12-1": "Saves a collection of IItemCache.", "11-1": "Saves a single IItemCache", "10-1": "Creates a basket for a consumer with a given type", "9-1": "Creates a basket for a consumer with a given type", "8-1": "Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist.", "7-1": "Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist.", "6-1": "Returns a collection of item caches for the consumer", "5-1": "Gets a list of Basket give a list of unique keys", "3-1": "Gets a list of Basket give a list of unique keys", "2-1": "Gets all IItemCache", "1-1": "Deletes a collection IItemCache", "0-1": "Deletes a single IItemCache", "4-0": "Page<IItemCache> GetCustomerItemCachePage(ItemCacheType itemCacheType, DateTime startDate, DateTime endDate, long page, long itemsPerPage, string sortBy = \"\", SortDirection sortDirection = SortDirection.Descending)", "4-1": "Get a paged collection of customer item caches (Basket and Wishlist contents)" }, "cols": 2, "rows": 13 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs)
{"_id":"56b92b0408d8b20d00bc3b2f","link_url":"","type":"basic","api":{"url":"","auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":""},"isReference":false,"project":"56421bcdb48bdf19006a4c97","githubsync":"","hidden":false,"order":41,"sync_unique":"","title":"OrderService","user":"564136b9f424a10d001181e1","__v":1,"body":"The Order service manages items that need to be shipped and fulfilled from a warehouse. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The `OrderService` is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var orderService = MerchelloContext.Current.Services.OrderService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class OrderService : PageCachedServiceBase<IOrder>, \\n\\tIOrderService, IPageCachedService<IOrder>, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"OrderService()\",\n    \"1-0\": \"OrderService(ILogger)\",\n    \"2-0\": \"OrderService(RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)\",\n    \"3-0\": \"OrderService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)\",\n    \"4-0\": \"OrderService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)\",\n    \"0-1\": \"Initializes a new instance of the OrderService class.\",\n    \"1-1\": \"Initializes a new instance of the OrderService class.\",\n    \"2-1\": \"Initializes a new instance of the OrderService class.\",\n    \"3-1\": \"Initializes a new instance of the OrderService class.\",\n    \"4-1\": \"Initializes a new instance of the OrderService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"CreateOrder(Guid, Guid, Boolean)\",\n    \"1-0\": \"CreateOrder(Guid, Guid, Int32, Boolean)\",\n    \"2-0\": \"CreateOrderWithKey\",\n    \"3-0\": \"Delete(IOrder, Boolean)\",\n    \"4-0\": \"Delete(IEnumerable(IOrder), Boolean)\",\n    \"5-0\": \"GetAllOrderStatuses\",\n    \"6-0\": \"GetByKey\",\n    \"7-0\": \"GetByKeys\",\n    \"8-0\": \"GetByOrderNumber\",\n    \"9-0\": \"GetOrdersByInvoiceKey\",\n    \"10-0\": \"GetOrderStatusByKey\",\n    \"11-0\": \"GetPage(Int64, Int64, String, SortDirection)\",\n    \"12-0\": \"Save(IOrder, Boolean)\",\n    \"13-0\": \"Save(IEnumerable(IOrder), Boolean)\",\n    \"13-1\": \"Saves a collection of IOrder\",\n    \"12-1\": \"Saves a single IOrder\",\n    \"11-1\": \"Gets a Page of IOrder\",\n    \"10-1\": \"Gets an IOrderStatus by it's key\",\n    \"9-1\": \"Gets a collection of IOrder for a given IInvoice key\",\n    \"8-1\": \"Gets a IOrder given it's unique 'OrderNumber'\",\n    \"7-1\": \"Gets list of IOrder objects given a list of Keys\",\n    \"6-1\": \"Gets a IOrder given it's unique 'key' (GUID)\",\n    \"5-1\": \"Returns a collection of all IOrderStatus\",\n    \"4-1\": \"Deletes a collection IOrder\",\n    \"3-1\": \"Deletes a single IOrder\",\n    \"2-1\": \"Creates a IOrder and saves it to the database\",\n    \"1-1\": \"Creates a IOrder without saving it to the database\",\n    \"0-1\": \"Creates a IOrder without saving it to the database\"\n  },\n  \"cols\": 2,\n  \"rows\": 14\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\nYou can hook into the events just like you can do with Umbraco events using the  'ApplicationEventHandler'.\n\nOverride the *'void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)'* method and from here we can hook into any of the events below.\n\nA common example would be the StatusChanged event, where people want to call third party services once an order is completed.\n\nTo listen for this event, in the ApplicationStarting method write the following\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"OrderService.StatusChanged += OrderServiceOnStatusChanged;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nNow we need to create the OrderServiceOnStatusChanged method like so\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"private static void OrderServiceOnStatusChanged(IOrderService sender, StatusChangeEventArgs<IOrder> statusChangeEventArgs)\\n{            \\n       foreach (var order in statusChangeEventArgs.StatusChangedEntities)\\n       {\\n         // Do what you want here\\n       }\\n}\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before save\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after save\",\n    \"6-0\": \"StatusChanging\",\n    \"6-1\": \"Occurs before order status change\",\n    \"7-0\": \"StatusChanged\",\n    \"7-1\": \"Occurs after order status change\"\n  },\n  \"cols\": 2,\n  \"rows\": 8\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs)","excerpt":"","slug":"orderservice","updates":[],"version":"56b92afe08d8b20d00bc3afd","category":"56b92aff08d8b20d00bc3b09","createdAt":"2015-11-10T20:22:23.401Z","link_external":false,"childrenPages":[]}

OrderService


The Order service manages items that need to be shipped and fulfilled from a warehouse. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `OrderService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var orderService = MerchelloContext.Current.Services.OrderService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class OrderService : PageCachedServiceBase<IOrder>, \n\tIOrderService, IPageCachedService<IOrder>, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "OrderService()", "1-0": "OrderService(ILogger)", "2-0": "OrderService(RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)", "3-0": "OrderService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)", "4-0": "OrderService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)", "0-1": "Initializes a new instance of the OrderService class.", "1-1": "Initializes a new instance of the OrderService class.", "2-1": "Initializes a new instance of the OrderService class.", "3-1": "Initializes a new instance of the OrderService class.", "4-1": "Initializes a new instance of the OrderService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateOrder(Guid, Guid, Boolean)", "1-0": "CreateOrder(Guid, Guid, Int32, Boolean)", "2-0": "CreateOrderWithKey", "3-0": "Delete(IOrder, Boolean)", "4-0": "Delete(IEnumerable(IOrder), Boolean)", "5-0": "GetAllOrderStatuses", "6-0": "GetByKey", "7-0": "GetByKeys", "8-0": "GetByOrderNumber", "9-0": "GetOrdersByInvoiceKey", "10-0": "GetOrderStatusByKey", "11-0": "GetPage(Int64, Int64, String, SortDirection)", "12-0": "Save(IOrder, Boolean)", "13-0": "Save(IEnumerable(IOrder), Boolean)", "13-1": "Saves a collection of IOrder", "12-1": "Saves a single IOrder", "11-1": "Gets a Page of IOrder", "10-1": "Gets an IOrderStatus by it's key", "9-1": "Gets a collection of IOrder for a given IInvoice key", "8-1": "Gets a IOrder given it's unique 'OrderNumber'", "7-1": "Gets list of IOrder objects given a list of Keys", "6-1": "Gets a IOrder given it's unique 'key' (GUID)", "5-1": "Returns a collection of all IOrderStatus", "4-1": "Deletes a collection IOrder", "3-1": "Deletes a single IOrder", "2-1": "Creates a IOrder and saves it to the database", "1-1": "Creates a IOrder without saving it to the database", "0-1": "Creates a IOrder without saving it to the database" }, "cols": 2, "rows": 14 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] You can hook into the events just like you can do with Umbraco events using the 'ApplicationEventHandler'. Override the *'void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)'* method and from here we can hook into any of the events below. A common example would be the StatusChanged event, where people want to call third party services once an order is completed. To listen for this event, in the ApplicationStarting method write the following [block:code] { "codes": [ { "code": "OrderService.StatusChanged += OrderServiceOnStatusChanged;", "language": "csharp" } ] } [/block] Now we need to create the OrderServiceOnStatusChanged method like so [block:code] { "codes": [ { "code": "private static void OrderServiceOnStatusChanged(IOrderService sender, StatusChangeEventArgs<IOrder> statusChangeEventArgs)\n{ \n foreach (var order in statusChangeEventArgs.StatusChangedEntities)\n {\n // Do what you want here\n }\n}", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save", "6-0": "StatusChanging", "6-1": "Occurs before order status change", "7-0": "StatusChanged", "7-1": "Occurs after order status change" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs)
The Order service manages items that need to be shipped and fulfilled from a warehouse. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `OrderService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var orderService = MerchelloContext.Current.Services.OrderService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class OrderService : PageCachedServiceBase<IOrder>, \n\tIOrderService, IPageCachedService<IOrder>, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "OrderService()", "1-0": "OrderService(ILogger)", "2-0": "OrderService(RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)", "3-0": "OrderService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)", "4-0": "OrderService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService, IShipmentService)", "0-1": "Initializes a new instance of the OrderService class.", "1-1": "Initializes a new instance of the OrderService class.", "2-1": "Initializes a new instance of the OrderService class.", "3-1": "Initializes a new instance of the OrderService class.", "4-1": "Initializes a new instance of the OrderService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateOrder(Guid, Guid, Boolean)", "1-0": "CreateOrder(Guid, Guid, Int32, Boolean)", "2-0": "CreateOrderWithKey", "3-0": "Delete(IOrder, Boolean)", "4-0": "Delete(IEnumerable(IOrder), Boolean)", "5-0": "GetAllOrderStatuses", "6-0": "GetByKey", "7-0": "GetByKeys", "8-0": "GetByOrderNumber", "9-0": "GetOrdersByInvoiceKey", "10-0": "GetOrderStatusByKey", "11-0": "GetPage(Int64, Int64, String, SortDirection)", "12-0": "Save(IOrder, Boolean)", "13-0": "Save(IEnumerable(IOrder), Boolean)", "13-1": "Saves a collection of IOrder", "12-1": "Saves a single IOrder", "11-1": "Gets a Page of IOrder", "10-1": "Gets an IOrderStatus by it's key", "9-1": "Gets a collection of IOrder for a given IInvoice key", "8-1": "Gets a IOrder given it's unique 'OrderNumber'", "7-1": "Gets list of IOrder objects given a list of Keys", "6-1": "Gets a IOrder given it's unique 'key' (GUID)", "5-1": "Returns a collection of all IOrderStatus", "4-1": "Deletes a collection IOrder", "3-1": "Deletes a single IOrder", "2-1": "Creates a IOrder and saves it to the database", "1-1": "Creates a IOrder without saving it to the database", "0-1": "Creates a IOrder without saving it to the database" }, "cols": 2, "rows": 14 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] You can hook into the events just like you can do with Umbraco events using the 'ApplicationEventHandler'. Override the *'void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)'* method and from here we can hook into any of the events below. A common example would be the StatusChanged event, where people want to call third party services once an order is completed. To listen for this event, in the ApplicationStarting method write the following [block:code] { "codes": [ { "code": "OrderService.StatusChanged += OrderServiceOnStatusChanged;", "language": "csharp" } ] } [/block] Now we need to create the OrderServiceOnStatusChanged method like so [block:code] { "codes": [ { "code": "private static void OrderServiceOnStatusChanged(IOrderService sender, StatusChangeEventArgs<IOrder> statusChangeEventArgs)\n{ \n foreach (var order in statusChangeEventArgs.StatusChangedEntities)\n {\n // Do what you want here\n }\n}", "language": "csharp" } ] } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save", "6-0": "StatusChanging", "6-1": "Occurs before order status change", "7-0": "StatusChanged", "7-1": "Occurs after order status change" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IOrderService.cs)
{"_id":"56b92b0408d8b20d00bc3b30","githubsync":"","api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"order":42,"type":"basic","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","user":"564136b9f424a10d001181e1","createdAt":"2015-11-10T20:22:44.076Z","link_url":"","__v":0,"category":"56b92aff08d8b20d00bc3b09","updates":[],"sync_unique":"","excerpt":"Documentation for Merch's `PaymentService`","slug":"paymentservice","title":"PaymentService","link_external":false,"hidden":false,"body":"The Payment service is used manage payments. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The `PaymentService` is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var paymentService = MerchelloContext.Current.Services.PaymentService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class PaymentService : MerchelloRepositoryService, \\n\\tIPaymentService, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"PaymentService()\",\n    \"1-0\": \"PaymentService(ILogger)\",\n    \"0-1\": \"Initializes a new instance of the PaymentService class.\",\n    \"1-1\": \"Initializes a new instance of the PaymentService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ApplyPaymentToInvoice\",\n    \"1-0\": \"CreatePayment\",\n    \"2-0\": \"CreatePaymentWithKey(PaymentMethodType, Decimal, Nullable(Guid), Boolean)\",\n    \"3-0\": \"Delete(IAppliedPayment, Boolean)\",\n    \"4-0\": \"Delete(IEnumerable(IAppliedPayment), Boolean)\",\n    \"5-0\": \"Delete(IPayment, Boolean)\",\n    \"6-0\": \"Delete(IEnumerable(IPayment), Boolean)\",\n    \"7-0\": \"GetAppliedPaymentsByInvoiceKey\",\n    \"8-0\": \"GetAppliedPaymentsByPaymentKey\",\n    \"9-0\": \"GetByKey\",\n    \"10-0\": \"GetByKeys\",\n    \"11-0\": \"GetPaymentsByCustomerKey\",\n    \"12-0\": \"GetPaymentsByInvoiceKey\",\n    \"13-0\": \"GetPaymentsByPaymentMethodKey\",\n    \"14-0\": \"Save(IAppliedPayment, Boolean)\",\n    \"15-0\": \"Save(IAppliedPayment, Boolean)\",\n    \"16-0\": \"Save(IEnumerable(IPayment), Boolean)\",\n    \"16-1\": \"Saves a collection of IPayment\",\n    \"15-1\": \"Saves a single IPaymentMethod\",\n    \"14-1\": \"Saves an IAppliedPayment\",\n    \"13-1\": \"Gets a collection of IPayment for a given PaymentGatewayProvider\",\n    \"12-1\": \"Gets a collection of IPayment for a given invoice\",\n    \"11-1\": \"Gets a collection of IPayment by customer key.\",\n    \"10-1\": \"Gets list of IProduct objects given a list of Unique keys\",\n    \"9-1\": \"Gets a IPayment\",\n    \"8-1\": \"Gets a collection of IAppliedPayments by the payment key\",\n    \"7-1\": \"Gets a collection of IAppliedPayments by the invoice key\",\n    \"6-1\": \"Deletes a collection of IPayment\",\n    \"5-1\": \"Deletes a single IPayment\",\n    \"4-1\": \"Deletes a collection of IAppliedPayment\",\n    \"3-1\": \"Deletes a IAppliedPayment\",\n    \"2-1\": \"Creates and saves a payment\",\n    \"1-1\": \"Creates a payment without saving it to the database\",\n    \"0-1\": \"Creates and saves an AppliedPayment\"\n  },\n  \"cols\": 2,\n  \"rows\": 17\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before save\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after save\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs)","childrenPages":[]}

PaymentService

Documentation for Merch's `PaymentService`

The Payment service is used manage payments. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `PaymentService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var paymentService = MerchelloContext.Current.Services.PaymentService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class PaymentService : MerchelloRepositoryService, \n\tIPaymentService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "PaymentService()", "1-0": "PaymentService(ILogger)", "0-1": "Initializes a new instance of the PaymentService class.", "1-1": "Initializes a new instance of the PaymentService class." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ApplyPaymentToInvoice", "1-0": "CreatePayment", "2-0": "CreatePaymentWithKey(PaymentMethodType, Decimal, Nullable(Guid), Boolean)", "3-0": "Delete(IAppliedPayment, Boolean)", "4-0": "Delete(IEnumerable(IAppliedPayment), Boolean)", "5-0": "Delete(IPayment, Boolean)", "6-0": "Delete(IEnumerable(IPayment), Boolean)", "7-0": "GetAppliedPaymentsByInvoiceKey", "8-0": "GetAppliedPaymentsByPaymentKey", "9-0": "GetByKey", "10-0": "GetByKeys", "11-0": "GetPaymentsByCustomerKey", "12-0": "GetPaymentsByInvoiceKey", "13-0": "GetPaymentsByPaymentMethodKey", "14-0": "Save(IAppliedPayment, Boolean)", "15-0": "Save(IAppliedPayment, Boolean)", "16-0": "Save(IEnumerable(IPayment), Boolean)", "16-1": "Saves a collection of IPayment", "15-1": "Saves a single IPaymentMethod", "14-1": "Saves an IAppliedPayment", "13-1": "Gets a collection of IPayment for a given PaymentGatewayProvider", "12-1": "Gets a collection of IPayment for a given invoice", "11-1": "Gets a collection of IPayment by customer key.", "10-1": "Gets list of IProduct objects given a list of Unique keys", "9-1": "Gets a IPayment", "8-1": "Gets a collection of IAppliedPayments by the payment key", "7-1": "Gets a collection of IAppliedPayments by the invoice key", "6-1": "Deletes a collection of IPayment", "5-1": "Deletes a single IPayment", "4-1": "Deletes a collection of IAppliedPayment", "3-1": "Deletes a IAppliedPayment", "2-1": "Creates and saves a payment", "1-1": "Creates a payment without saving it to the database", "0-1": "Creates and saves an AppliedPayment" }, "cols": 2, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs)
The Payment service is used manage payments. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `PaymentService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var paymentService = MerchelloContext.Current.Services.PaymentService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class PaymentService : MerchelloRepositoryService, \n\tIPaymentService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "PaymentService()", "1-0": "PaymentService(ILogger)", "0-1": "Initializes a new instance of the PaymentService class.", "1-1": "Initializes a new instance of the PaymentService class." }, "cols": 2, "rows": 2 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ApplyPaymentToInvoice", "1-0": "CreatePayment", "2-0": "CreatePaymentWithKey(PaymentMethodType, Decimal, Nullable(Guid), Boolean)", "3-0": "Delete(IAppliedPayment, Boolean)", "4-0": "Delete(IEnumerable(IAppliedPayment), Boolean)", "5-0": "Delete(IPayment, Boolean)", "6-0": "Delete(IEnumerable(IPayment), Boolean)", "7-0": "GetAppliedPaymentsByInvoiceKey", "8-0": "GetAppliedPaymentsByPaymentKey", "9-0": "GetByKey", "10-0": "GetByKeys", "11-0": "GetPaymentsByCustomerKey", "12-0": "GetPaymentsByInvoiceKey", "13-0": "GetPaymentsByPaymentMethodKey", "14-0": "Save(IAppliedPayment, Boolean)", "15-0": "Save(IAppliedPayment, Boolean)", "16-0": "Save(IEnumerable(IPayment), Boolean)", "16-1": "Saves a collection of IPayment", "15-1": "Saves a single IPaymentMethod", "14-1": "Saves an IAppliedPayment", "13-1": "Gets a collection of IPayment for a given PaymentGatewayProvider", "12-1": "Gets a collection of IPayment for a given invoice", "11-1": "Gets a collection of IPayment by customer key.", "10-1": "Gets list of IProduct objects given a list of Unique keys", "9-1": "Gets a IPayment", "8-1": "Gets a collection of IAppliedPayments by the payment key", "7-1": "Gets a collection of IAppliedPayments by the invoice key", "6-1": "Deletes a collection of IPayment", "5-1": "Deletes a single IPayment", "4-1": "Deletes a collection of IAppliedPayment", "3-1": "Deletes a IAppliedPayment", "2-1": "Creates and saves a payment", "1-1": "Creates a payment without saving it to the database", "0-1": "Creates and saves an AppliedPayment" }, "cols": 2, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IPaymentService.cs)
{"_id":"56b92b0408d8b20d00bc3b31","link_url":"","hidden":false,"excerpt":"Documentation for Merch's StoreSettingService","category":"56b92aff08d8b20d00bc3b09","user":"564136b9f424a10d001181e1","createdAt":"2015-11-10T20:23:01.365Z","type":"basic","title":"StoreSettingService","project":"56421bcdb48bdf19006a4c97","sync_unique":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"slug":"storesettingservice","updates":[],"link_external":false,"__v":0,"version":"56b92afe08d8b20d00bc3afd","githubsync":"","order":43,"body":"The StoreSettingsService manage global store settings, currency, currency formats, country and regional settings.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The `StoreSettingService` is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var storeSettingService = MerchelloContext.Current.Services.StoreSettingService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public interface IStoreSettingService : IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"CreateStoreSettingWithKey\",\n    \"1-0\": \"Delete\",\n    \"2-0\": \"GetAll\",\n    \"3-0\": \"GetAllCountries()\",\n    \"4-0\": \"GetAllCountries(String[])\",\n    \"5-0\": \"GetAllCurrencies\",\n    \"6-0\": \"GetByKey\",\n    \"7-0\": \"GetCountryByCode\",\n    \"8-0\": \"GetCurrencyByCode\",\n    \"9-0\": \"GetCurrencyFormat\",\n    \"10-0\": \"GetNextInvoiceNumber\",\n    \"11-0\": \"GetNextOrderNumber\",\n    \"12-0\": \"GetNextShipmentNumber\",\n    \"13-0\": \"GetTypeFields\",\n    \"14-0\": \"Save\",\n    \"14-1\": \"Saves a single IStoreSetting\",\n    \"13-1\": \"Gets the complete collection of registered type fields\",\n    \"12-1\": \"Gets the complete collection of registered type fields\",\n    \"11-1\": \"Gets the next usable OrderNumber\",\n    \"10-1\": \"Gets the next usable InvoiceNumber\",\n    \"9-1\": \"Returns the currency format\",\n    \"8-1\": \"Gets a ICurrency for the currency code passed\",\n    \"7-1\": \"Returns the ICountry for the country code passed.\",\n    \"6-1\": \"Gets a IStoreSetting by it's unique 'Key'\",\n    \"5-1\": \"Gets a collection of all ICurrency\",\n    \"4-1\": \"Returns a ICountry collection for all countries excluding codes passed\",\n    \"3-1\": \"Gets a collection of all ICountry\",\n    \"2-1\": \"Gets a collection of all IStoreSetting\",\n    \"1-1\": \"Deletes a IStoreSetting\",\n    \"0-1\": \"Creates a store setting and persists it to the database\"\n  },\n  \"cols\": 2,\n  \"rows\": 15\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs)","childrenPages":[]}

StoreSettingService

Documentation for Merch's StoreSettingService

The StoreSettingsService manage global store settings, currency, currency formats, country and regional settings. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `StoreSettingService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var storeSettingService = MerchelloContext.Current.Services.StoreSettingService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public interface IStoreSettingService : IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateStoreSettingWithKey", "1-0": "Delete", "2-0": "GetAll", "3-0": "GetAllCountries()", "4-0": "GetAllCountries(String[])", "5-0": "GetAllCurrencies", "6-0": "GetByKey", "7-0": "GetCountryByCode", "8-0": "GetCurrencyByCode", "9-0": "GetCurrencyFormat", "10-0": "GetNextInvoiceNumber", "11-0": "GetNextOrderNumber", "12-0": "GetNextShipmentNumber", "13-0": "GetTypeFields", "14-0": "Save", "14-1": "Saves a single IStoreSetting", "13-1": "Gets the complete collection of registered type fields", "12-1": "Gets the complete collection of registered type fields", "11-1": "Gets the next usable OrderNumber", "10-1": "Gets the next usable InvoiceNumber", "9-1": "Returns the currency format", "8-1": "Gets a ICurrency for the currency code passed", "7-1": "Returns the ICountry for the country code passed.", "6-1": "Gets a IStoreSetting by it's unique 'Key'", "5-1": "Gets a collection of all ICurrency", "4-1": "Returns a ICountry collection for all countries excluding codes passed", "3-1": "Gets a collection of all ICountry", "2-1": "Gets a collection of all IStoreSetting", "1-1": "Deletes a IStoreSetting", "0-1": "Creates a store setting and persists it to the database" }, "cols": 2, "rows": 15 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs)
The StoreSettingsService manage global store settings, currency, currency formats, country and regional settings. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `StoreSettingService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var storeSettingService = MerchelloContext.Current.Services.StoreSettingService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public interface IStoreSettingService : IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateStoreSettingWithKey", "1-0": "Delete", "2-0": "GetAll", "3-0": "GetAllCountries()", "4-0": "GetAllCountries(String[])", "5-0": "GetAllCurrencies", "6-0": "GetByKey", "7-0": "GetCountryByCode", "8-0": "GetCurrencyByCode", "9-0": "GetCurrencyFormat", "10-0": "GetNextInvoiceNumber", "11-0": "GetNextOrderNumber", "12-0": "GetNextShipmentNumber", "13-0": "GetTypeFields", "14-0": "Save", "14-1": "Saves a single IStoreSetting", "13-1": "Gets the complete collection of registered type fields", "12-1": "Gets the complete collection of registered type fields", "11-1": "Gets the next usable OrderNumber", "10-1": "Gets the next usable InvoiceNumber", "9-1": "Returns the currency format", "8-1": "Gets a ICurrency for the currency code passed", "7-1": "Returns the ICountry for the country code passed.", "6-1": "Gets a IStoreSetting by it's unique 'Key'", "5-1": "Gets a collection of all ICurrency", "4-1": "Returns a ICountry collection for all countries excluding codes passed", "3-1": "Gets a collection of all ICountry", "2-1": "Gets a collection of all IStoreSetting", "1-1": "Deletes a IStoreSetting", "0-1": "Creates a store setting and persists it to the database" }, "cols": 2, "rows": 15 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IStoreSettingService.cs)
{"_id":"56b92b0408d8b20d00bc3b32","link_external":false,"slug":"productservice","api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"createdAt":"2015-11-10T20:22:52.572Z","hidden":false,"isReference":false,"link_url":"","project":"56421bcdb48bdf19006a4c97","type":"basic","user":"564136b9f424a10d001181e1","__v":1,"version":"56b92afe08d8b20d00bc3afd","updates":[],"category":"56b92aff08d8b20d00bc3b09","excerpt":"Documentation for Merch's ProductService","order":44,"sync_unique":"","title":"ProductService","body":"The ProductService is used to manage products in the back office product catalog. \n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The `ProductService` is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var productService = MerchelloContext.Current.Services.ProductService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class ProductService : PageCachedServiceBase<IProduct>, \\n\\tIProductService, IStaticCollectionService<IProduct>, IPageCachedService<IProduct>, \\n\\tIService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ProductService()\",\n    \"1-0\": \"ProductService(ILogger)\",\n    \"2-0\": \"ProductService(RepositoryFactory, ILogger, IProductVariantService)\",\n    \"3-0\": \"ProductService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IProductVariantService)\",\n    \"4-0\": \"ProductService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IProductVariantService)\",\n    \"0-1\": \"Initializes a new instance of the ProductService class\",\n    \"1-1\": \"Initializes a new instance of the ProductService class\",\n    \"2-1\": \"Initializes a new instance of the ProductService class\",\n    \"3-1\": \"Initializes a new instance of the ProductService class\",\n    \"4-1\": \"Initializes a new instance of the ProductService class\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"AddToCollection(Guid, Guid)\",\n    \"1-0\": \"AddToCollection(IProduct, IEntityCollection)\",\n    \"2-0\": \"AddToCollection(IProduct, Guid)\",\n    \"3-0\": \"CreateProduct\",\n    \"4-0\": \"CreateProductWithKey\",\n    \"5-0\": \"Delete(IProduct, Boolean)\",\n    \"6-0\": \"Delete(IEnumerable(IProduct), Boolean)\",\n    \"7-0\": \"ExistsInCollection\",\n    \"8-0\": \"GetAll\",\n    \"9-0\": \"GetByDetachedContentType\",\n    \"10-0\": \"GetByKey\",\n    \"11-0\": \"GetByKeys\",\n    \"12-0\": \"GetBySku\",\n    \"13-0\": \"GetFromCollection(Guid, Int64, Int64, String, SortDirection)\",\n    \"14-0\": \"GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)\",\n    \"15-0\": \"GetPage\",\n    \"16-0\": \"GetProductVariantByKey\",\n    \"17-0\": \"GetProductVariantBySku\",\n    \"18-0\": \"GetProductVariantsByProductKey\",\n    \"19-0\": \"ProductsCount\",\n    \"20-0\": \"RemoveDetachedContent(IProduct, Guid, Boolean)\",\n    \"21-0\": \"RemoveDetachedContent(IEnumerable(IProduct), Guid, Boolean)\",\n    \"22-0\": \"RemoveFromCollection(Guid, Guid)\",\n    \"23-0\": \"RemoveFromCollection(Guid, Guid)\",\n    \"24-0\": \"RemoveFromCollection(IProduct, Guid)\",\n    \"25-0\": \"Save(IProduct, Boolean)\",\n    \"26-0\": \"Save(IEnumerable(IProduct), Boolean)\",\n    \"26-1\": \"Saves a collection of IProduct\",\n    \"25-1\": \"Saves a collection of IProduct\",\n    \"24-1\": \"Remove product from a collection\",\n    \"23-1\": \"Remove product from a collection\",\n    \"22-1\": \"Remove product from a collection\",\n    \"21-1\": \"Removes detached content from the collection of products\",\n    \"20-1\": \"Removes detached content from the collection of products\",\n    \"19-1\": \"**Obsolete. ** Returns the count of all products\",\n    \"18-1\": \"Gets  a collection of IProductVariant by product.\",\n    \"17-1\": \"Get's a IProductVariant by it's unique SKU.\",\n    \"16-1\": \"Gets a IProductVariant by it's key.\",\n    \"15-1\": \"Gets a page of IProduct\",\n    \"14-1\": \"Gets products from a collection filtered by a search term.\",\n    \"13-1\": \"Gets products from a collection.\",\n    \"12-1\": \"Gets an IProduct by it's unique SKU.\",\n    \"11-1\": \"Gets a list of Product give a list of unique keys\",\n    \"10-1\": \"Gets a Product by its unique id - primary key\",\n    \"9-1\": \"Gets a collect of products by detached content type\",\n    \"8-1\": \"Gets all the products\",\n    \"7-1\": \"Returns a value indicating whether or not a product exists in a colleciton\",\n    \"6-1\": \"Deletes a collection IProduct\",\n    \"5-1\": \"Deletes a single IProduct\",\n    \"4-1\": \"Creates and saves a IProduct to the database\",\n    \"3-1\": \"Creates a Product without saving it to the database\",\n    \"2-1\": \"Adds a product to a collection\",\n    \"0-1\": \"Adds a product to a collection\",\n    \"1-1\": \"Adds a product to a collection\"\n  },\n  \"cols\": 2,\n  \"rows\": 27\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Created\",\n    \"1-1\": \"Occurs after create\",\n    \"2-0\": \"Deleting\",\n    \"2-1\": \"Occurs before delete\",\n    \"3-0\": \"Deleted\",\n    \"3-1\": \"Occurs after delete\",\n    \"4-0\": \"Saving\",\n    \"4-1\": \"Occurs before save\",\n    \"5-0\": \"Saved\",\n    \"5-1\": \"Occurs after save\"\n  },\n  \"cols\": 2,\n  \"rows\": 6\n}\n[/block]\nExample of using the Saved event (Events must be added to the ApplicationStarting event)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ProductService.Saved += ProductServiceSaved;\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nThen the method\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"        private static void ProductServiceSaved(IProductService sender, SaveEventArgs<IProduct> e)\\n        {\\n            foreach (var p in e.SavedEntities)\\n            {\\n                // do what you want\\n            }\\n        }\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs)","githubsync":"","childrenPages":[]}

ProductService

Documentation for Merch's ProductService

The ProductService is used to manage products in the back office product catalog. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `ProductService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var productService = MerchelloContext.Current.Services.ProductService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class ProductService : PageCachedServiceBase<IProduct>, \n\tIProductService, IStaticCollectionService<IProduct>, IPageCachedService<IProduct>, \n\tIService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ProductService()", "1-0": "ProductService(ILogger)", "2-0": "ProductService(RepositoryFactory, ILogger, IProductVariantService)", "3-0": "ProductService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IProductVariantService)", "4-0": "ProductService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IProductVariantService)", "0-1": "Initializes a new instance of the ProductService class", "1-1": "Initializes a new instance of the ProductService class", "2-1": "Initializes a new instance of the ProductService class", "3-1": "Initializes a new instance of the ProductService class", "4-1": "Initializes a new instance of the ProductService class" }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddToCollection(Guid, Guid)", "1-0": "AddToCollection(IProduct, IEntityCollection)", "2-0": "AddToCollection(IProduct, Guid)", "3-0": "CreateProduct", "4-0": "CreateProductWithKey", "5-0": "Delete(IProduct, Boolean)", "6-0": "Delete(IEnumerable(IProduct), Boolean)", "7-0": "ExistsInCollection", "8-0": "GetAll", "9-0": "GetByDetachedContentType", "10-0": "GetByKey", "11-0": "GetByKeys", "12-0": "GetBySku", "13-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "14-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "15-0": "GetPage", "16-0": "GetProductVariantByKey", "17-0": "GetProductVariantBySku", "18-0": "GetProductVariantsByProductKey", "19-0": "ProductsCount", "20-0": "RemoveDetachedContent(IProduct, Guid, Boolean)", "21-0": "RemoveDetachedContent(IEnumerable(IProduct), Guid, Boolean)", "22-0": "RemoveFromCollection(Guid, Guid)", "23-0": "RemoveFromCollection(Guid, Guid)", "24-0": "RemoveFromCollection(IProduct, Guid)", "25-0": "Save(IProduct, Boolean)", "26-0": "Save(IEnumerable(IProduct), Boolean)", "26-1": "Saves a collection of IProduct", "25-1": "Saves a collection of IProduct", "24-1": "Remove product from a collection", "23-1": "Remove product from a collection", "22-1": "Remove product from a collection", "21-1": "Removes detached content from the collection of products", "20-1": "Removes detached content from the collection of products", "19-1": "**Obsolete. ** Returns the count of all products", "18-1": "Gets a collection of IProductVariant by product.", "17-1": "Get's a IProductVariant by it's unique SKU.", "16-1": "Gets a IProductVariant by it's key.", "15-1": "Gets a page of IProduct", "14-1": "Gets products from a collection filtered by a search term.", "13-1": "Gets products from a collection.", "12-1": "Gets an IProduct by it's unique SKU.", "11-1": "Gets a list of Product give a list of unique keys", "10-1": "Gets a Product by its unique id - primary key", "9-1": "Gets a collect of products by detached content type", "8-1": "Gets all the products", "7-1": "Returns a value indicating whether or not a product exists in a colleciton", "6-1": "Deletes a collection IProduct", "5-1": "Deletes a single IProduct", "4-1": "Creates and saves a IProduct to the database", "3-1": "Creates a Product without saving it to the database", "2-1": "Adds a product to a collection", "0-1": "Adds a product to a collection", "1-1": "Adds a product to a collection" }, "cols": 2, "rows": 27 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] Example of using the Saved event (Events must be added to the ApplicationStarting event) [block:code] { "codes": [ { "code": "ProductService.Saved += ProductServiceSaved;", "language": "csharp" } ] } [/block] Then the method [block:code] { "codes": [ { "code": " private static void ProductServiceSaved(IProductService sender, SaveEventArgs<IProduct> e)\n {\n foreach (var p in e.SavedEntities)\n {\n // do what you want\n }\n }", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs)
The ProductService is used to manage products in the back office product catalog. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `ProductService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var productService = MerchelloContext.Current.Services.ProductService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class ProductService : PageCachedServiceBase<IProduct>, \n\tIProductService, IStaticCollectionService<IProduct>, IPageCachedService<IProduct>, \n\tIService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ProductService()", "1-0": "ProductService(ILogger)", "2-0": "ProductService(RepositoryFactory, ILogger, IProductVariantService)", "3-0": "ProductService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IProductVariantService)", "4-0": "ProductService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IProductVariantService)", "0-1": "Initializes a new instance of the ProductService class", "1-1": "Initializes a new instance of the ProductService class", "2-1": "Initializes a new instance of the ProductService class", "3-1": "Initializes a new instance of the ProductService class", "4-1": "Initializes a new instance of the ProductService class" }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "AddToCollection(Guid, Guid)", "1-0": "AddToCollection(IProduct, IEntityCollection)", "2-0": "AddToCollection(IProduct, Guid)", "3-0": "CreateProduct", "4-0": "CreateProductWithKey", "5-0": "Delete(IProduct, Boolean)", "6-0": "Delete(IEnumerable(IProduct), Boolean)", "7-0": "ExistsInCollection", "8-0": "GetAll", "9-0": "GetByDetachedContentType", "10-0": "GetByKey", "11-0": "GetByKeys", "12-0": "GetBySku", "13-0": "GetFromCollection(Guid, Int64, Int64, String, SortDirection)", "14-0": "GetFromCollection(Guid, String, Int64, Int64, String, SortDirection)", "15-0": "GetPage", "16-0": "GetProductVariantByKey", "17-0": "GetProductVariantBySku", "18-0": "GetProductVariantsByProductKey", "19-0": "ProductsCount", "20-0": "RemoveDetachedContent(IProduct, Guid, Boolean)", "21-0": "RemoveDetachedContent(IEnumerable(IProduct), Guid, Boolean)", "22-0": "RemoveFromCollection(Guid, Guid)", "23-0": "RemoveFromCollection(Guid, Guid)", "24-0": "RemoveFromCollection(IProduct, Guid)", "25-0": "Save(IProduct, Boolean)", "26-0": "Save(IEnumerable(IProduct), Boolean)", "26-1": "Saves a collection of IProduct", "25-1": "Saves a collection of IProduct", "24-1": "Remove product from a collection", "23-1": "Remove product from a collection", "22-1": "Remove product from a collection", "21-1": "Removes detached content from the collection of products", "20-1": "Removes detached content from the collection of products", "19-1": "**Obsolete. ** Returns the count of all products", "18-1": "Gets a collection of IProductVariant by product.", "17-1": "Get's a IProductVariant by it's unique SKU.", "16-1": "Gets a IProductVariant by it's key.", "15-1": "Gets a page of IProduct", "14-1": "Gets products from a collection filtered by a search term.", "13-1": "Gets products from a collection.", "12-1": "Gets an IProduct by it's unique SKU.", "11-1": "Gets a list of Product give a list of unique keys", "10-1": "Gets a Product by its unique id - primary key", "9-1": "Gets a collect of products by detached content type", "8-1": "Gets all the products", "7-1": "Returns a value indicating whether or not a product exists in a colleciton", "6-1": "Deletes a collection IProduct", "5-1": "Deletes a single IProduct", "4-1": "Creates and saves a IProduct to the database", "3-1": "Creates a Product without saving it to the database", "2-1": "Adds a product to a collection", "0-1": "Adds a product to a collection", "1-1": "Adds a product to a collection" }, "cols": 2, "rows": 27 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Created", "1-1": "Occurs after create", "2-0": "Deleting", "2-1": "Occurs before delete", "3-0": "Deleted", "3-1": "Occurs after delete", "4-0": "Saving", "4-1": "Occurs before save", "5-0": "Saved", "5-1": "Occurs after save" }, "cols": 2, "rows": 6 } [/block] Example of using the Saved event (Events must be added to the ApplicationStarting event) [block:code] { "codes": [ { "code": "ProductService.Saved += ProductServiceSaved;", "language": "csharp" } ] } [/block] Then the method [block:code] { "codes": [ { "code": " private static void ProductServiceSaved(IProductService sender, SaveEventArgs<IProduct> e)\n {\n foreach (var p in e.SavedEntities)\n {\n // do what you want\n }\n }", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IProductService.cs)
{"_id":"56b92b0408d8b20d00bc3b33","body":"The Shipment service is used to manage shipments in Merch.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Instantiating\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:textarea]\n{\n  \"text\": \"The `ShipmentService` is exposed through the `MerchelloContext`\",\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var shipmentService = MerchelloContext.Current.Services.ShipmentService;\",\n      \"language\": \"csharp\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Class\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class ShipmentService : MerchelloRepositoryService, \\n\\tIShipmentService, IService\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Constructors\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"ShipmentService()\",\n    \"1-0\": \"ShipmentService(ILogger)\",\n    \"2-0\": \"ShipmentService(RepositoryFactory, ILogger)\",\n    \"3-0\": \"ShipmentService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService)\",\n    \"4-0\": \"ShipmentService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IStoreSettingService)\",\n    \"0-1\": \"Initializes a new instance of the ShipmentService class.\",\n    \"1-1\": \"Initializes a new instance of the ShipmentService class.\",\n    \"2-1\": \"Initializes a new instance of the ShipmentService class.\",\n    \"3-1\": \"Initializes a new instance of the ShipmentService class.\",\n    \"4-1\": \"Initializes a new instance of the ShipmentService class.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Public Methods\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"CreateShipment(IShipmentStatus, Boolean)\",\n    \"1-0\": \"CreateShipment(IShipmentStatus, IAddress, IAddress, Boolean)\",\n    \"2-0\": \"CreateShipment(IShipmentStatus, IAddress, IAddress, LineItemCollection, Boolean)\",\n    \"3-0\": \"Delete(IShipment, Boolean)\",\n    \"4-0\": \"Delete(IEnumerable(IShipment), Boolean)\",\n    \"5-0\": \"GetAllShipmentStatuses\",\n    \"6-0\": \"GetByKey\",\n    \"7-0\": \"GetByKeys\",\n    \"8-0\": \"GetShipmentsByOrderKey\",\n    \"9-0\": \"GetShipmentsByShipMethodKey\",\n    \"10-0\": \"GetShipmentStatusByKey\",\n    \"11-0\": \"Save(IShipment, Boolean)\",\n    \"12-0\": \"Save(IEnumerable(IShipment), Boolean)\",\n    \"12-1\": \"Saves a collection of IShipment\",\n    \"11-1\": \"Saves a single IShipment\",\n    \"10-1\": \"Saves a single IShipment\",\n    \"9-1\": \"Gets a list of IShipment object given a ship method Key\",\n    \"8-1\": \"Gets a collection of IShipment give an order key\",\n    \"7-1\": \"Gets list of IShipment objects given a list of Unique keys\",\n    \"6-1\": \"Gets an IShipment object by its 'UniqueId'\",\n    \"5-1\": \"Returns a collection of all IShipmentStatus\",\n    \"4-1\": \"Deletes a collection of IShipment\",\n    \"3-1\": \"Deletes a single IShipment\",\n    \"2-1\": \"Creates a IShipment without persisting it to the database.\",\n    \"1-1\": \"Creates a IShipment without persisting it to the database.\",\n    \"0-1\": \"Creates a IShipment without persisting it to the database.\"\n  },\n  \"cols\": 2,\n  \"rows\": 13\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Events\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"Creating\",\n    \"0-1\": \"Occurs before create\",\n    \"1-0\": \"Deleting\",\n    \"1-1\": \"Occurs before delete\",\n    \"2-0\": \"Deleted\",\n    \"2-1\": \"Occurs after delete\",\n    \"3-0\": \"Saving\",\n    \"3-1\": \"Occurs before save\",\n    \"4-0\": \"Saved\",\n    \"4-1\": \"Occurs after save\",\n    \"5-0\": \"StatusChanging\",\n    \"5-1\": \"Occurs before a shipment status has changed\",\n    \"6-0\": \"StatusChanged\",\n    \"6-1\": \"Occurs after a shipment status has changed\",\n    \"7-0\": \"UpdatedOrder\",\n    \"7-1\": \"Special event that fires when an order record is updated\"\n  },\n  \"cols\": 2,\n  \"rows\": 8\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Interface on GitHub\"\n}\n[/block]\n\n[block:embed]\n{\n  \"html\": false,\n  \"url\": \"https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs\",\n  \"title\": \"Merchello/Merchello\",\n  \"favicon\": \"https://assets-cdn.github.com/favicon.ico\",\n  \"image\": \"https://avatars2.githubusercontent.com/u/6453072?v=3&s=400\"\n}\n[/block]\n[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs)","slug":"shipmentservice","createdAt":"2015-11-10T20:23:10.534Z","api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required"},"updates":[],"link_external":false,"sync_unique":"","title":"ShipmentService","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","githubsync":"","order":45,"user":"564136b9f424a10d001181e1","link_url":"","excerpt":"Documentation for Merch's ShipmentService","type":"basic","__v":0,"category":"56b92aff08d8b20d00bc3b09","hidden":false,"childrenPages":[]}

ShipmentService

Documentation for Merch's ShipmentService

The Shipment service is used to manage shipments in Merch. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `ShipmentService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var shipmentService = MerchelloContext.Current.Services.ShipmentService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class ShipmentService : MerchelloRepositoryService, \n\tIShipmentService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ShipmentService()", "1-0": "ShipmentService(ILogger)", "2-0": "ShipmentService(RepositoryFactory, ILogger)", "3-0": "ShipmentService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService)", "4-0": "ShipmentService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IStoreSettingService)", "0-1": "Initializes a new instance of the ShipmentService class.", "1-1": "Initializes a new instance of the ShipmentService class.", "2-1": "Initializes a new instance of the ShipmentService class.", "3-1": "Initializes a new instance of the ShipmentService class.", "4-1": "Initializes a new instance of the ShipmentService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateShipment(IShipmentStatus, Boolean)", "1-0": "CreateShipment(IShipmentStatus, IAddress, IAddress, Boolean)", "2-0": "CreateShipment(IShipmentStatus, IAddress, IAddress, LineItemCollection, Boolean)", "3-0": "Delete(IShipment, Boolean)", "4-0": "Delete(IEnumerable(IShipment), Boolean)", "5-0": "GetAllShipmentStatuses", "6-0": "GetByKey", "7-0": "GetByKeys", "8-0": "GetShipmentsByOrderKey", "9-0": "GetShipmentsByShipMethodKey", "10-0": "GetShipmentStatusByKey", "11-0": "Save(IShipment, Boolean)", "12-0": "Save(IEnumerable(IShipment), Boolean)", "12-1": "Saves a collection of IShipment", "11-1": "Saves a single IShipment", "10-1": "Saves a single IShipment", "9-1": "Gets a list of IShipment object given a ship method Key", "8-1": "Gets a collection of IShipment give an order key", "7-1": "Gets list of IShipment objects given a list of Unique keys", "6-1": "Gets an IShipment object by its 'UniqueId'", "5-1": "Returns a collection of all IShipmentStatus", "4-1": "Deletes a collection of IShipment", "3-1": "Deletes a single IShipment", "2-1": "Creates a IShipment without persisting it to the database.", "1-1": "Creates a IShipment without persisting it to the database.", "0-1": "Creates a IShipment without persisting it to the database." }, "cols": 2, "rows": 13 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Deleting", "1-1": "Occurs before delete", "2-0": "Deleted", "2-1": "Occurs after delete", "3-0": "Saving", "3-1": "Occurs before save", "4-0": "Saved", "4-1": "Occurs after save", "5-0": "StatusChanging", "5-1": "Occurs before a shipment status has changed", "6-0": "StatusChanged", "6-1": "Occurs after a shipment status has changed", "7-0": "UpdatedOrder", "7-1": "Special event that fires when an order record is updated" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs)
The Shipment service is used to manage shipments in Merch. [block:api-header] { "type": "basic", "title": "Instantiating", "sidebar": true } [/block] [block:textarea] { "text": "The `ShipmentService` is exposed through the `MerchelloContext`", "sidebar": true } [/block] [block:code] { "codes": [ { "code": "var shipmentService = MerchelloContext.Current.Services.ShipmentService;", "language": "csharp" } ], "sidebar": true } [/block] [block:api-header] { "type": "basic", "title": "Class" } [/block] [block:code] { "codes": [ { "code": "public class ShipmentService : MerchelloRepositoryService, \n\tIShipmentService, IService", "language": "csharp" } ] } [/block] [block:api-header] { "type": "basic", "title": "Constructors" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "ShipmentService()", "1-0": "ShipmentService(ILogger)", "2-0": "ShipmentService(RepositoryFactory, ILogger)", "3-0": "ShipmentService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IStoreSettingService)", "4-0": "ShipmentService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory, IStoreSettingService)", "0-1": "Initializes a new instance of the ShipmentService class.", "1-1": "Initializes a new instance of the ShipmentService class.", "2-1": "Initializes a new instance of the ShipmentService class.", "3-1": "Initializes a new instance of the ShipmentService class.", "4-1": "Initializes a new instance of the ShipmentService class." }, "cols": 2, "rows": 5 } [/block] [block:api-header] { "type": "basic", "title": "Public Methods" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "CreateShipment(IShipmentStatus, Boolean)", "1-0": "CreateShipment(IShipmentStatus, IAddress, IAddress, Boolean)", "2-0": "CreateShipment(IShipmentStatus, IAddress, IAddress, LineItemCollection, Boolean)", "3-0": "Delete(IShipment, Boolean)", "4-0": "Delete(IEnumerable(IShipment), Boolean)", "5-0": "GetAllShipmentStatuses", "6-0": "GetByKey", "7-0": "GetByKeys", "8-0": "GetShipmentsByOrderKey", "9-0": "GetShipmentsByShipMethodKey", "10-0": "GetShipmentStatusByKey", "11-0": "Save(IShipment, Boolean)", "12-0": "Save(IEnumerable(IShipment), Boolean)", "12-1": "Saves a collection of IShipment", "11-1": "Saves a single IShipment", "10-1": "Saves a single IShipment", "9-1": "Gets a list of IShipment object given a ship method Key", "8-1": "Gets a collection of IShipment give an order key", "7-1": "Gets list of IShipment objects given a list of Unique keys", "6-1": "Gets an IShipment object by its 'UniqueId'", "5-1": "Returns a collection of all IShipmentStatus", "4-1": "Deletes a collection of IShipment", "3-1": "Deletes a single IShipment", "2-1": "Creates a IShipment without persisting it to the database.", "1-1": "Creates a IShipment without persisting it to the database.", "0-1": "Creates a IShipment without persisting it to the database." }, "cols": 2, "rows": 13 } [/block] [block:api-header] { "type": "basic", "title": "Events" } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "0-0": "Creating", "0-1": "Occurs before create", "1-0": "Deleting", "1-1": "Occurs before delete", "2-0": "Deleted", "2-1": "Occurs after delete", "3-0": "Saving", "3-1": "Occurs before save", "4-0": "Saved", "4-1": "Occurs after save", "5-0": "StatusChanging", "5-1": "Occurs before a shipment status has changed", "6-0": "StatusChanged", "6-1": "Occurs after a shipment status has changed", "7-0": "UpdatedOrder", "7-1": "Special event that fires when an order record is updated" }, "cols": 2, "rows": 8 } [/block] [block:api-header] { "type": "basic", "title": "Interface on GitHub" } [/block] [block:embed] { "html": false, "url": "https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs", "title": "Merchello/Merchello", "favicon": "https://assets-cdn.github.com/favicon.ico", "image": "https://avatars2.githubusercontent.com/u/6453072?v=3&s=400" } [/block] [https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs](https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IShipmentService.cs)
{"_id":"56b92b0608d8b20d00bc3b3f","githubsync":"","project":"56421bcdb48bdf19006a4c97","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Merchello.config\"\n}\n[/block]\nThe Merchello config file is a standard XML file which contains several core settings and values that drive the entire Merchello experience.   We will document each of these configuration settings below and include any important notes as required.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Configuration File Location\",\n  \"sidebar\": true\n}\n[/block]\nThe config file can be found:\n\n~/App_Plugins/Merchello/Config/merchello.config\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"<settings />\"\n}\n[/block]\nEach setting in the settings section requires it’s own XML tag. The Alias must be a unique alphanumeric value and match what is defined in the Merchello programming.\nWhen changing a strategy setting, be sure to only specify one for each Alias. Additional strategy settings for the same Alias will be ignored.\nThe following settings available:\n\nDefaultBasketPackagingStrategy: represents the Merchello class to be called when the shopper basket is packaged in preparation for checkout. The attribute value should be specified in the format of “classname, namespace”\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<setting alias=\\\"DefaultBasketPackagingStrategy\\\" value=\\\"Merchello.Web.Shipping.DefaultWarehousePackagingStrategy, Merchello.Web\\\"  />\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"DefaultSkuSeparator\"\n}\n[/block]\nDetermines what ASCII character is used as a separator value in the SKU field for product variants. For example, assume a shirt with SKU tshirt having Red, Blue, Green choices. When variants are generated, the variant SKUs would be “tshirt-1”,”tshirt-2”,”tshirt-3”. The separator character can be configured here if something other than a dash is desired.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<setting alias=\\\"DefaultSkuSeparator\\\" value=\\\"-\\\" />\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"<backOffice />\"\n}\n[/block]\nThe \"backoffice\" sections allows you to configure the title, icon, visibility, and order that the Merchello backoffice tasks appear in the browser.\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"<regionalProvinces />\"\n}\n[/block]\nThis section defines what regions and provinces will be populated in the Merchello backend.  A region is defined as a single XML element that contains child elements for every province within that region.\n\nAttribute **code**:  represents the ISO country code for that region.\n  \nAttribute **requirePostalCode**: can be either \"True\" or \"False\".  Assumed to be \"True\" when not specified.   Used by shipping estimator routines to determine if Postal Code should be required input before attempting a rate estimate.  Not all countries or shipping carriers require a postal code. \n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Requires Postal Code\",\n  \"body\": \"The requires postal code is not actually used in the Merchello core.  The property has been made available for usage in custom shipping providers.\"\n}\n[/block]\nEach individual province must be specified with the attributes **name** and **code**.   \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<region code=\\\"US\\\">\\n  <provinces>\\n    <province name=\\\"Alabama\\\" code=\\\"AL\\\" />\\n    <province name=\\\"Alaska\\\" code=\\\"AK\\\" />\\n    <province name=\\\"Arizona\\\" code=\\\"AZ\\\" />\\n  </provinces>\\n</region>\\n\\n<region code=\\\"CA\\\" requirePostalCode=\\\"True\\\">\\n  <provinces>\\n    <province name=\\\"Alberta\\\" code=\\\"AB\\\" />\\n    <province name=\\\"British Columbia\\\" code=\\\"BC\\\" />\\n    <province name=\\\"Manitoba\\\" code=\\\"MB\\\" />\\n  </provinces>\\n</region>\\n\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","excerpt":"Merchello.config","type":"basic","title":"Configuration Section","category":"56b92aff08d8b20d00bc3b0a","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"order":46,"slug":"configuration-section","__v":0,"link_url":"","version":"56b92afe08d8b20d00bc3afd","updates":[],"createdAt":"2015-11-10T20:55:17.902Z","link_external":false,"user":"564136b9f424a10d001181e1","childrenPages":[]}

Configuration Section

Merchello.config

[block:api-header] { "type": "basic", "title": "Merchello.config" } [/block] The Merchello config file is a standard XML file which contains several core settings and values that drive the entire Merchello experience. We will document each of these configuration settings below and include any important notes as required. [block:api-header] { "type": "basic", "title": "Configuration File Location", "sidebar": true } [/block] The config file can be found: ~/App_Plugins/Merchello/Config/merchello.config [block:api-header] { "type": "basic", "title": "<settings />" } [/block] Each setting in the settings section requires it’s own XML tag. The Alias must be a unique alphanumeric value and match what is defined in the Merchello programming. When changing a strategy setting, be sure to only specify one for each Alias. Additional strategy settings for the same Alias will be ignored. The following settings available: DefaultBasketPackagingStrategy: represents the Merchello class to be called when the shopper basket is packaged in preparation for checkout. The attribute value should be specified in the format of “classname, namespace” [block:code] { "codes": [ { "code": "<setting alias=\"DefaultBasketPackagingStrategy\" value=\"Merchello.Web.Shipping.DefaultWarehousePackagingStrategy, Merchello.Web\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "DefaultSkuSeparator" } [/block] Determines what ASCII character is used as a separator value in the SKU field for product variants. For example, assume a shirt with SKU tshirt having Red, Blue, Green choices. When variants are generated, the variant SKUs would be “tshirt-1”,”tshirt-2”,”tshirt-3”. The separator character can be configured here if something other than a dash is desired. [block:code] { "codes": [ { "code": "<setting alias=\"DefaultSkuSeparator\" value=\"-\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "<backOffice />" } [/block] The "backoffice" sections allows you to configure the title, icon, visibility, and order that the Merchello backoffice tasks appear in the browser. [block:api-header] { "type": "basic", "title": "<regionalProvinces />" } [/block] This section defines what regions and provinces will be populated in the Merchello backend. A region is defined as a single XML element that contains child elements for every province within that region. Attribute **code**: represents the ISO country code for that region. Attribute **requirePostalCode**: can be either "True" or "False". Assumed to be "True" when not specified. Used by shipping estimator routines to determine if Postal Code should be required input before attempting a rate estimate. Not all countries or shipping carriers require a postal code. [block:callout] { "type": "info", "title": "Requires Postal Code", "body": "The requires postal code is not actually used in the Merchello core. The property has been made available for usage in custom shipping providers." } [/block] Each individual province must be specified with the attributes **name** and **code**. [block:code] { "codes": [ { "code": "<region code=\"US\">\n <provinces>\n <province name=\"Alabama\" code=\"AL\" />\n <province name=\"Alaska\" code=\"AK\" />\n <province name=\"Arizona\" code=\"AZ\" />\n </provinces>\n</region>\n\n<region code=\"CA\" requirePostalCode=\"True\">\n <provinces>\n <province name=\"Alberta\" code=\"AB\" />\n <province name=\"British Columbia\" code=\"BC\" />\n <province name=\"Manitoba\" code=\"MB\" />\n </provinces>\n</region>\n", "language": "xml" } ] } [/block]
[block:api-header] { "type": "basic", "title": "Merchello.config" } [/block] The Merchello config file is a standard XML file which contains several core settings and values that drive the entire Merchello experience. We will document each of these configuration settings below and include any important notes as required. [block:api-header] { "type": "basic", "title": "Configuration File Location", "sidebar": true } [/block] The config file can be found: ~/App_Plugins/Merchello/Config/merchello.config [block:api-header] { "type": "basic", "title": "<settings />" } [/block] Each setting in the settings section requires it’s own XML tag. The Alias must be a unique alphanumeric value and match what is defined in the Merchello programming. When changing a strategy setting, be sure to only specify one for each Alias. Additional strategy settings for the same Alias will be ignored. The following settings available: DefaultBasketPackagingStrategy: represents the Merchello class to be called when the shopper basket is packaged in preparation for checkout. The attribute value should be specified in the format of “classname, namespace” [block:code] { "codes": [ { "code": "<setting alias=\"DefaultBasketPackagingStrategy\" value=\"Merchello.Web.Shipping.DefaultWarehousePackagingStrategy, Merchello.Web\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "DefaultSkuSeparator" } [/block] Determines what ASCII character is used as a separator value in the SKU field for product variants. For example, assume a shirt with SKU tshirt having Red, Blue, Green choices. When variants are generated, the variant SKUs would be “tshirt-1”,”tshirt-2”,”tshirt-3”. The separator character can be configured here if something other than a dash is desired. [block:code] { "codes": [ { "code": "<setting alias=\"DefaultSkuSeparator\" value=\"-\" />", "language": "xml" } ] } [/block] [block:api-header] { "type": "basic", "title": "<backOffice />" } [/block] The "backoffice" sections allows you to configure the title, icon, visibility, and order that the Merchello backoffice tasks appear in the browser. [block:api-header] { "type": "basic", "title": "<regionalProvinces />" } [/block] This section defines what regions and provinces will be populated in the Merchello backend. A region is defined as a single XML element that contains child elements for every province within that region. Attribute **code**: represents the ISO country code for that region. Attribute **requirePostalCode**: can be either "True" or "False". Assumed to be "True" when not specified. Used by shipping estimator routines to determine if Postal Code should be required input before attempting a rate estimate. Not all countries or shipping carriers require a postal code. [block:callout] { "type": "info", "title": "Requires Postal Code", "body": "The requires postal code is not actually used in the Merchello core. The property has been made available for usage in custom shipping providers." } [/block] Each individual province must be specified with the attributes **name** and **code**. [block:code] { "codes": [ { "code": "<region code=\"US\">\n <provinces>\n <province name=\"Alabama\" code=\"AL\" />\n <province name=\"Alaska\" code=\"AK\" />\n <province name=\"Arizona\" code=\"AZ\" />\n </provinces>\n</region>\n\n<region code=\"CA\" requirePostalCode=\"True\">\n <provinces>\n <province name=\"Alberta\" code=\"AB\" />\n <province name=\"British Columbia\" code=\"BC\" />\n <province name=\"Manitoba\" code=\"MB\" />\n </provinces>\n</region>\n", "language": "xml" } ] } [/block]
{"_id":"56b92b0808d8b20d00bc3b46","user":"564136b9f424a10d001181e1","githubsync":"","order":47,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Design Pattern\"\n}\n[/block]\nStrategy Design Pattern\n\nReferences:\n* [https://en.wikipedia.org/wiki/Strategy_pattern](https://en.wikipedia.org/wiki/Strategy_pattern)\n* [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)","slug":"overview-1","link_external":false,"hidden":false,"excerpt":"","title":"Strategies","__v":0,"version":"56b92afe08d8b20d00bc3afd","updates":[],"createdAt":"2015-11-11T19:34:13.371Z","sync_unique":"","type":"basic","category":"56b92aff08d8b20d00bc3b0b","project":"56421bcdb48bdf19006a4c97","link_url":"","api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required"},"childrenPages":[]}

Strategies


[block:api-header] { "type": "basic", "title": "Design Pattern" } [/block] Strategy Design Pattern References: * [https://en.wikipedia.org/wiki/Strategy_pattern](https://en.wikipedia.org/wiki/Strategy_pattern) * [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)
[block:api-header] { "type": "basic", "title": "Design Pattern" } [/block] Strategy Design Pattern References: * [https://en.wikipedia.org/wiki/Strategy_pattern](https://en.wikipedia.org/wiki/Strategy_pattern) * [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)
{"_id":"56b92b0808d8b20d00bc3b47","user":"564136b9f424a10d001181e1","githubsync":"","excerpt":"","title":"Anonymous Basket Conversion","api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required"},"category":"56b92aff08d8b20d00bc3b0b","project":"56421bcdb48bdf19006a4c97","updates":[],"link_external":false,"hidden":false,"createdAt":"2015-11-11T19:35:01.831Z","order":48,"__v":0,"type":"basic","version":"56b92afe08d8b20d00bc3afd","link_url":"","sync_unique":"","body":"The basket conversion process happens in the [CustomerContext](customercontext) when the customer gets converted from an anonymous customer to a customer.  During this process, the reference record in merchAnonymousCustomer is abandoned and the application starts referencing the merchCustomer record (so it uses the pk from that table instead of the pk in the merchAnonymousCustomer table).\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Previously Saved Baskets\"\n}\n[/block]\nMerchello ships with two options for dealing with previously saved customer baskets executed by one of two [Strategies](doc:overview-1) .\n\nThe default strategy is to **discard** the previously saved basket *IF* the customer has started items to a new anonymous basket.\n\nThe second strategy is to **merge** the newly created anonymous basket into the previously saved basket.\n\nTo change the configuration, open the **merchello.config** file and change:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"  <strategies>\\n    <strategy alias=\\\"DefaultAnonymousBasketConversionStrategy\\\" type=\\\"Merchello.Web.Workflow.BasketConversionByDiscardingPreviousCustomerBasket, Merchello.Web\\\" />\\n    <!--strategy alias=\\\"DefaultAnonymousBasketConversionStrategy\\\" type=\\\"Merchello.Web.Workflow.BasketConversionByCombiningAnonymousBasket, Merchello.Web\\\" /-->\\n  </strategies>\",\n      \"language\": \"xml\",\n      \"name\": \"DefaultAnonymousBasketConversionStrategy\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Custom Anonymous Basket Conversion Strategy\",\n  \"body\": \"Creating a customized the basket conversion strategy can be accomplished by adding a new class that inherits from `BasketConversionBase` and implementing the `Merge()` method and then introducing the type reference in the merchello.config.\"\n}\n[/block]","slug":"anonymous-basket-conversion","childrenPages":[]}

Anonymous Basket Conversion


The basket conversion process happens in the [CustomerContext](customercontext) when the customer gets converted from an anonymous customer to a customer. During this process, the reference record in merchAnonymousCustomer is abandoned and the application starts referencing the merchCustomer record (so it uses the pk from that table instead of the pk in the merchAnonymousCustomer table). [block:api-header] { "type": "basic", "title": "Previously Saved Baskets" } [/block] Merchello ships with two options for dealing with previously saved customer baskets executed by one of two [Strategies](doc:overview-1) . The default strategy is to **discard** the previously saved basket *IF* the customer has started items to a new anonymous basket. The second strategy is to **merge** the newly created anonymous basket into the previously saved basket. To change the configuration, open the **merchello.config** file and change: [block:code] { "codes": [ { "code": " <strategies>\n <strategy alias=\"DefaultAnonymousBasketConversionStrategy\" type=\"Merchello.Web.Workflow.BasketConversionByDiscardingPreviousCustomerBasket, Merchello.Web\" />\n <!--strategy alias=\"DefaultAnonymousBasketConversionStrategy\" type=\"Merchello.Web.Workflow.BasketConversionByCombiningAnonymousBasket, Merchello.Web\" /-->\n </strategies>", "language": "xml", "name": "DefaultAnonymousBasketConversionStrategy" } ] } [/block] [block:callout] { "type": "info", "title": "Custom Anonymous Basket Conversion Strategy", "body": "Creating a customized the basket conversion strategy can be accomplished by adding a new class that inherits from `BasketConversionBase` and implementing the `Merge()` method and then introducing the type reference in the merchello.config." } [/block]
The basket conversion process happens in the [CustomerContext](customercontext) when the customer gets converted from an anonymous customer to a customer. During this process, the reference record in merchAnonymousCustomer is abandoned and the application starts referencing the merchCustomer record (so it uses the pk from that table instead of the pk in the merchAnonymousCustomer table). [block:api-header] { "type": "basic", "title": "Previously Saved Baskets" } [/block] Merchello ships with two options for dealing with previously saved customer baskets executed by one of two [Strategies](doc:overview-1) . The default strategy is to **discard** the previously saved basket *IF* the customer has started items to a new anonymous basket. The second strategy is to **merge** the newly created anonymous basket into the previously saved basket. To change the configuration, open the **merchello.config** file and change: [block:code] { "codes": [ { "code": " <strategies>\n <strategy alias=\"DefaultAnonymousBasketConversionStrategy\" type=\"Merchello.Web.Workflow.BasketConversionByDiscardingPreviousCustomerBasket, Merchello.Web\" />\n <!--strategy alias=\"DefaultAnonymousBasketConversionStrategy\" type=\"Merchello.Web.Workflow.BasketConversionByCombiningAnonymousBasket, Merchello.Web\" /-->\n </strategies>", "language": "xml", "name": "DefaultAnonymousBasketConversionStrategy" } ] } [/block] [block:callout] { "type": "info", "title": "Custom Anonymous Basket Conversion Strategy", "body": "Creating a customized the basket conversion strategy can be accomplished by adding a new class that inherits from `BasketConversionBase` and implementing the `Merge()` method and then introducing the type reference in the merchello.config." } [/block]
{"_id":"56b92b0908d8b20d00bc3b48","createdAt":"2015-11-11T19:32:51.073Z","hidden":false,"order":49,"excerpt":"The strategy for packaging a basket into one or more shipments.","updates":[],"version":"56b92afe08d8b20d00bc3afd","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","link_external":false,"link_url":"","githubsync":"","sync_unique":"","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"category":"56b92aff08d8b20d00bc3b0b","type":"basic","title":"Basket Packaging","__v":0,"slug":"basket-packaging-strategy","body":"The default basket packaging strategy packages all items into a single shipment.  In more advanced implementations, packaging a basket into multiple shipments may be requirement.  For example, items may be located in different warehouses so they may have different shipping origins and or fulfillment time frames.","childrenPages":[]}

Basket Packaging

The strategy for packaging a basket into one or more shipments.

The default basket packaging strategy packages all items into a single shipment. In more advanced implementations, packaging a basket into multiple shipments may be requirement. For example, items may be located in different warehouses so they may have different shipping origins and or fulfillment time frames.
The default basket packaging strategy packages all items into a single shipment. In more advanced implementations, packaging a basket into multiple shipments may be requirement. For example, items may be located in different warehouses so they may have different shipping origins and or fulfillment time frames.
{"_id":"56b92b0608d8b20d00bc3b38","link_external":false,"slug":"overview-2","updates":[],"hidden":false,"order":50,"link_url":"","api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Design Pattern\"\n}\n[/block]\nChain of Responsibility Pattern\n\nReferences:\n* [https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern)\n* [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)","excerpt":"","type":"basic","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","createdAt":"2015-11-11T19:38:04.315Z","title":"Task Chains","__v":0,"sync_unique":"","category":"56b92aff08d8b20d00bc3b0c","version":"56b92afe08d8b20d00bc3afd","githubsync":"","childrenPages":[]}

Task Chains


[block:api-header] { "type": "basic", "title": "Design Pattern" } [/block] Chain of Responsibility Pattern References: * [https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern) * [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)
[block:api-header] { "type": "basic", "title": "Design Pattern" } [/block] Chain of Responsibility Pattern References: * [https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern) * [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)
{"_id":"56b92b0608d8b20d00bc3b39","link_external":false,"hidden":false,"order":51,"excerpt":"A chain of tasks used to create an invoice executed from within the CheckoutManager.","category":"56b92aff08d8b20d00bc3b0c","version":"56b92afe08d8b20d00bc3afd","updates":[],"project":"56421bcdb48bdf19006a4c97","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"title":"Invoice Creation (Builder)","__v":0,"link_url":"","githubsync":"","type":"basic","body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"    <taskChain alias=\\\"CheckoutManagerInvoiceCreate\\\">\\n      <tasks>\\n        <task type=\\\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddBillingInfoToInvoiceTask, Merchello.Core\\\" />\\n        <task type=\\\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ConvertItemCacheItemsToInvoiceItemsTask, Merchello.Core\\\" />\\n        <task type=\\\"Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddCouponDiscountsToInvoiceTask, Merchello.Web\\\" />\\n        <task type=\\\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ApplyTaxesToInvoiceTask, Merchello.Core\\\" />\\n        <task type=\\\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ValidateCommonCurrency, Merchello.Core\\\" />\\n        <task type=\\\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddInvoiceNumberPrefixTask, Merchello.Core\\\" />\\n        <task type=\\\"Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddNotesToInvoiceTask, Merchello.Web\\\" />\\n      </tasks>\\n    </taskChain>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","slug":"invoice-creation-builder","user":"564136b9f424a10d001181e1","createdAt":"2015-11-11T19:35:32.840Z","sync_unique":"","childrenPages":[]}

Invoice Creation (Builder)

A chain of tasks used to create an invoice executed from within the CheckoutManager.

[block:code] { "codes": [ { "code": " <taskChain alias=\"CheckoutManagerInvoiceCreate\">\n <tasks>\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddBillingInfoToInvoiceTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ConvertItemCacheItemsToInvoiceItemsTask, Merchello.Core\" />\n <task type=\"Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddCouponDiscountsToInvoiceTask, Merchello.Web\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ApplyTaxesToInvoiceTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ValidateCommonCurrency, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddInvoiceNumberPrefixTask, Merchello.Core\" />\n <task type=\"Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddNotesToInvoiceTask, Merchello.Web\" />\n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
[block:code] { "codes": [ { "code": " <taskChain alias=\"CheckoutManagerInvoiceCreate\">\n <tasks>\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddBillingInfoToInvoiceTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ConvertItemCacheItemsToInvoiceItemsTask, Merchello.Core\" />\n <task type=\"Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddCouponDiscountsToInvoiceTask, Merchello.Web\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ApplyTaxesToInvoiceTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.ValidateCommonCurrency, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.InvoiceCreation.CheckoutManager.AddInvoiceNumberPrefixTask, Merchello.Core\" />\n <task type=\"Merchello.Web.Workflow.InvoiceCreation.CheckoutManager.AddNotesToInvoiceTask, Merchello.Web\" />\n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
{"_id":"56b92b0608d8b20d00bc3b3a","excerpt":"","updates":[],"createdAt":"2015-11-11T19:36:13.979Z","sync_unique":"","body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"    <taskChain alias=\\\"OrderPreparationOrderCreate\\\">\\n        <tasks>\\n            <task type=\\\"Merchello.Core.Chains.OrderCreation.ConvertInvoiceItemsToOrderItemsTask, Merchello.Core\\\" />    \\n        </tasks>\\n    </taskChain>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","type":"basic","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[],"url":""},"order":52,"project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","githubsync":"","hidden":false,"slug":"order-creation-builder","title":"Order Creation (Builder)","__v":0,"category":"56b92aff08d8b20d00bc3b0c","version":"56b92afe08d8b20d00bc3afd","link_external":false,"link_url":"","childrenPages":[]}

Order Creation (Builder)


[block:code] { "codes": [ { "code": " <taskChain alias=\"OrderPreparationOrderCreate\">\n <tasks>\n <task type=\"Merchello.Core.Chains.OrderCreation.ConvertInvoiceItemsToOrderItemsTask, Merchello.Core\" /> \n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
[block:code] { "codes": [ { "code": " <taskChain alias=\"OrderPreparationOrderCreate\">\n <tasks>\n <task type=\"Merchello.Core.Chains.OrderCreation.ConvertInvoiceItemsToOrderItemsTask, Merchello.Core\" /> \n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
{"_id":"56b92b0608d8b20d00bc3b3b","link_external":false,"createdAt":"2015-11-11T19:36:29.037Z","githubsync":"","api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required"},"excerpt":"","user":"564136b9f424a10d001181e1","project":"56421bcdb48bdf19006a4c97","sync_unique":"","order":53,"type":"basic","__v":0,"category":"56b92aff08d8b20d00bc3b0c","updates":[],"link_url":"","hidden":false,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"      <taskChain alias=\\\"OrderPreparationShipmentCreate\\\">\\n          <tasks>\\n              <task type=\\\"Merchello.Core.Chains.ShipmentCreation.AddShippableOrderLineItemsToShipmentTask, Merchello.Core\\\" />\\n              <task type=\\\"Merchello.Core.Chains.ShipmentCreation.RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask, Merchello.Core\\\" />\\n              <task type=\\\"Merchello.Core.Chains.ShipmentCreation.SetOrderStatusTask, Merchello.Core\\\" />\\n          </tasks>\\n      </taskChain>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","slug":"shipment-creation-builder","title":"Shipment Creation (Builder)","version":"56b92afe08d8b20d00bc3afd","childrenPages":[]}

Shipment Creation (Builder)


[block:code] { "codes": [ { "code": " <taskChain alias=\"OrderPreparationShipmentCreate\">\n <tasks>\n <task type=\"Merchello.Core.Chains.ShipmentCreation.AddShippableOrderLineItemsToShipmentTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.ShipmentCreation.RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.ShipmentCreation.SetOrderStatusTask, Merchello.Core\" />\n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
[block:code] { "codes": [ { "code": " <taskChain alias=\"OrderPreparationShipmentCreate\">\n <tasks>\n <task type=\"Merchello.Core.Chains.ShipmentCreation.AddShippableOrderLineItemsToShipmentTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.ShipmentCreation.RemoveShipmentOrderItemsFromInventoryAndPersistShipmentTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.ShipmentCreation.SetOrderStatusTask, Merchello.Core\" />\n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
{"_id":"56b92b0608d8b20d00bc3b3c","project":"56421bcdb48bdf19006a4c97","link_url":"","sync_unique":"","__v":0,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"      <taskChain alias=\\\"MerchelloHelperProductDataModifiers\\\">\\n        <tasks>\\n            <task type=\\\"Merchello.Web.DataModifiers.Product.IncludeTaxInProductPriceDataModifierTask, Merchello.Web\\\" />\\n        </tasks>\\n      </taskChain>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","category":"56b92aff08d8b20d00bc3b0c","createdAt":"2015-11-11T19:36:58.782Z","link_external":false,"version":"56b92afe08d8b20d00bc3afd","updates":[],"title":"Product Data Modifier","order":54,"excerpt":"","slug":"product-data-modifier","type":"basic","user":"564136b9f424a10d001181e1","githubsync":"","hidden":false,"api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"childrenPages":[]}

Product Data Modifier


[block:code] { "codes": [ { "code": " <taskChain alias=\"MerchelloHelperProductDataModifiers\">\n <tasks>\n <task type=\"Merchello.Web.DataModifiers.Product.IncludeTaxInProductPriceDataModifierTask, Merchello.Web\" />\n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
[block:code] { "codes": [ { "code": " <taskChain alias=\"MerchelloHelperProductDataModifiers\">\n <tasks>\n <task type=\"Merchello.Web.DataModifiers.Product.IncludeTaxInProductPriceDataModifierTask, Merchello.Web\" />\n </tasks>\n </taskChain>", "language": "xml" } ] } [/block]
{"_id":"56b92b0608d8b20d00bc3b3d","githubsync":"","sync_unique":"","__v":0,"updates":[],"hidden":false,"title":"Item Cache Validation","category":"56b92aff08d8b20d00bc3b0c","project":"56421bcdb48bdf19006a4c97","user":"564136b9f424a10d001181e1","link_external":false,"type":"basic","excerpt":"","slug":"item-cache-validation","version":"56b92afe08d8b20d00bc3afd","createdAt":"2015-11-11T19:37:20.791Z","link_url":"","api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[]},"order":55,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<taskChain alias=\\\"ItemCacheValidation\\\">\\n     <tasks>\\n        <task type=\\\"Merchello.Web.Validation.Tasks.ValidateProductsExistTask, Merchello.Web\\\" />\\n        <task type=\\\"Merchello.Web.Validation.Tasks.ValidateProductPriceTask, Merchello.Web\\\" />\\n        <task type=\\\"Merchello.Web.Validation.Tasks.ValidateProductInventoryTask, Merchello.Web\\\" />\\n    </tasks>\\n</taskChain>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","childrenPages":[]}

Item Cache Validation


[block:code] { "codes": [ { "code": "<taskChain alias=\"ItemCacheValidation\">\n <tasks>\n <task type=\"Merchello.Web.Validation.Tasks.ValidateProductsExistTask, Merchello.Web\" />\n <task type=\"Merchello.Web.Validation.Tasks.ValidateProductPriceTask, Merchello.Web\" />\n <task type=\"Merchello.Web.Validation.Tasks.ValidateProductInventoryTask, Merchello.Web\" />\n </tasks>\n</taskChain>", "language": "xml" } ] } [/block]
[block:code] { "codes": [ { "code": "<taskChain alias=\"ItemCacheValidation\">\n <tasks>\n <task type=\"Merchello.Web.Validation.Tasks.ValidateProductsExistTask, Merchello.Web\" />\n <task type=\"Merchello.Web.Validation.Tasks.ValidateProductPriceTask, Merchello.Web\" />\n <task type=\"Merchello.Web.Validation.Tasks.ValidateProductInventoryTask, Merchello.Web\" />\n </tasks>\n</taskChain>", "language": "xml" } ] } [/block]
{"_id":"56b92b0608d8b20d00bc3b3e","title":"Copy Product","__v":0,"user":"564136b9f424a10d001181e1","version":"56b92afe08d8b20d00bc3afd","link_external":false,"hidden":false,"api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"type":"basic","category":"56b92aff08d8b20d00bc3b0c","project":"56421bcdb48bdf19006a4c97","createdAt":"2015-11-11T19:37:48.852Z","link_url":"","excerpt":"","updates":[],"order":56,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<taskChain alias=\\\"CopyProduct\\\">\\n    <tasks>\\n          <task type=\\\"Merchello.Core.Chains.CopyEntity.Product.CopyProductOptionsTask, Merchello.Core\\\" />\\n          <task type=\\\"Merchello.Core.Chains.CopyEntity.Product.SaveProductCopyTask, Merchello.Core\\\" />\\n          <task type=\\\"Merchello.Core.Chains.CopyEntity.Product.AddProductToWarehouseCatalogsTask, Merchello.Core\\\" />\\n          <task type=\\\"Merchello.Core.Chains.CopyEntity.Product.MapProductVariantDataTask, Merchello.Core\\\" />\\n          <task type=\\\"Merchello.Core.Chains.CopyEntity.Product.CopyProductCollectionsTask, Merchello.Core\\\" />\\n          <task type=\\\"Merchello.Core.Chains.CopyEntity.Product.CopyDetachedContentTask, Merchello.Core\\\" />\\n    </tasks>\\n</taskChain>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","slug":"copy-product","githubsync":"","sync_unique":"","childrenPages":[]}

Copy Product


[block:code] { "codes": [ { "code": "<taskChain alias=\"CopyProduct\">\n <tasks>\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.CopyProductOptionsTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.SaveProductCopyTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.AddProductToWarehouseCatalogsTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.MapProductVariantDataTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.CopyProductCollectionsTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.CopyDetachedContentTask, Merchello.Core\" />\n </tasks>\n</taskChain>", "language": "xml" } ] } [/block]
[block:code] { "codes": [ { "code": "<taskChain alias=\"CopyProduct\">\n <tasks>\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.CopyProductOptionsTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.SaveProductCopyTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.AddProductToWarehouseCatalogsTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.MapProductVariantDataTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.CopyProductCollectionsTask, Merchello.Core\" />\n <task type=\"Merchello.Core.Chains.CopyEntity.Product.CopyDetachedContentTask, Merchello.Core\" />\n </tasks>\n</taskChain>", "language": "xml" } ] } [/block]
{"_id":"56b92b0508d8b20d00bc3b37","type":"basic","user":"564136b9f424a10d001181e1","updates":[],"createdAt":"2015-11-11T19:38:26.941Z","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Design Pattern\"\n}\n[/block]\n Represent an operation to be performed on elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.\n[Gang of Four](https://en.wikipedia.org/wiki/Design_Patterns)\n\n\nReference: \n* [https://en.wikipedia.org/wiki/Visitor_pattern](https://en.wikipedia.org/wiki/Visitor_pattern)\n* [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Visitor to find all line items with an extended data value.\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"namespace Merchello.Examples\\n{\\n    using System.Collections.Generic;\\n\\n    using Merchello.Core.Models;\\n\\n    using Umbraco.Core;\\n\\n    /// <summary>\\n    /// A line item visitor to return line items with a specific value\\n    /// </summary>\\n    public class ExtendedDataValueVistor : ILineItemVisitor\\n    {\\n        /// <summary>\\n        /// The extended data key.\\n        /// </summary>\\n        private readonly string _key;\\n\\n        /// <summary>\\n        /// The exented data value.\\n        /// </summary>\\n        private readonly string _value;\\n\\n        /// <summary>\\n        /// The resulting line items.\\n        /// </summary>\\n        private List<ILineItem> _lineItems = new List<ILineItem>();\\n\\n        /// <summary>\\n        /// Initializes a new instance of the <see cref=\\\"ExtendedDataValueVistor\\\"/> class.\\n        /// </summary>\\n        /// <param name=\\\"extendedDataKey\\\">\\n        /// The extended data key.\\n        /// </param>\\n        /// <param name=\\\"extendedDataValue\\\">\\n        /// The extended data value.\\n        /// </param>\\n        public ExtendedDataValueVistor(string extendedDataKey, string extendedDataValue)\\n        {\\n            Mandate.ParameterNotNullOrEmpty(extendedDataKey, \\\"extendedDataKey\\\");\\n            Mandate.ParameterNotNullOrEmpty(extendedDataValue, \\\"extendedDataValue\\\");\\n        }\\n\\n        /// <summary>\\n        /// Gets the matching items.\\n        /// </summary>\\n        public IEnumerable<ILineItem> MatchingItems\\n        {\\n            get\\n            {\\n                return _lineItems;\\n            }\\n        }\\n\\n        /// <summary>\\n        /// Visits the line item and checks for an extended data key / value.\\n        /// </summary>\\n        /// <param name=\\\"item\\\">\\n        /// The item.\\n        /// </param>\\n        public void Visit(ILineItem item)\\n        {\\n            // if the key does not exist - return\\n            if (!item.ExtendedData.ContainsKey(_key)) return;\\n\\n            var value = item.ExtendedData.GetValue(_key);\\n\\n            // if the value does not match - return\\n            if (!value.Equals(_value)) return;\\n\\n            // add the item to the result collection\\n            _lineItems.Add(item);\\n        }\\n    }\\n\\n}\",\n      \"language\": \"csharp\",\n      \"name\": \"ExtendedDataValueVistor\"\n    }\n  ]\n}\n[/block]\nNow we can use it to find items in any `LineItemCollection` (Basket, WishList, Invoice, Order, Shipment)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var invoiceKey = new Guid(\\\"CEE79DA2-0214-492B-8C61-84E6E38FC80E\\\"); // invoice key from somewhere\\n\\nvar invoice = MerchelloContext.Current.Services.InvoiceService.GetByKey(invoiceKey);\\n\\nvar visitor = new ExtendedDataValueVistor(\\\"demoKey\\\", \\\"demoValue\\\");\\n\\ninvoice.Accept(visitor);\\n\\nvar matchingItems = visitor.MatchingItems;\\n\",\n      \"language\": \"csharp\",\n      \"name\": \"Finding line items\"\n    }\n  ]\n}\n[/block]","link_url":"","__v":0,"githubsync":"","sync_unique":"","excerpt":"","title":"Line Item Visitors","category":"56b92aff08d8b20d00bc3b0d","project":"56421bcdb48bdf19006a4c97","version":"56b92afe08d8b20d00bc3afd","link_external":false,"order":57,"slug":"lineitemvisitors","childrenPages":[]}

Line Item Visitors


[block:api-header] { "type": "basic", "title": "Design Pattern" } [/block] Represent an operation to be performed on elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. [Gang of Four](https://en.wikipedia.org/wiki/Design_Patterns) Reference: * [https://en.wikipedia.org/wiki/Visitor_pattern](https://en.wikipedia.org/wiki/Visitor_pattern) * [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library) [block:api-header] { "type": "basic", "title": "Example Visitor to find all line items with an extended data value." } [/block] [block:code] { "codes": [ { "code": "namespace Merchello.Examples\n{\n using System.Collections.Generic;\n\n using Merchello.Core.Models;\n\n using Umbraco.Core;\n\n /// <summary>\n /// A line item visitor to return line items with a specific value\n /// </summary>\n public class ExtendedDataValueVistor : ILineItemVisitor\n {\n /// <summary>\n /// The extended data key.\n /// </summary>\n private readonly string _key;\n\n /// <summary>\n /// The exented data value.\n /// </summary>\n private readonly string _value;\n\n /// <summary>\n /// The resulting line items.\n /// </summary>\n private List<ILineItem> _lineItems = new List<ILineItem>();\n\n /// <summary>\n /// Initializes a new instance of the <see cref=\"ExtendedDataValueVistor\"/> class.\n /// </summary>\n /// <param name=\"extendedDataKey\">\n /// The extended data key.\n /// </param>\n /// <param name=\"extendedDataValue\">\n /// The extended data value.\n /// </param>\n public ExtendedDataValueVistor(string extendedDataKey, string extendedDataValue)\n {\n Mandate.ParameterNotNullOrEmpty(extendedDataKey, \"extendedDataKey\");\n Mandate.ParameterNotNullOrEmpty(extendedDataValue, \"extendedDataValue\");\n }\n\n /// <summary>\n /// Gets the matching items.\n /// </summary>\n public IEnumerable<ILineItem> MatchingItems\n {\n get\n {\n return _lineItems;\n }\n }\n\n /// <summary>\n /// Visits the line item and checks for an extended data key / value.\n /// </summary>\n /// <param name=\"item\">\n /// The item.\n /// </param>\n public void Visit(ILineItem item)\n {\n // if the key does not exist - return\n if (!item.ExtendedData.ContainsKey(_key)) return;\n\n var value = item.ExtendedData.GetValue(_key);\n\n // if the value does not match - return\n if (!value.Equals(_value)) return;\n\n // add the item to the result collection\n _lineItems.Add(item);\n }\n }\n\n}", "language": "csharp", "name": "ExtendedDataValueVistor" } ] } [/block] Now we can use it to find items in any `LineItemCollection` (Basket, WishList, Invoice, Order, Shipment) [block:code] { "codes": [ { "code": "var invoiceKey = new Guid(\"CEE79DA2-0214-492B-8C61-84E6E38FC80E\"); // invoice key from somewhere\n\nvar invoice = MerchelloContext.Current.Services.InvoiceService.GetByKey(invoiceKey);\n\nvar visitor = new ExtendedDataValueVistor(\"demoKey\", \"demoValue\");\n\ninvoice.Accept(visitor);\n\nvar matchingItems = visitor.MatchingItems;\n", "language": "csharp", "name": "Finding line items" } ] } [/block]
[block:api-header] { "type": "basic", "title": "Design Pattern" } [/block] Represent an operation to be performed on elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. [Gang of Four](https://en.wikipedia.org/wiki/Design_Patterns) Reference: * [https://en.wikipedia.org/wiki/Visitor_pattern](https://en.wikipedia.org/wiki/Visitor_pattern) * [http://www.pluralsight.com/courses/patterns-library](http://www.pluralsight.com/courses/patterns-library) [block:api-header] { "type": "basic", "title": "Example Visitor to find all line items with an extended data value." } [/block] [block:code] { "codes": [ { "code": "namespace Merchello.Examples\n{\n using System.Collections.Generic;\n\n using Merchello.Core.Models;\n\n using Umbraco.Core;\n\n /// <summary>\n /// A line item visitor to return line items with a specific value\n /// </summary>\n public class ExtendedDataValueVistor : ILineItemVisitor\n {\n /// <summary>\n /// The extended data key.\n /// </summary>\n private readonly string _key;\n\n /// <summary>\n /// The exented data value.\n /// </summary>\n private readonly string _value;\n\n /// <summary>\n /// The resulting line items.\n /// </summary>\n private List<ILineItem> _lineItems = new List<ILineItem>();\n\n /// <summary>\n /// Initializes a new instance of the <see cref=\"ExtendedDataValueVistor\"/> class.\n /// </summary>\n /// <param name=\"extendedDataKey\">\n /// The extended data key.\n /// </param>\n /// <param name=\"extendedDataValue\">\n /// The extended data value.\n /// </param>\n public ExtendedDataValueVistor(string extendedDataKey, string extendedDataValue)\n {\n Mandate.ParameterNotNullOrEmpty(extendedDataKey, \"extendedDataKey\");\n Mandate.ParameterNotNullOrEmpty(extendedDataValue, \"extendedDataValue\");\n }\n\n /// <summary>\n /// Gets the matching items.\n /// </summary>\n public IEnumerable<ILineItem> MatchingItems\n {\n get\n {\n return _lineItems;\n }\n }\n\n /// <summary>\n /// Visits the line item and checks for an extended data key / value.\n /// </summary>\n /// <param name=\"item\">\n /// The item.\n /// </param>\n public void Visit(ILineItem item)\n {\n // if the key does not exist - return\n if (!item.ExtendedData.ContainsKey(_key)) return;\n\n var value = item.ExtendedData.GetValue(_key);\n\n // if the value does not match - return\n if (!value.Equals(_value)) return;\n\n // add the item to the result collection\n _lineItems.Add(item);\n }\n }\n\n}", "language": "csharp", "name": "ExtendedDataValueVistor" } ] } [/block] Now we can use it to find items in any `LineItemCollection` (Basket, WishList, Invoice, Order, Shipment) [block:code] { "codes": [ { "code": "var invoiceKey = new Guid(\"CEE79DA2-0214-492B-8C61-84E6E38FC80E\"); // invoice key from somewhere\n\nvar invoice = MerchelloContext.Current.Services.InvoiceService.GetByKey(invoiceKey);\n\nvar visitor = new ExtendedDataValueVistor(\"demoKey\", \"demoValue\");\n\ninvoice.Accept(visitor);\n\nvar matchingItems = visitor.MatchingItems;\n", "language": "csharp", "name": "Finding line items" } ] } [/block]
{"_id":"56b92b0908d8b20d00bc3b49","user":"564136b9f424a10d001181e1","updates":[],"api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"__v":0,"version":"56b92afe08d8b20d00bc3afd","link_url":"","githubsync":"","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"C#\"\n}\n[/block]\nWhen developing new Class Libraries we will be adhereing as closely as possible to the official guidelines as [proposed by Microsoft](http://msdn.microsoft.com/en-us/library/ms229042.aspx)\n\nAnother good reference is \"Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries\" book by Krzysztof Cwalina and Brad Abrams.","excerpt":"","project":"56421bcdb48bdf19006a4c97","createdAt":"2015-11-10T20:26:34.753Z","sync_unique":"","order":58,"slug":"standards","type":"basic","category":"56b92aff08d8b20d00bc3b0e","link_external":false,"hidden":false,"title":"General Code Standards","childrenPages":[]}

General Code Standards


[block:api-header] { "type": "basic", "title": "C#" } [/block] When developing new Class Libraries we will be adhereing as closely as possible to the official guidelines as [proposed by Microsoft](http://msdn.microsoft.com/en-us/library/ms229042.aspx) Another good reference is "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams.
[block:api-header] { "type": "basic", "title": "C#" } [/block] When developing new Class Libraries we will be adhereing as closely as possible to the official guidelines as [proposed by Microsoft](http://msdn.microsoft.com/en-us/library/ms229042.aspx) Another good reference is "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams.