Jump to content

dfile

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dfile

  • Rank
    Newbie
  1. Hello, I am running ProcessWire 3.0.165 but $input->urlSegmentLast or $input->urlSegment(-1) does not work as expected. Or do I something wrong? Thank you.
  2. Thanks for your feedback. I ended up doing this: For each product I store the parend category for each category in the page reference field. This way I can easy count all products in the parent category. $this->addHookBefore('Pages::saved', function(HookEvent $event) { $pages = $event->object; $page = $event->arguments(0); if($page->template == 'produkt') { //remove parent kategorie foreach($page->pro_kategorie_parent as $item) { $page->pro_kategorie_parent->remove($item); } $page->save(pro_kategorie_parent); foreach($page->pro_raeume_par
  3. The page reference field (pro_kategorie) have only the level 3 category. Here i can count the products, but then i have to go up to level 2 and add all products in all level 3 categories to the count of level 2. Sorry if that was not clear. I have to search the categories from bottom to top like this $parentId=$pages->find($id)->parent(); this doesn't make things easy in processwire, or did I miss something?
  4. yes, i know count, so far i have this result, but only for level 3 of the categories: //categories level3 $kategorienId=getCategoryLevel3($page); $produktCount=WireArray(); foreach ($kategorienId as $id){ $count=$pages->count("template=produkt, pro_kategorie=$id"); $produktCount->add($count); } $kategorienId->data('count', $produktCount); var_dump($kategorienId->data('count')); and this is the ugly function getCategoryLevel3: function getCategoryLevel3($page){ $pages=wire('pages'); $id=WireArray(); $p=''; $data=''; if ($page->children!='
  5. Hello, i must count products per category like so: category 1 (4 products) --category 1.1 (2 products) ----category 1.1.1 (1 product) and so on. category 1 --category 1.1 ----category 1.1.1 ----category 1.1.2 ----category 1.1.3 --category 1.2 ----category 1.2.1 ----category 1.2.2 ----category 1.2.3 produkts have page references for the categories: product 1 -- page reference->category 1.1.1 -- page reference->category 1.1.3 -- page reference->category 1.2.2 -- page reference->category 1.2.3 what is the best way to do this, i have many categories and man
  6. i edit the render function in ProcessPageListRenderJSON.php public function render() { $children = array(); ############################################### $toBottom=array( //system, login ################################### 1088, 1036, ); $bottomPages=array(); // pages forced to bottom of list $extraPages = array(); // pages forced to bottom of list foreach($this->children as $page) { if(!$this->superuser && !$page->listable()) continue; if(in_array($page->id, $this->systemIDs)) { $extraPages[] = $page; continue; }
  7. LostKobrakai - thank you for your answer. unfortunately after add the pages to the systemIDs there are only visible by superuser.
  8. Hello! I'm new here and have a question: i want to force pages to stay at the bottom of the pagetree: I edit the ProcessPageListRenderJSON.php and it works. class ProcessPageListRenderJSON extends ProcessPageListRender { protected $systemIDs = array(); public function __construct(Page $page, PageArray $children) { parent::__construct($page, $children); $this->systemIDs = array( $this->config->http404PageID, $this->config->adminRootPageID, $this->config->trashPageID, $this->config->loginPageID, //system login #########################
×
×
  • Create New...