Why are records not really deleted in the database?

7 years ago
no use arguing if you start blaming for not testing (which I have)
7 years ago
Perhaps a compromise would be a routine that deletes marked fields after a certain amount of time.  That time would be designated by the admin (possibly make it an option that can be turned off to maintain data forever and ever).  Yes, data integrity would be compromised afterwards, however, if they backed up their orders ahead of time to pdf or excel, that would give reference.  Just a thought going forward maybe.
6 years ago
If you want to delete a product from Product table permantely, add this line to :


\Libraries\Nop.Services\Catalog\ProductService.cs


        public virtual void DeleteProduct(Product product)
        {
            if (product == null)
                throw new ArgumentNullException("product");
            
            //delete product
            product.Deleted = true;            
            UpdateProduct(product);

            // ADD THIS LINE BELOW  (permanately deletes the product) :
            _productRepository.Delete(product);            
        }
5 years ago
MikeMCSD wrote:
If you want to delete a product from Product table permantely, add this line to :


\Libraries\Nop.Services\Catalog\ProductService.cs


        public virtual void DeleteProduct(Product product)
        {
            if (product == null)
                throw new ArgumentNullException("product");
            
            //delete product
            product.Deleted = true;            
            UpdateProduct(product);

            // ADD THIS LINE BELOW  (permanately deletes the product) :
            _productRepository.Delete(product);            
        }


Will this delete associated records as well or will it leave orphaned data that might cause issues?

Thanks.
4 years ago
It will only delete product record in one table. Else associated data like images, store mapping will still be in database.
2 years ago
Hello,

We have made a plugin to do this https://www.nopcommerce.com/p/3241/plugin-to-recover-deleted-products-in-nopcommerce-by-nopadvance.aspx