I would like to make a suggested feature to have a button that permanently deletes products from the DB that have not been ordered. And for it to delete the pictures, attributes, SEO URL, basically everything in the Nop DB that is tied to that product...I know this isn't a HUGE suggestion, but I like to have clean tables :/ call me weird.
Even products that 'have' been ordered should be able to be actually deleted (IMO). Checking to verify the 'current' existence of a product (with it's associated product info, photos, etc) could be performed, and if no 'valid current' product is located then replacement is made with generic 'product unavailable' messages (much like the check for the presence of an image or the default image is shown).
IMO, Historical orders should not 'pull' current product details to display for an order in the past... the info for the current version of a product available for purchase could vary from the historically purchase item. So, why guard & store deleted products and associated data. If the data for an order is desired to be stored, store 'only' what would have been included with an order record... with whatever variables existed for THAT singular order.
my 2 cents ;-)
I finally implemented this! Thanks!
What versions of Nop is this valid for? RewardPointsHistory delete makes it not valid on 4.2
The column UsedWithOrder_Id isn't in RewardPointsHistory table:
delete FROM RewardPointsHistory where UsedWithOrder_Id in (select orderID from OrderItem where productId = @ProductId)