Deleting categories

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 Jahre weitere
HI there
Ive just done a bulk import of product categories (3 levels) and something went badly wrong !
They are not in the correct sequence atall after the initial first few parent child sequence. Its gone haywire !

I tried to import 2000 categories in total. many of which are sub categories of a parent category.

i am running nopCommerce version 3.80
I imported from excel file.
Once imported nopcommerce did not stick to the parent child category structure and seems to have moved most categories !

i assumed nopcommerce would be able to handle a bulk import of categories?
is there a way to bulk delete categories and start again?
7 Jahre weitere
RE: bulk delete categories
You can do it with SQL, but to be safe, you should also delete the category relations - e.g.:

DELETE from Category
DELETE from Product_Category_Mapping
DELETE from Discount_AppliedToCategories
7 Jahre weitere
Thank you for quick reply.

can you tell me what software do i need to connect to the sql d/b?

do you know if there a  bug in nopcommerce latest version that cannot import categories in the correct structure? Im cluesses as to how it would mess them up so badly...

Thanks !
7 Jahre weitere
Move devs will use a tool like SSMS (Sql Server Management Studio), but there are lighter weight tools out there like Query Express.

(I don't know if the import is buggy)
6 Jahre weitere
Firstly, I'm an engineer, not a web developer, so my knowledge is basic at best, but have somehow managed to get a site working (My last prestashop one just didn't work).  

My main issue I can foresee is being able to mass delete categories/products and see above that the SQL needs editing to do so.  Where is the code actually placed and how is it done?  Does anyone know any good links to a guide on working with SQL files?

Thanks, Paul
6 Jahre weitere
Hello ALL,

I just imported a collection of categories and did so by using an Excel sheet that I exported from the store...

After importing the new categories, I noticed that a number of 'previously existing' categories were duplicated.
SHORT STORY... they don't belong & are not desired... never used... I don't want them in the DB ;-)

Would someone that knows what they are doing << not me ;-) >> be kind enough to provide an SQL statement that I can safely run that will ACTUALLY DELETE any categories that I have marked 'deleted' ??

An additional statement to ACTUALLY DELETE any products marked 'deleted' (in a similar manner) would be AWESOME !!!

ANY help would be GREATLY APPRECIATED
6 Jahre weitere
So with my massive experience (not), I've found the following works to clear the categories and the products.  Just make a good DB backup first then you can revert back.  Be careful with the delete pictures command as it remove them all, including the store logo, sliders etc.  It's better to remove them one by one as you need then reseeding to the last picture you actually want to keep, for example, my first 23 pictures are logos, sliders etc so use DBCC CHECKIDENT (Picture, RESEED, 23)

This essentially gives you a clean store.

DELETE FROM ShoppingCartItem
DELETE FROM ReturnRequest
DELETE FROM OrderNote
DELETE FROM GiftCard
DELETE FROM OrderItem
DELETE FROM RecurringPaymentHistory
DELETE FROM RewardPointsHistory
DELETE FROM [Order]
DELETE FROM RelatedProduct
DELETE FROM ProductAttributeCombination
DELETE FROM ProductAttributeValue
DELETE FROM Product_ProductAttribute_Mapping
DELETE FROM ProductAttribute
DELETE FROM ProductReviewHelpfulness
DELETE FROM ProductReview
DELETE FROM Product_Picture_Mapping
DELETE FROM Picture
DELETE FROM Product_ProductTag_Mapping
DELETE FROM ProductTag
DELETE FROM Product_Category_Mapping
DELETE FROM Product
DELETE FROM Category
DELETE FROM Manufacturer

DBCC CHECKIDENT (ShoppingCartItem, RESEED, 0)
DBCC CHECKIDENT (ReturnRequest, RESEED, 0)
DBCC CHECKIDENT (OrderNote, RESEED, 0)
DBCC CHECKIDENT (OrderItem, RESEED, 0)
DBCC CHECKIDENT (RecurringPaymentHistory, RESEED, 0)
DBCC CHECKIDENT (RewardPointsHistory, RESEED, 0)
DBCC CHECKIDENT ([Order], RESEED, 0)
DBCC CHECKIDENT (RelatedProduct, RESEED, 0)
DBCC CHECKIDENT (Product_ProductAttribute_Mapping, RESEED, 0)
DBCC CHECKIDENT (ProductAttributeCombination, RESEED, 0)
DBCC CHECKIDENT (ProductAttributeValue, RESEED, 0)
DBCC CHECKIDENT (ProductAttribute, RESEED, 0)
DBCC CHECKIDENT (ProductReviewHelpfulness, RESEED, 0)
DBCC CHECKIDENT (ProductReview, RESEED, 0)
DBCC CHECKIDENT (Product_Picture_Mapping, RESEED, 0)
DBCC CHECKIDENT (Picture, RESEED, 0)
DBCC CHECKIDENT (ProductTag, RESEED, 0)
DBCC CHECKIDENT (Product_Category_Mapping, RESEED, 0)
DBCC CHECKIDENT (Product, RESEED, 0)
DBCC CHECKIDENT (Category, RESEED, 0)
DBCC CHECKIDENT (Manufacturer, RESEED, 0)
6 Jahre weitere
THANKS!

So, this will basically "reset" EVERYTHING?

Do you know if there is a way to "surgically" deal with (delete for real) the specific items that are marked "deleted", without wiping the store clean?
6 Jahre weitere
I used this set to clear mine then manually did the pictures DB so not to ruin my store sliders etc an reseeded that to 23 which is how many useful images I have.

DELETE FROM RelatedProduct
DELETE FROM ProductReviewHelpfulness
DELETE FROM ProductReview
DELETE FROM Product_Picture_Mapping
DELETE FROM Product_ProductTag_Mapping
DELETE FROM ProductTag
DELETE FROM Product_Category_Mapping
DELETE FROM Product

DBCC CHECKIDENT (RelatedProduct, RESEED, 0)
DBCC CHECKIDENT (ProductReviewHelpfulness, RESEED, 0)
DBCC CHECKIDENT (ProductReview, RESEED, 0)
DBCC CHECKIDENT (Product_Picture_Mapping, RESEED, 0)
DBCC CHECKIDENT (ProductTag, RESEED, 0)
DBCC CHECKIDENT (Product_Category_Mapping, RESEED, 0)
DBCC CHECKIDENT (Product, RESEED, 0)
6 Jahre weitere
Thanks again!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.