Jump to content

Tree design question, really simple.


mendoz

Recommended Posts

Hey freaks.

 

I'm working on a products catalog application.

 

Every product has a parent category.

 

The categories are organized nicely in a tree,

Only the leaves have products associated with them.

 

I hope you understood because now comes the questions:

 

1. What to do with the products associated with a leaf after it has been deleted?

    Should I delete the products as well? Put them in a trash bin?

 

2. What happens with the children of a node after it's deletion?

    Do they become the children of the node's parent?

 

3. Why do I like this site?

    Because the people are nice and answer fast and accurate !

Link to comment
https://forums.phpfreaks.com/topic/105705-tree-design-question-really-simple/
Share on other sites

1. What to do with the products associated with a leaf after it has been deleted?

    Should I delete the products as well? Put them in a trash bin?

 

This is entirely up to yourself (or your client), I would ask them what they want to happen.  Personally

we usually have a separate products manager, a category manager, and a products to category manager.

 

If a category was deleted it would orphan the products in it, but we would leave the products available in

the products table, but perhaps use an icon to show they are not assigned to a category.

 

2. What happens with the children of a node after it's deletion?

    Do they become the children of the node's parent?

 

Again, down to how you want it to work and up to you to code.  Typically we would warn the user

that deleting a parent node will remove all children.

 

3. Why do I like this site?

    Because the people are nice and answer fast and accurate !

 

Hope it was quick enough ;-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.