Jump to content

Alexander

Members
  • Posts

    92
  • Joined

  • Last visited

Everything posted by Alexander

  1. @LostKobrakai You using in "show this field only if" with something like "roles=1011" and this is working for you?
  2. @toothpaste Nice website, but please, think twice about "wet floor" under logotype. It's looks like visual noise and you can use that place for better positioning of your logotype. For sure it's only my personal viewpoint.
  3. @adrian, This is awesome, thank you!
  4. Maybe someone know how forbid access to edit page if user not author of page. Like deny access for edit if created_users_id != this->user. Thanks!
  5. @Guy Verville, I played a lot with Shop-for-Processwire with PW 2.5.7 dev without any issues.
  6. @OrganizedFellow, maybe you will be able to explain real benefits for business owner like (just for example) better ranking by google, because PW is faster and can be easy adapted for SEO or unreal benefits, like unicorn inhabit inside PW.
  7. Wow! Actual it's look little bit different. Chalet ARepeater 1Arrival=2014-09-13 Booked=1 Repeater 2Arrival=2014-09-20 Booked=0 Chalet BRepeater 1Arrival=2014-09-14 Booked=0 Repeater 2Arrival=2014-09-21 Booked=0 When searched with dates 2014-09-13 | 2014-09-14 I want to return only Chalet B because it's not booked. More than, if forget about booked=0 and use this code it's take around 7 seconds. $selector = "template=chalet, clndr.arrival={$dates}|{$todate}"; If use search without repeater for normal fields like checkbox, it works as normal. So, I'm thinking maybe it's better to made hidden copy of all repeaters line to checkboxes like 20140921=0, 20140921=1 and use them for searching.
  8. Sfrosman, thank you for trying. This selector returns all chalets with selected dates in repeater and some of booked=0. Another words, it's not possible to use this selector to check booked exactly selected dates or not.
  9. Dear all, I have 205 pages with repeaters. Each repeater has 21 lines with two fields: date field and checkbox. I use this function to find free chalets for selected days and it's take around 10 seconds. Any suggestion of possible speedup this? Maybe PageTable is faster in this case? function find($selector) { if (wire('sanitizer')->name(wire('input')->get->dates)) { $dates = wire('sanitizer')->name(wire('input')->get->dates); $dates = strtotime($dates); $todate = strtotime("+1 day", $dates); $selector .= "template=chalet"; $chalets = wire('pages')->find($selector); foreach ($chalets as $chalet) { foreach ($chalet->clndr->find('arrival=' . $dates . '|' . $todate . ', booked=0') as $r) { ... } } }
  10. Brilliant! It's 100% works! Now I can sleep well. Kongondo, thank you very much for your help!
  11. Kongondo, yes and no. I know, that is not elegant way, but I try to find page parent that have the same name with user to provide access. $p->set('id', 15729) = working $p->set('id', $p_page) = no $p_user = $user->name; // set user name $p_page = $pages->find("title=$user->name"); // try to find page with the same with user name $p = $this->modules->get('ProcessPageList'); // kongondo's code goes here $p->set('id', $p_page); // setting the parent page to user name page May be you know the reason?
  12. Thank you, Kongondo, you made me happy.
  13. Good day everybody, I'm trying to make Custom Page with one of Pages Tree. I took this code https://processwire.com/talk/topic/6315-processpagelist-to-hide-some-pages/?hl=backend for custom page template: <?php $form = $this->modules->get('InputfieldForm'); // prep the form $wrapper = new InputfieldWrapper; // a wrapper $wrapper->attr('value', 'List of available articles'); $p = $this->modules->get('ProcessPageList'); // kongondo's code goes here $p->set('id', 4049); // setting the parent page $pageTree = new InputfieldMarkup; // the placeholder $pageTree->value = $p->execute(); // fill the InputfieldMarkup form field... $wrapper->add($pageTree); // put inside the wrapper... $form->append($wrapper); // append the wrapper ?> No success. The main idea is to give to each user separate space for editing only his pages and prevent access to system pages and pages of other users. What did I miss? Thanks for any hints.
  14. Hdesigns, I live in Chamonix and always ready for action!
  15. I get one word — Φιλοξενία it's look similar with russian Философия (philosophy). Site looks great, but maybe more organic to put menu from right to left side, because greek people (I think) reading from left to right and most useful part of content must be on the left side. Good luck.
  16. Ryan, thanks for your assistant, but it was my fault. I using date field without strtotime. But, I have some really strange bug. I use "limit" in selector and it works not very well. For example, if I use limit=1 or 2 or 3, I get the same numbers of result. But, if limit=4 or 5, result = 3 item. If limit=6,7,8,9 result = 4 item. Any idea why this happens? For sure, this bug happens only for dates. $result = wire('pages')->find($selector); return normal results with right limits. Here is my code: $selector = "template=chalet, limit=10"; $result = wire('pages')->find($selector); if (wire('sanitizer')->name(wire('input')->get->dates)) { $dates = wire('sanitizer')->name(wire('input')->get->dates); $dates = strtotime($dates); foreach ($result as $res) { foreach ($res->clndr->find('arrival=' . $dates . ', book=0') as $r) { $i++; if($i==1) {$result=$result->makeNew();} $r = $r->GetForPage(); $result->add($r); } } } return $result; For example: foreach ($res->clndr->find('arrival=' . $dates . ', book=0') as $r) if limit=8, $r= 7416,7889,7893,7898, (4 results) if limit=10, $r= 7416,7889,7893,7898,7903, (5 results) if limit=100, $r= 7416,7889,7893,7898,7903,7394,7402,7398,7817, (all 9 results) Sorry for this dummy question. Maybe someone can help, what to do with foreach ($res->clndr->find('arrival=' . $dates . ', book=0') as $r) pagination?
  17. Now I see my fail. With strtotime works correct.
  18. Dear Soma, million thanks for your help. Your words and logic as always direct to the correct result. For sure, your code is absolutely right and I try to use this code before, but with zero result. $p->calendar->find("booked=0, checkin_1=16.11.2013")All problem were with date field. In some reason (maybe output data format or something) selector don't find correct result for this date field. I try to use different date in selector, like d.m.y, y.m.d & etc but nothing works.So, I just change data field to usual text field. Now works absolutely fine.
  19. This is all picture. pa=5773|5789 — Find result for 16.11. p=5773 — First property r=5975 — checkin 17.11, booked 0 r=5976 —checkin 18.11, booked 0 r=6816 — checkin 19.11, booked 0 p=5789 — Second property r=5919 — checkin 16.11, booked 0 The problem is, that I need to remove not correct dates from results.
  20. As find result $pa=5773|5789 and this is correct. But $p->calendar->find('booked=0') return r=5773 r=5773 r=5773 r=5789, that is $r — all entry of booked=0 in repeater, and I need only for select date. Sorry for difficult explain.
  21. Nik, thanks for your clarification. I feel that two deferent templates in one selector is not good idea. I tried another way, but it also return not correct result (without "booked" checking). $pa = $pages->find("template=property, calendar.checkin_1=16.11.2013, fireplace=1"); foreach ($pa as $p) { foreach($p->calendar->find('booked=0') as $r) { $r = $r->getForPage(); $content .= renderItem($r); } } Using the occasion, I want to thank you for great "selector test" module. It's really helpful.
  22. $pa = $pages->find("template=property, calendar.checkin_1=16.11.2013, fireplace=1"); foreach ($pa as $p) { foreach($p->calendar->find('booked=0') as $r) { $r = $r->getForPage(); $content .= renderItem($r); } } Hi, I try to use this code to find free week for bookings. (calendar is repeater with dates and checkbox "booked") 1) Find all property with 16.11.2013 in calendar (by repeater). 2) Check that this week is free (checkbox "booked" = 0). But in some reason, I just get property for this dates and checkbox don't work. What I'm doing wrong?
  23. $selector = 'template=chalet, fireplace=1'; $allresults = wire('pages')->find($selector); $availability = $allresults->find("template=repeater_calendar, checkin=17.11.2013, booked=0, include=all"); foreach($availability as $item) { $availability = $item->getForPage(); $content .= renderItem($availability); } Hello! I try to find some repeater from another selector, but nothing happens. Find for repeater works fine, but not for $allresults (only for $pages). Can you tell what I'm doing wrong?
×
×
  • Create New...