More in this section

Forums / Developing with Sitefinity / Sequence contains more than one matching elelment

Sequence contains more than one matching elelment

2 posts, 0 answered
  1. Ajai
    Ajai avatar
    15 posts
    02 Mar 2015
    25 May 2015
    Link to this post

    Hi all,

    I am working with sitefinity 7.0.

    I have eCommerce  enable in my cms and have some dummy product manually created.

    I have created some product by API also.Now when i am clicking the Products menu under eCommerce section, it shows an alert shows ,says that "Sequence contains more than one matching elelment"

    I am not able browse any products ?

    Given below is the code that i have used?

    CatalogManager manager = CatalogManager.GetManager();
                EcommerceManager ecommerceManager = EcommerceManager.GetManager();
                foreach (var myProduct in myProducts)

                    if (manager.GetProducts().Where(t => t.Title == myProduct.Title).SingleOrDefault() != null)
                        continue;     // Product already exists

                    ProductType productType = ecommerceManager.GetProductTypes().Where(t => t.Title == myProduct.ProductTypeName).SingleOrDefault();
                    if (productType == null)
                        continue;      // Product Type does not exist

                    Product product = manager.CreateProduct(productType.ClrType);
                    product.ClrType = productType.ClrType;

                    product.Title = myProduct.Title;
                    product.AssociateBuyerWithRole = Guid.Empty;
                    product.DateCreated = DateTime.Now;
                    product.Description = myProduct.Description;
                    //product.IsShippable = myProduct.IsShippable;
                    product.Price = myProduct.Price;
                    //product.SaleEndDate = myProduct.SaleEndDate;
                    //product.SaleStartDate = myProduct.SaleStartDate;
                    //product.SalePrice = myProduct.SalePrice;
                    product.Sku = myProduct.Sku;
                    product.UrlName = Regex.Replace(myProduct.Title.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");
                    product.Visible = true;
                    //product.Weight = myProduct.Weight;

                    product.Status = Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master;


                    var contextBag = new Dictionary<string, string>();
                    contextBag.Add("ContentType", product.GetType().FullName);

                    string workflowOperation = "Publish";



     Any idea on this?

  2. Kaloyan
    Kaloyan avatar
    272 posts
    06 Feb 2017
    28 May 2015
    Link to this post
    Hi Ajai,

    I have already provided an answer in the ticket that Anju Raman recently opened. You can check it for more details regarding this issue.

    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered