Developer forum

Forum » Development » ECommerce cant delete products ..

ECommerce cant delete products ..

Vilius Janulis
Reply
Hi,

We are having a problem that DW is not deleting product from everywhere.

For example : I have created product with unique ID ("7897897987"), then deleted it in back-end (second mouse -> delete), then i run my custom scripts, that loops throughout all products and checks if product id is equal to 7897897987, and i still get positive answer.

Codes:
loop throughout all products
 foreach (Product checkExistsProduct in productCollection2)
{
         if (checkExistsProduct.ID == (string)productInfo[0])
        {
                productExists = true;
         }
}
Also tried the same , to do it by code ...

//if product needs to be deleted
 if (Base.ChkNumber(productInfo[12]) == 1)
 {
        foreach (Product checkExistsProduct in productCollection2)
        {
                  if (checkExistsProduct.Number == (string)productInfo[0])
                  {
                            Product.Delete(checkExistsProduct.ID);
            }
    }
}

And still getting same results .. so how to delete product in DW completely ?

Thank you.

Replies

 
Pavel Volgarev
Reply
Hi Vilius,

  • How do you obtain the collection of products ("productCollection2")? Via which method?
  • When your code is executed? 
  • Can it be that you have the same product in multiple languages and it's only deleted from the current language (Dynamicweb.eCommerce.Common.Context.Language)?
-- Pavel 

 

You must be logged in to post in the forum