Jump to content


  • Posts

  • Joined

  • Last visited

About Barry

  • Birthday 07/03/1982

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

3,788 profile views

Barry's Achievements

Full Member

Full Member (4/6)




Community Answers

  1. I'm trying to sort an array of found locations by the count reviews that have said location filled in in the page field. I have the following: $locations = $pages->find("template=location, location_images!='', sort=count[template=review, location=$should_name_of_location_with_images]"); I know the nested selector isn't right. But what I'm trying to illustrate what i'm trying to achieve, which is to find locations which have at least 1 image and sort them by the count of pages with template "review" and have the location that has at least 1 image filled in in the location page field set in review.
  2. Sorry, I wasn't clear, I meant, when you select a different brand than was already saved and add a new model at the same time, the hook won't work because it's attempting to create a new page (model) under the old brand and not the newly selected brand. In other words, changing both brand and model at the same time breaks the hook.
  3. Is there a way to set the newly created page directly as the selected value within this hook? Or does a new hook need to be created after the process?
  4. Thanks! got it partially working. Doesn't check the field value but the saved page value which isn't handy if you change brand field or the brand field is empty. But I think I can fix this 🙂
  5. I have 2 page reference fields; brand and model. The brand field has an assigned template and parent so I'm able to create new pages from within the page with this field. The model field is dependant om the value of brand with the following: parent=page.brand But I can't figure out how to assign a dynamic parent the model field so that I can add pages (models) under the correct brand. whats the best way to go about this?
  6. I think I'm going to get an obvious duh answer here. I have a "number of guests" text field. It's a text field because most of the time the value of this field is an int value but in some cases it's "100 guests" or "120-200" I have the following code where $g_guests is just a GET variable. $query = 'template="party", '; if(isset($g_guests)){ foreach($g_guests as $g_guest){ switch ($g_guest) { case 50: $query .= 'guests=(party_guests>=1, party_guests<51), '; break; case 100: $query .= 'guests=(party_guests>=51, party_guests<101), '; break; case 150: $query .= 'guests=(party_guests>=101, party_guests<151), '; break; case 200: $query .= 'guests=(party_guests>=151, party_guests<201), '; break; case 201: $query .= 'guests=(party_guests>=201),'; break; } } } $parties = $pages->find($query); When I query between 1 and 51, I get pages back with all kinds of values een above 51. When I query more than 201, the results I get back changes and I see a few parties with 500 guests, but also 90, 80, etc My guess is I'm comparing apples and oranges as in, strings with ints. Is there some way to fix this without having to create a new int fields?
  7. How might one structure a selector if one wanted to find pages that had a date within a specific month but regardless of year?
  8. No, being logged in or not makes no difference. These two lines of code run at the same time. It just seems like a nested selector won't work unless the page is viewed in a browser. I've managed to get it working with the following: $contact = $pages->get("salesforce_id^=$sfid"); $location = $pages->get("template='pageLocation', contact=$contact");
  9. sorry, my original post may not be clear: $contact = $pages->get("salesforce_id^=$sfid"); $location = $pages->get("template='pageLocation', contact=[salesforce_id^='$sfid']"); the top line $contact returns a processwire ID whether the URL is called by salesforce or by my browser. $location does not return anything when salesforce calls it but returns a processwire ID when I call the URL in my browser.
  10. Okay, so my code doesn't seem to like the following when not being loaded in the browser: contact=[salesforce_id^=$sfid]
  11. I have a page with a template that is purely intended for carrying out php tasks. This page/url is called when certain objects in SalesForce are saved. The URL is called with a few GET variables. To make sure that the URL with the GET variables is called, I write them to a log, and this works fine, except the php and ProcessWire code I've written doesn't execute. Only once I visit the exact same URL that was written to the log in my browser, then the php and ProcessWire code executes perfectly, no errors. I can't see any reason for this, and I'm not sure what to search for in order to sort this out. Can anyone give any ideas?
  12. Is anyone using this module in combination with SendGrid? I had the module working til a few weeks ago and now I get a time out error that I can't connect to mail.sendgrid.net. Not sure what the exact settings need to be as Sendgrid isn't too clear on this as far as I can find.
  13. I edited this code a little and it worked perfectly! Thanks <?php namespace ProcessWire; $empties = $pages->findMany("template=record, textField=''"); $fulls = $pages->findMany("template=record, textField!=''"); $uniques = new PageArray(); $fieldValues = []; foreach ($fulls as $record) { if (in_array($record->textField, $fieldValues)) continue; $uniques->add($record); } $uniqueOrEmpty = $empties->import($uniques);
  • Create New...