Jump to content

a-ok

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by a-ok

  1. OH! When did RepeaterMatrix happen??? And yep, thanks again, Robin. I could add a title field but felt like it would add extra complexity as all other content would be collapsed within the title field on the front end and what's stopping them adding two or more title fields which would break the functionality.
  2. I'm wondering if anyone has had any success with putting a PageTable within a Repeater? I want to create a template that has a text field followed by a flexible layout that can exist multiple times, so for example, Featured title 1 PageTable field 1 PageTable field 2 PageTable field 3 Featured title 2 PageTable field 1 PageTable field 2 I created a Repeater field with a text field, then added in the PageTable field so it looks like the screenshot attached, but upon saving a PageTable entry, it doesn't seem to do anything. I'm guessing I could just create each 'repeater' as a page (child pages) rather than a repeater but was just curious otherwise.
  3. <?php $types = $input->get->type; ?> <?php $colours = $input->get->colour; ?> <?php $patterns = $input->get->pattern; ?> <?php $designers = $input->get->designer; ?> <?php $selector = "parent=/collections/, collections_detail_images.count>0, sort=name"; if ($types != "all") $selector .= ", collections_detail_category=$types"; if ($patterns != "all") $selector .= ", collections_detail_pattern=$patterns"; if ($designers != "all") $selector .= ", collections_detail_designer=$designers"; // We make sure we only find pages that have the right colour in one of their repeater items if ($colours != "all") $selector .= ", collections_detail_images.collections_detail_image_colour=[collections_colours_group=$colours]"; ?> <?php $results = $pages->find($selector); ?> <?php include './collections-filters.inc'; ?> <?php if (count($results)) : ?> <div class="container-fluid"> <div class="row"> <div class="fabric-list-container collections-results all"> <?php foreach ($results as $result) : ?> <?php $fabrics = $result->collections_detail_images; $fabrics->sort("collections_detail_image_colour.name"); if ($colours != "all") { $fabrics->filter("collections_detail_image_colour.collections_colours_group.name=$colours"); } ?> <?php foreach($fabrics as $fabric) : ?> <?php include './fabrics-list.inc'; ?> <?php endforeach; ?> <?php endforeach; ?> </div> </div> </div> <?php endif; ?> This is what works! It was just some of the sub-selectors were off/wrong format etc. Many many thanks to @Robin and @LostKobrakai
  4. Looks like this seems to work... collections_detail_image_colour->collections_colours_group->first()->name But wondering how to return this in the selector... if ($colours != "all") $selector .= ", collections_detail_images=[collections_detail_image_colour.collections_colours_group=$colours]";
  5. Upon double checking one of the collections, it's returning a page where the colour filtered isn't part of the repeater. // here we make sure we only find pages that have the right colour in one of their repeater items if ($colours != "all") $selector .= ", collections_detail_images=[collections_detail_image_colour.collections_colours_group=$colours]"; There must be something going wrong here. I can't work out why... it's returning all the pages then when it gets to colour, it should be looking at the repeaters 'collections_detail_images' and checking that the pageField 'collections_detail_image_colour' has the 'collections_colours_group' of 'blue' (for example). If I echo out what $selector is it returns the following (which looks correct) parent=/collections/, collections_detail_images.count>0, sort=name, collections_detail_images=[collections_detail_image_colour.collections_colours_group=blue] But if I echo out the collections_detail_image_colour.collections_colours_group for each they look like '1160collections_colours_group' rather than 'blue' and collections_detail_image_colour.collections_colours_group->name doesn't seem to work). If I echo out 'collections_detail_image_colour->collections_colours_group' it seems to return the correct ID but then I cannot get the name of that, for example: collections_detail_image_colour->collections_colours_group->name or collections_detail_image_colour->collections_colours_group.name doesn't seem to work.
  6. Thanks for your help, again, Robin. I see what you're doing... instead of querying the repeaters and trying to get three sets of data (type, designer and pattern) from the page they are on, you're getting all the pages then getting getting the repeater field (colour) required. The idea of using the filter after the first query is lovely. I'm wondering if you can explain what the square brackets do in the top query? if ($colours != "all") $selector .= ", collections_detail_images=[collections_detail_image_colour.collections_colours_group=$colours]"; This is where it may be going wrong (currently if I filter by 'Blue', for example, it's still returning all the colours).
  7. Doesn't for me; I got two error messages (which doesn't break the map) and then a forced error which returns this: https://www.latecnosfera.com/2016/06/google-maps-api-error-missing-keymap-error-solved.html
  8. Tell me about it. APPARENTLY it only affects new uses but how the hell would they know that? Clearly wrong as that would mean the module would still work.
  9. As per Google recent announcement, usage of the Google Maps APIs now requires a key. I've tried to use @ryan's Map Marker (Google Maps) but it errors out due to this. I would assume the module needs updating to allow for an API key field? I believe this line, within '' needs to be changed from: public function init() { $this->config->scripts->add(($this->config->https ? 'https' : 'http') . '://maps.google.com/maps/api/js?sensor=false'); return parent::init(); } to public function init() { $this->config->scripts->add(($this->config->https ? 'https' : 'http') . '://maps.googleapis.com/maps/api/js?key=API_KEY_HERE&callback=initMap'); return parent::init(); }
  10. This could be super useful, actually. I'm thinking I could use this then then apply it to the filter selector...
  11. Thanks so much for the help, again (!!!), @Robin S. Maybe I'm not understanding, either. Basically, I have a filtering/tagging system set up, which upon selecting specific tags and hitting 'Submit' it'll return the repeaters with those tags etc. <form class="collections-filter" action="<?php echo $pages->get('template=collections-results')->url; ?>" method="get"> Then on the 'collections-results' template I have something like the code below. <?php $types = $input->get->type; ?> <?php $colours = $input->get->colour; ?> <?php $patterns = $input->get->pattern; ?> <?php $designers = $input->get->designer; ?> <?php $selector = "template=repeater_collections_detail_images, include=all, status!=unpublished, sort=collections_detail_image_page_title, sort=collections_detail_image_colour"; if ($types != "all") $selector .= ", collections_detail_type=$types"; if ($colours != "all") $selector .= ", collections_detail_image_colour.collections_colours_group=$colours"; if ($patterns != "all") $selector .= ", collections_detail_pattern=$patterns"; if ($designers != "all") $selector .= ", collections_detail_designer=$designers"; ?> <?php $results = $pages->find($selector); ?> <?php include('./collections-filters.inc'); ?> <?php if (count($results)) : ?> <div class="container-fluid"> <div class="row"> <div class="fabric-list-container collections-results all"> <?php foreach ($results as $fabric) : ?> <?php include('./fabrics-list.inc'); ?> <?php endforeach; ?> </div> </div> </div> <?php endif; ?> I don't think you can return pages with those repeater fields as one selector without looping? I could use $pages->find("collections_detail_images.count>0") but that'll only return the pages and not the repeaters themselves... I need to return each repeater. The issue with returning each repeater, however, is that I need to check, in the selector, the page the repeater is on and not just the repeater itself which seems to be impossible to do in one selector. For example, what would be ideal is: <?php $selector = "template=repeater_collections_detail_images, include=all, status!=unpublished, sort=collections_detail_image_page_title, sort=collections_detail_image_colour"; if ($types != "all") $selector .= ", getForPage.collections_detail_type=$types"; // This needs to look at the page the repeater is on if ($colours != "all") $selector .= ", collections_detail_image_colour.collections_colours_group=$colours"; if ($patterns != "all") $selector .= ", getForPage.collections_detail_pattern=$patterns"; // This needs to look at the page the repeater is on if ($designers != "all") $selector .= ", getForPage.collections_detail_designer=$designers"; // This needs to look at the page the repeater is on ?>
  12. Any thoughts @ryan?
  13. Thanks so much, Macrura. I didn't know you did it. Really great work... just what PW needed tbh.
  14. It's within a filtering selector, for example: <?php $selector = "template=repeater_collections_detail_images, include=all, status!=unpublished, sort=collections_detail_image_page_title, sort=collections_detail_image_colour"; if ($types != "all") $selector .= ", collections_detail_type=$types"; if ($colours != "all") $selector .= ", collections_detail_image_colour.collections_colours_group=$colours"; if ($patterns != "all") $selector .= ", collections_detail_pattern=$patterns"; if ($designers != "all") $selector .= ", collections_detail_designer=$designers"; ?> I'm searching repeaters but they need to reference back to the page they are on; the types, patterns and designers are pageFields on the page they are included on, not within the repeater.
  15. Also, Robin, this was an amazing find: Thanks!
  16. This is great, Robin. I appreciate you taking the time to explain this to me... crazy I didn't know about it. See attached. A real big help!
  17. Thanks, Robin. Difficulty is that they are used separately. The pageField, where I select a repeater, doesn't return which 'getForPage()' it is on... that is why I need to include a hidden input field, then using that hook it would insert the title of the page into the repeater and thus I can use it for the custom format title label on the pageField. You see my dilemma.
  18. Thanks for the reply, Robin. The reason I need to use this code is I am using a pageField for the repeaters but you cannot output the title of the page the repeater is on within the Custom format title label. This isn't front end but backend.
  19. Bugger. How would you suggest I return my repeater fields then? There is this: http://cheatsheet.processwire.com/page/page-status/page-statustrash-8192/ so perhaps we could do the same status!=unpublished|trash
  20. Thanks, I think you meant 'include=all' as this seems to work just perfect... template=repeater_collections_detail_images, include=all, status!=unpublished
  21. I am wanting to return all repeater fields, outside of admin, but it seems like you cannot do this without using include=all (even include=hidden doesn't work) but this also includes unpublished pages. Is there a combination to include=all but exclude=unpublished?
  22. Folks, I may have discovered a) a bug or b) that I can't write code for shit. I have this hook setup: $pages->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); $repeater = $page->collections_detail_images; foreach ($repeater as $row) { $row->of(false); $row->collections_detail_image_page_title = $page->title; $row->collections_detail_image_page_type = $page->collections_detail_category->name; $row->collections_detail_image_page_pattern = $page->collections_detail_pattern->name; $row->collections_detail_image_page_designer = $page->collections_detail_designer->name; $row->setAndSave(); } }); For each repeater row on a page I am editing, upon save, it fills in the desired fields with content required. This all works well, however, the issue/bug is this... Each repeater row also has an image field (limited to 1), which I have been dragging and dropping an image to, for each row in the repeater, then saving. I tend to add 5-10+ rows (each with an image) at once then save. This is where the issue occurs. Even though it looks like the image is there and saved... it's not appearing on the front-end. If I do one row at a time and save, it works fine, it's only if I do 2 or more in one 'save session'. This only happens with drag and drop too. If I remove my hook, shown above, I don't seem to get any issue. Any thoughts?
  23. I know you can use getForPage(); to get the page that a repeater is being used on, but can you do the same within the find selector? Without having to loop? $pages->find('template=repeater_collections_detail_images, include=hidden, sort=name'); Something like... $pages->find('template=repeater_collections_detail_images, getforpage=collections_detail_designer=123 ,include=hidden, sort=name'); What this would do is find all the repeaters that's page it is on has the collections_detail_designer of 123. I was thinking you could just search all pages that has collections_detail_designer=123 then return all those repeaters I don't think that's possible?
  24. Thanks for this, adrian. Really useful.
  25. I'm curious to know if this is possible. I'd like to write a hook that upon adding an image to a specific page it will rename the image to the name of the page it's been/being uploaded to? I have a bank of images all with really useless filenames but would like to sort this upon uploading each one. Each image is added in a repeater with a corresponding colour (Pagefield), for example: I wonder if I could write a hook that would take each image in the repeater and rename each one something like pagetitle_01_charcoal pagetitle_02_red What do you think? Is it possible to write a hook to change a filename? Either on save or as it's uploading? Any advice/help is appreciated.
×
×
  • Create New...