Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $catrefs = array();
- $catlist = array();
- foreach($categories as $tmp) {
- $thisref = &$catrefs[ $tmp['id'] ];
- $thisref['parent_id'] = $tmp['parent'];
- $thisref['name'] = $tmp['name'];
- $thisref['products'] = $tmp['products'];
- $thisref['totals'] = $tmp['products'];
- if($tmp['parent'] == 0) {
- $catlist[ $tmp['id'] ] = & $thisref;
- }
- else {
- $catrefs[ $tmp['parent'] ]['children'][ $tmp['id'] ] = &$thisref;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement