Sequence contains more than one matching elelment
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;
manager.Provider.RecompileItemUrls(product);
manager.SaveChanges();
var contextBag = new Dictionary<string, string>();
contextBag.Add("ContentType", product.GetType().FullName);
string workflowOperation = "Publish";
WorkflowManager.MessageWorkflow(product.Id,
product.GetType(),
"OpenAccessDataProvider",
workflowOperation,
false,
contextBag);
Any idea on this?
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.
Regards,
Kaloyan
Telerik