Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Matzn

  1. @Macrura I have tested something. If add the date field to page or repeater page it works, but not to a fieldsetpage: echo "\nFieldsetPage:\n"; echo $page->Check->ratingDate; echo "\n"; echo $page->Check->getUnformatted("ratingDate"); echo "\nPage:\n"; echo $page->ratingDate; echo "\n"; echo $page->getUnformatted("ratingDate"); echo "\nRepeaterPage:\n"; echo $page->About->businessProvider->first()->ratingDate; echo "\n"; echo $page->About->businessProvider->first()->getUnformatted("ratingDate"); Live Result: FieldsetPage: 19.05.2021 19.05.2021 Page: 19.05.2021 1621375200 RepeaterPage: 19.05.2021 1621429619 It's a bug or i can set somthing?
  2. @wbmnfktr ic know this postes, but no way to get the unix timestamp by $page->getUnformatted('yourDateField'); I also used it in several projects, but now the output must be set for date field to none. So i use this date field only as $page->yourDateField; I also don't understand why one field is save as unix and the other not (same settings).
  3. Hi, i have two date fields. One stores in unix timestamp (ratingDate) the other as a normal date (googlePageSpeedDate). Both have the same settings! How can I influence the saving? The strange thing is that I can't get the unix timestamp by (Check is the FieldsetPage) $page->Check->getUnformatted('googlePageSpeedDate'); ProcessWire\FieldsetPage Object ( [id] => 9932 [name] => for-page-1072 [parent] => /admin_panel_page/repeaters/for-field-389/ [template] => repeater_Check [name1067] => [status1067] => 1 [googlePageSpeedDate] => 2021-05-17 00:00:00 [data] => Array ( [name1067] => [status1067] => 1 [googlePageSpeedDate] => 2021-05-17 00:00:00 ) ) ProcessWire\RepeaterPage Object ( [id] => 1137 [name] => 1618998033-3988-1 [parent] => /admin_panel_page/repeaters/for-field-312/for-page-1075/ [template] => repeater_businessProvider [name1067] => [status1067] => 1 [isSocialMedia] => 0 [businessProviderPage] => (Page) 1132 [rating] => 4,6 [ratingUsers] => 10 [ratingDate] => 1621240175 [urlTo] => https://maps.google.com/?cid=11132489695980159614 [reviewUrl] => [data] => Array ( [name1067] => [status1067] => 1 [isSocialMedia] => 0 [businessProviderPage] => ProcessWire\Page Object
  4. It´s a old post, but i'm looking for this same problems. Hope, helps you, too. It must be noted that if "When output formatting is off the value of an image/files field is always a WireArray" found here to save works only $page->save(image/files field) Example for a custom field "counter" : $page->of(false); $file = $page->csvFiles->first(); $file->counter = "your content here"; $page->save('csvFiles'); Actually easy.
  5. Omg. The issue is caused at php version 8.0.2. Processwire running perfekt to php 7.4. I'm looking for entries in protocolls: nothing. No php error or warnings for this issue. That's mean. @wbmnfktr @BitPoet I thank both of you. Closed
  6. Nothing special. Only add new fields to template and somthing in template output. No. That's the weird thing. I don't touch hooks or other settings. Language only change default backend settings. It's an (almost) new installation. I think slowly it is due to php or something on the server. I've an other similar project. I will to compare this booth.
  7. Ok, then I understood your family restrictions setting. No, in none template set family restrictions. I've already checked everything - what I know. If the template is unused i can change the page to them, but not if used for other page. I despair...😭
  8. No, "Don't allow pages to change their template" is not checked. I'm the superuser and the parent page is home. I'm not sure what do you mean with family restriction by parent page?
  9. Hi. I use a fresh multilanguage site. I only change default language to german. Now i can't chang the page template after use this template for one page, although multiple use is permitted. Some ideas?
  10. @tomaskostadinov and how do you access the fields by language? I found only a solution by suffix. Or there is another solution?
  11. Ok, it seems as if the fields are only translated for the Pageobject. Either you create a page and moves all fields there or you call up the fields of the modules include the suffix as follows: english: myField german: myField__1024 if ($user->language->name != "default") $lable = "__" . $user->language->id; $modules->get('Mymodule')->get("myField$lable");
  12. Hi @Zeka some fields from $page are switch in right language, but not the field from modul. It doesn't matter whether I call up the modul-field in the template or via hook.
  13. Hi. To manipulate the page output i use the hook Page::render. It works for html, php etc without touch the templatefiles. Example i build a modul called "Mymodul" and integrate some multilanguages fields: class MymodulConfig extends ModuleConfig public function getInputfields() { $inputfields = parent::getInputfields(); $ckeditorToolbar ='Format, Bold, Italic, -, RemoveFormat'; $f = $this->modules->get('InputfieldCKEditor'); $f->toolbar($ckeditorToolbar); $f->attr('name', 'myField'); $f->useLanguages = true; $inputfields->add($f); return $inputfields; } } and add it to all pages: public function ready() { if ($this->page->template != 'admin') { $this->addHookAfter('Page::render', $this, 'addSome'); } } public function addSome($event) { ob_start(); eval('?>'.'<?php echo $this->modules->get('Mymodule')->myField ;?>'. '<?php'); $add = ob_get_contents(); ob_end_clean(); $event->return = str_replace("</body>", $add . "</body>", $event->return); } What i'm missing are the variables for $languages and the switching of the multi languages fields from module. Does somebody has any idea why get only the default language field from modul?
  14. 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"');
  15. 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"
  16. 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?
  17. 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; }
  18. Hi, use $pages->count https://processwire.com/api/ref/pages/count/ for each category like: $cnt = $pages->count('parent=yourCategory,id=yourProductId');
  19. 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); } });
  20. 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
  21. 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; } });
  22. 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.
  23. 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
  24. 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?
  25. 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?
  • Create New...