Jump to content

cehlo

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by cehlo

  1. Indeed, that's look quite easy. I haven't seen it there. Thanks, keep up the great work ?
  2. @kongondo Firstly, great work. I am watching all about the development od padloper 2 from the start a in looked very promising. Finally, the time has come that I need to create new e-commerce site. How is it with implementation of additional payment gateways? Is there some abstract class for that, or what it be too difficult to implement solution on my own based on already implemented gateways - stripe, paypal?
  3. Ok, so according to your previous post variable $pizza->ingredient is page array so you must use foreach also for ingredients.
  4. If you are getting ID of ingredient possible workaround could be this: $ingredient = $pages->get($pizza->ingredient); Then use $ingredient as page, eg. $ingredient->title... Maybe check settings of your field in Pw if nothing is out of ordinary.
  5. Now it is a lot clearer. Yes you are right in both points. Either way from your first post it was not certain. Regarding variables you are right, but in your first post your first php input was using variables without giving them value. So $percent = $goalNum / $raisedNum; will give you everytime 0, becasue variables $goalNum and $raisedNum are empty. But I can see from your next post that you are giving them values so it was just misunderstanding. If count is another variable it is also without problems from your full code, consider my first post as irrelevant then. i Ok and what about your fields? Are they Integer or Text fields? Can you change them and avoid typecasting at all?
  6. Hello Spercy16, Firstly I don't think it is good practice (or possibility at all) to use dollar sign in fields name - raisedAmount$count - really bad practice to my opinion. Continue using camelCase style or add underscore - raisedAmountCount or raisedAmount_count. First error: In your first example - you are calling variables $goalNum and $raiseNum without declaring them at all. That is why these variables are empty. Second problem: raisedAmount$count and goalAmount$count are fields or pages? Get rid of dollar sign in field name and use direct aproach for calling fields in this scenario. $page->raisedAmountCount etc. (page->get documentation). Also do not typecast these variables in your code. If this field should contain only integer values than change field type in processwire to Integer. Really your main problem are fields you are calling raisedAmount$count. Is this the field name? Or is it child page with another field $count? Maybe give us more information about your field and page structure to tell you right way to call these fields. <? php $raised = $page->raisedAmountCount; //if these fields are integer type $goal = $page->goalAmountCount; $percent = $goal / $raised; // You will change this, because you are calling not existing vars ?> <progress value="<?php echo $percent; ?>" max="100"></progress> <!-- This should be working without any problems -->
  7. Hmm, maybe try to explain better. Formbuilder is not used for creating pages, it is used for creating forms and saving input in meaningful manner to PW. You can just insert created form with formbuilder to any template on frontend, it is not connected to creating pages and templates as far as I know.
  8. Hi there, first the answer depends on that if your array "children" is PageArray. If yes I believe if you want currently viewed page you must check if child->id is simalar like page->id not parent->id. Secondly if you want to check if checkbox is checked the right way will be: $child->checkbox_field == 1 Also I think you know this but else if must be put before else statement :D. Lastly maybe consider using custom menu builder for this. Menu Builder. In addition this checking can be done before building actual markup for menu. So you can consider this solution an then you won't need else if. $menuPages = $pages->find('menu_item=1'); //and add additional selectors for template etc., also you can use selector like this for method children() Cheers.
  9. It is very strange, when I used bardump in tracy console during this error with same line: bd($this->user->language->isDefault()) no error in tracy. I am just rubbing my head on this for like 4 hours and can't find no error or the cause of this. I even try fresh install of pw, imported database and site folder with no help. Then deleted ready file, all modules files still problem persists... Adding also some more error description from debugModelPanel. Thanks for help in advance.
  10. Maybe little bit old, but again same error. Now I can't save or edit user profile for another user than superuser. I am not currently changing by any means edit profile module nor hooking it. And this is popping out. Maybe at least some advice how to track error more precisely, because now is only forwarding me to LoaderCache and there is no problem. Thank you very much.
  11. Hi there, If I understand correctly you don't want to have selected none page? If that is the case, just drop down pages for select, find that one which is selected and choose "unselect".
  12. Hi guys, I am just thinking about purchasing Form Builder. First, I want to ask if it is possible to generate forms also on backend custom pages, because in description of module is written only about generation forms in frontend? You would ask why would I want to use forms in backend. There are some events, which I want to create online registration for - different for members - they will log in and It will automatically load information from their accounts to forms, on the other hand there will be different form for users which do not have accounts on frontend. Thank you for your assistance. Cheers Cehlo
  13. Hi guys, just one shor question maybe just for my insight. When we are using PageArray like array of pages, it is possible to have same page in there twice? Specific problem - I had created method to generate pedigree of dog with 30 ancestors. It is PageArray and order of pages / dogs is important here to generate fronted output. So, You know dogs are not very monogamic and inside one pedigree it is possible that one male ancestor is there multiple times. So problem is that during generation of this PageArray, when there is second occurence of same page / ancestor, first will disapper. So my question is - is not possible to have same page multiple times in Page Array or should I look for some errors in my code (which I did not find for now) ? <?php // It is not same code, but this is all according to manipulation with pageArray I am using when I am creating PageArray $pedigree = new PageArray(); $pedigree->add($ancestor_page); ?> Thank you for your answers. Cheers B.
  14. Hi there, I do not know where the problem is, but the notice is not showing when users are logout. It is showing only when logged in as superuser (on frontend, or module configuration page). Any Ideas what could be the problem? Also I tried to reinstall module, refrech cache, clear local storage. Still I tried it on various devices, cookie notice is nowhere to be found. Thank you very much.
  15. Hi folks, do you have some ideas to my problem? I can´t really find the solution. When I am editing any page with different role than admin the top processwire menu disappears. Only happens while editing. See photo. Thank you very much for any help. Cheers.
  16. Hi folks, I am reaching you one more time for help with error I can´t solve. The setup is little more complicated, but I will try to introduce it in the best way. I have multiple user roles, one of them is role "member". These members have certain pages that they can edit, permission is granted during some automated process ( request for permission to edit, check if it is authorized, grant permission - via custom modules and hooks) but permission for editing is saved via module "PageEditPerUser". This pages which "member" can edit, have PageReference field, which is pointing on that user (Access - Users - Page of user) - field is called "dog_ownerSelect" and is used for loading personal data of owner = authorized user to page. Problem appears when the member is logged into processwire and he want to see pages which he can edit on live site. Return is only some error which does not seem have sense. On site traditionally error 500, because it is not superuser - output from tracydebugger error log is: [2019-11-03 10-30-56] PHP Notice: Undefined property: ProcessWire\User::$language in /nfsmnt/hosting1_1/b/5/b5ca8bf7-6179-408f-b688-09da79c8a644/daisy.sk/sub/hovawart/wire/core/PagesLoaderCache.php:236 @ https://hovawart.daisy.sk/databaza-chovu/chov/dajana-z-posonia/ When I added TracyDebugger permission to member, result: Call to a member function isDefault() on null. I am using $language in multiple places but that doesn't seem to be problem. I traced the error in file to using variable "dog_ownerSelect" in any way. <?php if(!$page->dog_ownerSelect){ } else { } ?> If there is this variable (which is pointing to user who is logged in) in any place in the file, it throws error I described. But this error occurs only if the user with role member is trying to look the page which he can edit. When you try to load page with guest or superuser or other member which doesn't have right to edit this page everything is going 100% smooth. Thank you for any suggestion where the error might be. Cheers Cehlo
  17. Thank you all. WillyC hit it. That was my one little mistake ?
  18. Hello, i just hit another problem. Maybe is very easy, but I can not find the place where I am having error. So I am doing some admin custom page - it shows requests from users for administrator. Administrator checks request and then should hit button approve or delete request. I am done this by creating table, and for each row in template I want to add also link with some data for GET. Problem is that table for some reason does not encode/render the link proper way - it only output html markup. (image 1, 2). Maybe I am missing something important? My relevant part of code below: <?php class ProcessRequests extends Process { public function init() { parent::init(); // required } public function ___execute() { $requests = new WireArray(); $match = $this->pages->find("template=request"); $requests->import($match); $requests->unique(); $requests->sort("-created"); $count = count($requests); if ($count) { $url = $this->config->urls->admin . 'page/edit/?id='; $table = $this->modules->get('MarkupAdminDataTable'); $table->setSortable(true); $table->setEncodeEntities(true); $table->headerRow(array( $this->_('#'), $this->_('Názov žiadosti'), $this->_('Typ žiadosti'), $this->_('Týka sa psa'), $this->_('Žiadosť podal'), $this->_('Vytvorená'), $this->_('Akcia'), )); foreach ($requests as $key => $u) { $mailer = $this->pages->get($u->request_mailer_id); $dog_ref = $this->pages->get($u->request_dog_reference->id); $table->row(array( $count - $key, $u->title => $url . $u->id, $u->request_type->title, $dog_ref->title => $url . $dog_ref->id, $mailer->name, date('Y.m.d - H:i', $u->created), "<a href=''>Schváliť</a>", )); } $out .= $table->render(); } else { $out .= "<p>" . $this->_("Well done, all dogs are edited.") . "</p>"; } return $out; } } Thanks for any replies :).
  19. The solution with module suggested by Adrian works perfectly, no more headaches. My problem was that the field dog-father and dog mother are fields Page Autocomplete, but with query selector, for dog_mother -> show only pages of template where dog_sex = female and for dog_father ->show only pages of template where dog_sex = male. So when I create new page via Autocomplete by hitting enter, it does not populate created page in field because, created page have no dog_sex setting saved, only title when doing it this way. Now I create all page in modal, dog_sex is required field so, problem solved.
  20. Yes, you understand perfectly ? Thank you very much, you spare me from a long headache ? But in all cases how would be the correct way to return created page id with that hook? Is it even possible?
  21. Yes exactly, I want to create page with default title, but at same time populate value to one field in created page in relation with Page Reference field in which was new page created. My assumption is that I need to return value of page id created with this function ___processInputAddPages($input) /if that is possible/ and than add to created page desired value in relation with Page reference field. $wire->addHookAfter('InputfieldPage::processInputAddPages', function($event) { // Retrieve added page id - this is the hard part, I don't know how to do this // And than populate values to another field $field = $event->object; if($field->name == "dog_father"){ $page = $pages->get(???); //need for ID of created page $page->setAndSave('dog_sex', 1); } else if($field->name == "dog_mother"){ $page = $pages->get(???); //need for ID of created page $page->setAndSave('dog_sex', 2); } }); Or I am coming totally wrong on this? ?
  22. Hello everyone, I am starting to creating some hooks, but I am little bit new to this part of Processwire so please help ?. My problem: I have multiple fields in one template - Page Reference - I activated autocomplete and also possibility of creating new pages from the fields. Is it possible to add additional values to newly created page via Page Reference field? For example: I know that the name of Page reference field is called for example car - I am searching with autocomplete for example for Mercedez, it is not created, so I know that newly created page via this field will have value in category field - cars,... I think I should addHookbefore to InputfieldPage::processInputAddPages, am I on the right track? Any assumptions? Thanks for help.
  23. OK, I finally get it working. I must admit that I don't know where the problem was. Solution with Page::listable, does not seem to work. I was using also Tracy debugger, bardump - return what I expected, but nothing changes on page. So I was doing little testing and searching and I come with this, which seems to work. ? <?php namespace ProcessWire; $wire->addHookAfter('ProcessPageList::find', function(HookEvent $event) { if($this->user->isSuperuser()) return; $pages = $event->return; if($this->config->ajax){ foreach($pages as $p) { if($p->template == 'test') $pages->remove($p); } $event->return = $pages; } });
×
×
  • Create New...