Jump to content

Search the Community

Showing results for tags 'repeater'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hi there! I’m using Apeisa’s ShoppingCart module to do a little shop. I have pages each with a range of products as repeater items. These items have different prices (package deals, individual products and so on). They all render with correct names and prices. So far so good! Now the issue: When I add one or more products to the cart I get the $title of the $page instead of the product name, and the price is set to the price of the first product on the page no matter which product I add to the cart. So I’m doing something wrong. Here is the code I’m using: // Primary content is the repeater fields of "sc_item" $contentThree = ''; //sc_item is my repeater field foreach ($page->sc_item as $product) { $contentThree .= "<span class='sc_item'>" . $product->sc_name . "</span></br>"; $contentThree .= "<span class='sc_price'>" . $modules->get( "ShoppingCart" )->renderPrice( $product->sc_price ) ."</span> excl. BTW (VAT)"; $contentThree .= "<span class='sc_add'>" . $modules->get("ShoppingCart")->renderAddToCart(). "</span>"; } $contentThree .= $modules->get("ShoppingCart")->renderCart(); Can anyone point me in the right direction?
  2. Hello everyone My question is very noobish, but I found no way to accomplish something simple. Also related posts in the forum where to difficult to work with for me … I would like to sort upcoming and past events which are repeaters by their end date field. The output should look something like this: UPCOMING EVENTS Title event 1 26. November to 27. November 2014 Title event 2 29. November 2014 … PAST EVENTS Title event 3 12. November 2014 Title event 4 1. August to 5. August 2014 … My code only returns the last of the created events as many times as there are events . Am I completely on the wrong way? Any hint would be very appreciated … Thanks, tron1000 setlocale(LC_TIME, 'de_DE'); echo "<h1>Events</h1>"; foreach($page->event as $event) { $event_title = $event->event_title; $date_to = $event->getUnformatted('event_date_to'); $today = time(); $date_from_formatted = strftime('%d. %B %Y', $event->getUnformatted('event_date_from')); $date_to_formatted = strftime('%d. %B %Y', $event->getUnformatted('event_date_to')); if ($date_from_formatted == $date_to_formatted) $event_out = "{$event_title}<br>{$date_from_formatted}<br><br>"; else $event_out = "{$event_title}<br>{$date_from_formatted} to {$date_to_formatted}<br><br>"; } echo "UPCOMING<br><br>"; if ($date_to > $today) foreach($page->event as $event) { echo $event_out; } echo "PAST<br><br>"; if ($date_to < $today) foreach($page->event as $event) { echo $event_out; }
  3. Hi Folks, I am trying to setup a scorecard for a page for a golf course listing. Each course has different "Tees" i.e. Mens, Ladies - but also different tee colours like "Blue" or "Black" for championship, "White" for "Mens", "Green" for mens / non compeition and "Red" for ladies. This is fairly common but some courses might use gold, silver bronze as their colours. Each Tee Box has the following data: Distance Par Index Men's boxes for par and index will typically always be Blue / Black and White - green is included for distance, and ladies tend to just have the one tee box. I am trying to get my head around how to setup a field for this / approach it so I have the flexibility to do: Hole Number (fixed 1-8) Tees - Tee Colour - Tee Distance - Tee Par - Tee Index I could probably figure some way to make "Hole" repeatable then the user has to enter repeatable rows under for each "Tee" however it's a bit messy and lot of repetition - it would be far better if there was a way to firstly define the courses "Tees (Colours)" then auto present 18 rows fields for the associated colours Par, Distance and Index. I hope that makes sense and hope someone can guide me on an approach. Thanks in advance.
  4. Hello, I'm building a form through the API. In that form I am using a repeater field that is setup with 5 Ready-To-Edit New Repeater items. In the repeater is only one text input field named "servername". Now I'm having trouble accessing the repeater field values when I process the form. I read through the docs at https://processwire.com/api/fieldtypes/repeaters/. But when processing form input post values things seem to be different. I add the field to the form with: $registrationField = $fields->get("reg_servers")->getInputfield($pages->get("/registration")); $registrationField->attr("class","form-control"); $registrationForm->append($registrationField); The field is there in the form and working fine. Now when processing the form, I need to access the values of my repeater. Here's the relevant code: if($input->post->submitregistration) { $registrationForm->processInput($input->post); $servers = $registrationForm->get("reg_servers")->value; var_dump(count($servers)); // this gives int 5, which is fine foreach ($servers as $server) { echo "<pre>"; print_r($server->fields->servername); //servername is my text input field in the repeater echo "</pre>"; } exit(); } In the print_r output I can't find the value of my fields. I also tried var_dump($server->servername) and var_dump($server->servername->value) inside the foreach which gives an empty string. var_dump($server->fields->servername->value) gives null. How can I access my field values?
  5. I have an issue with a repeater field (PW 2.4). The repeater consists of three fields: title (text), body (textarea) and image. The repeater field only gets published when i put some text into the body field, otherwise it remains unpublished. Any ideas on this?
  6. I'm trying to use a repeater field within a repeater field and the secondary/internal repeater field does not show up in the Add Field drop down within its parent repeater field Edit > Details page. Looks like it's not built to be nested? Thanks in advance! P.S. I'm very new PW and love it! All other CMS stuff I do is with WordPress and MODX.
  7. Hi there! The title may be a bit misleading, or at least it's how I tried to achieve something which may not be possible in that combination. But let's start from the beginning: I'm trying to create a football team & game manager with processwire. As someone who used Excel in all ways possible to manage every aspect of a football team (members, positions, games, etc.) and having used processwire for solely building websites in the past, I thought this has to work, too. And for the most part it does! Yet, I have a few things which may work even better and that's where I'm stuck. I currently manage: Team members (pages) Game positions (pages) Games (pages) In "games" I have something like "location", "opponent", etc. and I have created a repeater field which includes "team member" (selector from page "team members") and "game position" (selector from "game positions"). I am able to map a "position" to a "team member" for each game. That's fine & well, BUT: it would nice, to have those selector being somehow connected to each other in a way, that if I am selecting a team member and assign him to a position, that this position & member will be deleted from other repeater "selectors". This way I want to prevent a team member or game position to be used n-times in one game. It's just a usability thing, but a big one for me, since I may be not the person working with this in the future. Is this somehow possible? Thank you!
  8. Hello. I'm developing website for restaurant network, and I use repeater field for menu (meals). Page has repeater field, named "menu". It has 2 fields - title (multilingual - 3 languages) and price. 150 repeater entries are created and save normally. Starting from 151 when I fill new repeater row and click save, PW shows success message but 151st row isn't saved. How can I fix this problem? Or can you suggest any alternative method for storing such data? Using page for each row is very hard for editing. Thank you in advance! I forgot to notice one thing, when I use debug tools I see that the data from 151st is passed in POST array.
  9. First of all, I would like to thank you all for such great documentation and community. I have just started developing 5 days ago and I have completed some really difficult programming relatively easily. But, I do have a quick question. The site I am developing has an events listing that links to events that have a possibility of multiple dates. That was easy. But, now I have to create the schedule listing and the events could look like this: Monday, Nov. 3rd 10:00 am - Event 1 11:30 am - Event 2 Tuesday, Nov. 4th 12:00 am - Event 1 So, to achieve this, I create a repeater field for the event date and time. I created the functionality for the schedule and have the events sorted by date but if the event has multiple dates and times, I cannot figure out how to pull the second date and time out and then list the event again. I thought about doing a recursive function that traverses the page array and pull out each event and date/time, putting it into a new array, sorting it and then doing the schedule. But that just seems like overkill and I am little rusty with my PHP. Does someone have something like this or do I need to rethink this?
  10. Hello, I have problems with repeaters. I tried to delete or modify an item from a repeater. But when the page reloads, it appears again. I was also trying to add a new article having the same result. Can anyone help me? Please
  11. Hi, I'm doing something wrong here: I have following structure for an event page that allows for multiple additional dates if neccesary and i want to display all for this year: EVENT - event_begin - event_end - daterepeater -- daterepeater.event_begin -- daterepeater.event_end $thisyr=date(Y); $nxtyr=date(Y)+1; $aftnxtyr=date(Y)+2; echo "<h1>{$page->title}</h1>"; echo $thisyr; foreach($pages->find("event_ende|event_daterepeater.event_ende>=01/01/$thisyr,event_beginn|event_daterepeater.event_beginn<01/01/$nxtyr") as $s) { echo "<li><a href='{$s->url}'>{$s->title}</a>, {$s->event_beginn} - {$s->event_ende} | {$pages->get("$s->event_location")->title}</li>"; } Basically it works. The event page is found but the output happens only once and not for every matching entry in the repeater. Do i need a nested loop to output those (i might need it anyway to output the repeater dates but i'm still struggling with the find )?. thanks
  12. I've stumbled upon a weird issue with repeaters. I've created a repeaterfield with only a title field and assigned it to a template. When I create the first page everything goes well, but then when I'm creating additional pages I'm getting this error: ProcessPageAdd: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'for-page-23947-23799' for key 'name_parent_id' I'm not getting redirected (probably because of the error, but the page does get created with the RepeaterField correctly). The problem seems to exist in the file FieldtypeRepeater.module in the function 'getRepeaterPageParent'. I've modified the file to see what actually happens and it looks like the function doesn't find the required page of saves the page correctly. protected function getRepeaterPageParent(Page $page, Field $field) { $repeaterParent = $this->getRepeaterParent($field); $parent = $repeaterParent->child('name=' . self::repeaterPageNamePrefix . $page->id . ', include=all'); $this->message("L".__LINE__." | selectorresult: ".$parent->id); if($parent->id) return $parent; $parent = new Page(); $parent->template = $repeaterParent->template; $this->message("L".__LINE__." | template: ".$repeaterParent->template); $this->message("L".__LINE__." | parent: ".$repeaterParent->path); $parent->parent = $repeaterParent->id; $parent->name = self::repeaterPageNamePrefix . $page->id; $parent->title = $page->name; $parent->addStatus(Page::statusSystem); // exit early if a field is in the process of being deleted // so that a repeater page parent doesn't get automatically re-created if($this->deletePageField === $field->parent_id){ return $parent; } $parent->save(); $this->message("L".__LINE__." | looking for: ".self::repeaterPageNamePrefix . $page->id); $this->message("L".__LINE__." | current for: ".$parent->name); $this->message("L".__LINE__." | Created Repeater Page Parent: NAME={$parent->name} a " . $parent->path, Notice::debug); return $parent; } See the attachment for the output. IMO the second time FieldtypeRepeater: L574 | should output the previously created page... Anyone has an idea what's going wrong? I'm on the latest master branch.
  13. Hi, I have a simple content structure like this: - A page -- title -- content (repeater field) --- headline --- body --- images (image field) -- (…) - Another page (...) Is it possible to not only upload images via the "image" field, but let it select already uploaded images (in other "content" repeaters or on other pages)? (Kind of how the image thing inside the wysiwyg works - I don't want to have the image selection inside the "body" field and disabled the image option in the wysiwyg editior setting). Or do I need to introduce a new field alongside the regular mage field? The actual scenario is like this: With the above structure, the editor created three content sections on one page a, b, c. In each section, he uploaded one image. After a whle he decided that the section c is in fact part of section b, and deletes it, after appending it's "body" content to section b's body field. Because now the text of section c is in section b, he also wants to have section c's image go along with section b and the image there - but the image field seems to only offer a new upload of the image - or am I missing something? thanks, Tom
  14. Hi everone. I've searched the forum to find a solution to my problem, but so far nothing did the trick for me. So here's the issue: I've created a repeater called "news" and it's used on several overview pages (working perfectly). Now, on the home page, I want to show the latest 10 news, and I figured you can do this like this: <? foreach($pages->find("template=repeater_news, sort=-modified, limit=10") as $news): ?> <li><a href="<?php echo $news->getForpage()->url ?>"><img src="<?php echo $news->getForpage()->icon->url ?>"><span><?php echo $news->text_primary ?></span><br><?php echo $news->getForpage()->title ?> - <?php echo date('d/m/Y g:i a', $news->modified) ?></a></li> <? endforeach; ?> That works fine on my localhost, but as soon as I access the page via IP (like externally), the list stays empty. The same problem happens on my search page (when searching news). "Normal" pages don't seem to have the problem. Can anybody help me? Cheers and thanks
  15. On this topic: I've asked (and answered myself) how to get the field name on a page used for uploading files. Now, what if I'm using a repeater field to upload files? How can I get the name of the page of the item uploaded to? I'm using a InputfieldFile::fileAdded hook and even if I try to get the $event->arguments(0)->page->name I get the internal name of the repeater page, not the name of the page where the field is. $event->arguments(0)->page->parent->name is almost what I need because I get the name "for-page-xxxx" and xxxx is the id of the page where the field belongs. Is there any easier way to reference this page name without, I don't know, parse this string to extract the numeric id and then search for the page name?
  16. Hey guys, I struggled about half a week, okay wasn´t the only thing I´m on..but I´m not getting it. I´m working on a little page with a little shop, just a few books. Of course I know Apeisas shop, but it doesn´t support tax out of the box right now and I want to have the whole shop with cart and checkout on a single page and I had half of it already working with jquery but wanted to have something more scalable. While trying to get it on my own I´m digging more into php and PW Blabla I have a template called order. My plan is to store the cart in order page like "Cart 12.5.2014" and name it to "Order 12.5.2014" when checkout is completed. The choosen cart items are stored in a repeater "order_items" with fields "order_qty" and "order_product" (page fieldtype) Everything works fine. First time the customer is adding an item to the cart the system will create the page and add the product to the repeater. I´m storing an individual id in the session which will be the name (path) of the page so I can check if one is already existing and just add more items to it. Once the customer is ready and fills out the order form, the page gets updated his name and stores the address information and the id in the session gets deleted so the order is kind of locked. The only problem is, I´m not able to update the item list properly. Either each time the customer adds item 1 to the cart it creates a new repeater or it changes only the qty of the first and only repeater even when he adds another item to the cart Because I´m not a 100% sure what I´m doing it´s more like trial and error. This is my last working code where it´s updating the same repeater item every time if($input->post->addtocart) { $sid = $session->sid; $order = $pages->get("name=$sid"); $order_items = $pages->get("name=$sid")->order_items; if(!$sid) { $order = new Page(); $order->parent = $pages->get("/bestellung/"); $order->template = 'order'; $order->title = 'Warenkorb '.date("d.m.Y - G:i:s"); $session->set('sid', str_shuffle(session_id())); //str_shuffle to prevent problems when customer finishes an order and want to make another order $order->name = $session->sid; $order->save; } if(count($order_items)) { foreach($order_items as $items) { if($items->order_product = $form_addtocart[item]) { $items->of(false); $items->order_qty += $form_addtocart[qty]; $items->save(); break; } } } else { $order->of(false); $order_items = $order->order_items->getNew(); $order_items->order_qty = $form_addtocart[qty]; $order_items->order_product = $form_addtocart[item]; $order_items->save(); $order->save(); } } // end addtocart On the one hand, I´m understanding what happens. On the other I have no idea what´s going on. Maybe there are a lot of improvement possibilities on my code haha. Uh, I thought about customizing the events fieldtype to store the items, but I thought repeaters are easier for the beginning. Maybe tailored events field will be the next version of the shop. I really hope there is an easy solution for this "little" thing. Maybe I missed the right search terms. Cheers and a nice evening to all EDIT: Forgot to mention, that I know, that the "if(count($order_items))" is not a good way, because once there is an item in the cart it´s true And I already tried in_array() and array_search() but couldn´t get it working :-/
  17. I'm working on a site with an about-the-team page where we have a sub-page for each different area of specialty. Each one of these pages will have a list of people who are in that specialty, this list built by pulling 'person' pages that were assigned to that specialty page through a page field. With me so far? Here's the fun part. I want to add a "level" to each of the people that show up on a specialty page. So let's say I'm on the Widget Managers specialty page, and I have the 'people' page field set to pull Alice and Bob to appear listed on this page. But I want Alice to be a 'senior' widget manager and Bob to be a 'junior' widget manager. I could just put a field in the Person page type that lets me set that person's level, but wait! A person can be assigned to more than one specialty page, with different levels on each one! So Alice might be a senior widget manager and a junior doohickey wrangler. She has to show up on the widget managers page as senior, and on the doohickey wranglers page as junior. Ideally, I'd have a repeater field containing two page fields, one to select a person and one to select their level on the current specialty page, but repeaters can't contain page fields. Anyone know of a way I might approach this?
  18. Good evening! I added a repeater field to a template of mine with "ready items" set to 1. So one item is always in the DB with a status 3073. I cannot find that status in the cheatsheet or anywhere else... seems its "unpublished" and "hidden" The problem is when I iterate over the items, the "empty" one is also included. Is this behaviour intended? How can I filter out the "unpublished" repeater items? foreach ($page->subitems as $item) { echo "id: {$item->id}<br/>"; echo "status: {$item->status}<br/>"; } My current solution is to do a $page->subitems->filter("status=1") Furthermore would be nice to know more about how to handle status in general and related to repeaters. I did a search of course but found not much. Thanks a lot!
  19. Hey, I started on my tag system with repeaters... It works, but I get a bunch of errors... And I've got no idea what the problem is. These are errors in the session->error and I've put them in a JQuery plugin called toastr. It looks like this: What can I do to change this? Or is this only in debug mode and it doesn't really matter?
  20. Hi, delete($page, true) doesn't seem to delete my repeater fields. It's version 2.3.0 so this fix is included: https://github.com/ryancramerdesign/ProcessWire/commit/b2780236a2643d703c586a23991d80e2e6b171bf I'm deleting a large amount of pages and inserting them again (working on a CMS conversion). The weird thing is that unless I delete all pages, and then all repeater pages, I can't insert any repeaters again. I have to clear out the DB from both pages and repeaters before I can insert anything again - otherwise no repeaters are stored More weird: Unless I do the delete in a separate GET, it doesn't work either. I have to first delete all stuff $events = $pages->get('/events'); $events_children = $events->children(); foreach($events_children as $c) { $pages->delete($c, true); } $times = $pages->get('/processwire/repeaters/for-field-112/for-page-0/')->children(); foreach($times as $t) { $pages->delete($t, true); } and then fill in the new values: for($n=1; $n<10; $n++) { $event = new Page(); $event->parent= $pages->get('/events'); $event->template = $templates->get('event'); $event->title = 'Event hello #' . $n; //insert two times (repeater fields) per event for($t=0; $t<2; $t++) { $time = $event->times->getNew(); echo $time->id . '</br>'; $time->title = 'Time #' . $t; echo $time; $time->startdate = rand_date('2011-01-01', '2013-12-01'); $time->save(); } $event->save(); } If I don't do it in two steps the times values are not inserted. thanks! rgds, J
  21. Is there a way to limit the repeater entry on the admin? for example, user can only enter a max of 10 entries
  22. I've been trying to do the following: I have 2 repeaters in a template and a I want to limit those repeaters to a number stored in another page. That number is then called in the template via a Select field (which is a Page relation). So when the user is editing the page, if the select says 3, then there are only 3 items allowed in the repeater. Should the user create 4, then a validation error should show up. How difficult is this to achieve? I've been reading this related thread but I still don't get it.
  23. I saw in a previous post (about a year ago) that pagination for repeaters was on the roadmap. Is this working yet or an eta? I'm hoping you'll chime in on this Ryan. Thanks! I'm currently working on a site where I have a repeater setup for a portfolio that filters the images by category. So in the repeater I have two fields (category - radio options, and image). But I also need to paginate through the images.
  24. I have a repeater which will contain an image and text, I want to apply a custom colour to an element in each repeater using the color picker. I'm not sure the best way to specify an individual css name for each repeater, can it be automated in some way? In my code below i'm using the colour picker and some inline css, but in this example each repeater item would have the same colour. I want to make each one different. <?php foreach($page->repeater as $p) { echo "<style>.repeatColor {background-color: #{$p->colour_picker};}</style>"; echo "<div class='repeatColor'></div>"; } ?>
  25. Hi Guys, I am absolutely loving Processwire but need some assistance in a custom build. I have created a repeater for an internal page. I need to pull the data using GET or some other way to display the first five repeated sets onto my home page for my featured items section. Is this possible? If so, any examples? Guidance? Your help is much appreciated!
×
×
  • Create New...