<?php
/* There might be a better way to accomplish this. The only reason to have 2 templates is to give find() a way * to only return the actual product pages, and not all the parent pages as well.
*
* update: You may want to look into using the alternative template method:
* http://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/
*
* With this approach you would create a real file (product.php) for the product template,
* catalogue template would have no file associated, but point to product.php under the advanced settings tab.
*/
include("./site/templates/head.inc");
include("./site/templates/product-view.inc");
include("./site/templates/foot.inc");
<?php
$brand = "";
$type = "";
$collection = "";
if ($input->urlSegment1) $brand = ",brand.name=".$input->urlSegment1;
if ($input->urlSegment2) $type = ",type.name=".$input->urlSegment2;
if ($input->urlSegment3) $collection = ",collection.name=".$input->urlSegment3;
if ($input->urlSegment4) { // if Segment 4, then we know what page to get
$product = $pages->get("name=$input->urlSegment4");
echo $product->title;
} else if ($input->urlSegment1){ // check if we are using URL segments
if ($input->urlSegment1 == "all"){
$products = $pages->find("has_parent=$input->urlSegment2, template=product");
} else {
$products = $pages->find("has_parent=$page->path, template=product, . $brand . $type . $collection");
}
foreach ($products as $p){
echo $p->title;
}
} else {
$products = $pages->find("has_parent=$page->path, template=product");
foreach ($products as $p){
echo $p->title;
}
}
$products = $pages->find("parent=/catalogue/, template=product, brand.name=brand1");
$products = $pages->find("parent=/catalogue/, template=product, brand.name=brand1, type.name=casual");
$products = $pages->find("parent=/catalogue/, template=product, brand.name=brand1, type.name=casual, collection.name=trendy");
$products = $pages->find("has_parent=men, template=product");
$products = $pages->find("has_parent=shoes, template=product");
$products = $pages->find("has_parent=hats, template=product");
$products = $pages->find("has_parent=/catalogue/men/shoes/, template=product");
$products = $pages->find("parent=/catalogue/men/shoes/, template=product, brand.name=brand1");





Find content
Not Telling
