Created
July 17, 2013 12:47
-
-
Save sitefinitySDK/6020257 to your computer and use it in GitHub Desktop.
SF_10.1, SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/for-developers-query-a-single-product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using Telerik.Sitefinity.Ecommerce.Catalog.Model; | |
using Telerik.Sitefinity.GenericContent.Model; | |
using Telerik.Sitefinity.Modules.Ecommerce.Catalog; | |
namespace Telerik.Sitefinity.Documentation.CodeSnippets.SitefinityEssentials.Modules.Ecommerce.Products | |
{ | |
public partial class ProductsCodeSnippets | |
{ | |
public static Product GetProductByTitle(string title) | |
{ | |
CatalogManager catalogManager = CatalogManager.GetManager(); | |
Product product = catalogManager.GetProducts().Where(p => p.Title == title && p.Status == ContentLifecycleStatus.Master).SingleOrDefault(); | |
return product; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this code correct? It uses
p.Status == ContentLifecycleStatus.Master
, but according to your own documentation shouldn't this useContentLifecycleStatus.Live
?https://docs.sitefinity.com/for-developers-content-lifecycle