Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral

About Matzn

  • Rank
    Jr. Member

Profile Information

  • Gender
  • Location
    Neuruppin, Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hui, the solution is very easy: $matches = $pages->find("selector")->not("selector"); Example for trees: //all 1,5m no 11,5m $matches = $pages->find('title%=tree, title%="1,5 m")->not(title%="11,5 m"'); //all 11,5m no 1,5m $matches = $pages->find('title%=tree, title%="11,5 m")->not(title%="1,5 m"');
  2. Thanks all for yous ideas. I must had a tittle more explain my project. The page listing all trees und i use the height for a ajax filter function. I wan´t add a new field. It was more about the basic to the selectors. Hope external links ok. A example: https://gutschein-für.de/preisvergleich/layher-uni-komfort-fahrgeruest-universalgeruest-mit-treppenaufstieg/ @MoritzLost It would be good, but you dirt solution don´t work 'title%=" 1,5 m". All Whitspaces lost. @Robin S Yes, if add a additional word befor it works, but need only "1,5m"/"11,5 m"
  3. I have some page titles, eg.: green tree 1,5 m brown tree 1,5 m green tree 11,5 m brown tree 11,5 m yellow banana 0,5 m To find all 1,5 m trees is my selector ('title%=tree, title%="1,5 m"') , but results are also 11,5 m trees. My first idea was to exclude "11,5 m" ('title%=tree, title%="1,5 m", title!%="11,5 m"') But exclude 1,5 m for 11,5 m searching i get not results ('title%=tree, title%="11,5 m", title!%="1,5 m"') Yes, i have tested *=, ~=. What am i missing?
  4. Your function returns only category 3. To get all pages (categories) in you category tree you can $kategorien = $page->find(); //or $kategorien = $page->descendants(); After count your products for each category foreach ($kategorien as $kategorie){ $count = $pages->count("template=produkt, pro_kategorie={$kategorie->id}"); echo $count . " Produkte in Kategorie " . $kategorie->title; }
  5. Hi, use $pages->count https://processwire.com/api/ref/pages/count/ for each category like: $cnt = $pages->count('parent=yourCategory,id=yourProductId');
  6. Hi. I need the repeater id by a field inside the repeater via api. $repeater = $page->my_repeater; foreach ($repeater as $row) { if ($row->id == "repeater->myField->inside_the_repeater_row"){ ..someting } } For a selected field i need it, but a chikld from a other selected field. Maybe you have a better idea? $wire->addHookAfter('InputfieldPage::getSelectablePages', function ($event) { if ($event->object->hasField == 'productOptionValue') { $page = $event->arguments('page'); $options = $page->product_options; foreach ($options as $option) { if ($option->id == "285110") { $selector = 'parent=' . $option->product_option_key; } } $event->return = $event->pages->find($selector); } });
  7. Maybe, you must switch the language by $language->get('de'); and after $pages->find https://processwire.com/docs/multi-language-support/multi-language-fields/#getting-and-setting
  8. Ok, you are right @Robin S. I think, now i understand you. 🤦‍♂️ Your idea to use a field for the parent-child relationship works great: I add a empty repeaterfield to template. In ready.php i add to a edit button (each children page) include pagination. It looks like it´s a repeater field items (old page situation). All happy. $this->addHookAfter('Inputfield::render', function (HookEvent $event) { $field = $event->object; $form = wire('modules')->get("InputfieldForm"); //get edit page $page_id = $this->input->get('id'); $page = $this->pages->get($page_id); //add child pages to empty repeater - items not moveable, deletable or to clone if ($field->name === 'products') { $childPages = $page->children('limit=15'); $pagination = $childPages->renderPager(['getVars' => array("id" => $page_id)]); foreach ($childPages as $childPage) { //build the fake-repeater header $wrap = $this->wire('modules')->get('InputfieldFieldset'); $wrap->addClass('InputfieldRepeaterItem InputfieldStateCollapsed InputfieldRepeaterMinItem InputfieldNoFocus'); $wrap->name = "repeater_item_{$childPage->id}"; $wrap->label = $childPage->index + 1 . ': ' . $childPage->product_title . ' Art.: ' . $childPage->title; //if all fields are filled out mark the header $isFilledOut = ($childPage->product_keyword && $childPage->product_type); ($isFilledOut ? $wrap->addClass("text-black", "headerClass") : ""); //add the edit button for the child page (class pw-modal for modal edit) $submit = wire('modules')->get("InputfieldButton"); $submit->attr("value", "Produkt Details bearbeiten"); $submit->attr('data-href', wire('config')->urls->admin . "page/edit/?id=" . $childPage->id); $submit->addClass('pw-modal uk-margin-bottom uk-margin-left'); $wrap->add($submit); $form->add($wrap); } $field_style = '<style>.text-black{color:black !important;}.InputfieldRepeaterItemControls{display:none !important;}</style>'; $event->return = $form->render(); $event->return .= $field_style; $event->return .= $pagination; } });
  9. Hi @Robin S , that was a misunderstanding. I understood i should put the data in a child's page, which i had already done and was shown in the first screenshot. But you mean the page lister for parent child relationship. Sorry for that. Why i want to solve this with repeaters is because it offers a better overview and is easier to operate (project requirement). Parents' page is the brand (there are many) next child is the repeater and all last children are the product data. However, the product data must be edited manually (fill in 2 additional fields). Once the product has been processed, the repeater header is marked in color. That's my idea for the solution to this project. I'll take a look at that.
  10. Thanks @Pixrael I think the best solution is from @louisstephens for buying the profields plugin: https://processwire.com/blog/posts/fieldtype-pagination/#example-profields-table. I looking now 1 hour for this issue and this plugin coast only 129,-€ Thanks all. closed
  11. Thanks for your replies. Your are right for the closed field, but not for loading rows. That i have done. Look at the screenshot. Only title, product_id and the button to child page. Maybe the solution would be to limit the the pages befor output. For example in ready.php like this: $this->addHookAfter('Inputfield::render', function (HookEvent $event) { $Inputfield = $event->object; if ($Inputfield->name == 'products') { $limitedPages = $this->pages->find('limit=5,id=' . $Inputfield->hasPage->children); $pagination = $limitedPages->renderPager(['getVars' => array("id" => $this->input->get('id'))]); $event->return = $Inputfield; $event->return .= $pagination; } }); Pagination render and a get a limited page object, but the page object expect something that i don´t know. Some ideas?
  12. I have a page with only one repeater field. But there are many rows(1000 or more). You already guessed it, this page loading very slow if i want editing. Can i add pagination for repeater rows or you have some idea for this slow down issue?
  13. Ok, now i understand that a selector finds only a page not a separated field. For my solution i must iterate the arrays or i using a own db query.
  14. Yea, my first post. I used processwire a time, but always all questions a found in this great forum. Thanks to all members. I know, i finding a page by selector. Like this: $pages->find('template=repeater_products, check_access=0, product_keyword=' . $page->title); But, how i find all values by a field name? For example, the code below give 3 results, now i want all values from a field as array. E.g. product_option_key from my screenshot like this: [0] => Speicher [1] => Farbe At time i use the php way, like this: $productOverviewList = $pages->find('template=repeater_products, check_access=0, product_keyword=' . $page->title); $productOptionList = []; foreach ($productOverviewList as $item) { foreach ($item->product_options as $key) { if (array_key_exists($key->product_option_key->title, $productOptionList)) { $str = $productOptionList[$key->product_option_key->title] . ","; $str .= $key->product_option_value; $productOptionList[$key->product_option_key->title] = $str; } else { $productOptionList[$key->product_option_key->title] = $key->product_option_value; } } } Maybe you have a better solution for me?
  • Create New...