Saturday, March 30, 2013

Re: Product / Category Tree Help

Create the following db tables:

table nodes, where you will have a minimum of the following fields: 
id, title, path, parent_id, lft, rght, type

In the field: path, save the full path on which you will find your posts.
Field: type, is reserved for storing content types, eg '1 '. categories, '2 '. products,..


table closures, view presentation

table posts, where you store the product description, etc

table atachments, where you store the product pictures..


Routing like this

Router::connect('/:path/*', array('admin'=>false,'controller' => 'nodes', 'action' => 'show'),array('pass'=>array('path','page'),'page' =>'[0-9]+'));


Node::show();

public function show() {
$path = func_get_args();
//debug($path);
$last_arg = end(array_values($path));

if (is_numeric($last_arg)) {
$page = $last_arg;
//debug($page);
array_pop($path);
$path = implode("/", $path);
$this -> request -> params['named']['page'] = $last_arg;
} else {
$path = implode("/", $path);
}
....
}
Regards, Nikola


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: