Jump to content

3fingers

Members
  • Content Count

    303
  • Joined

  • Last visited

  • Days Won

    1

3fingers last won the day on May 24 2017

3fingers had the most liked content!

Community Reputation

311 Excellent

About 3fingers

  • Rank
    Sr. Member
  • Birthday 04/22/1981

Contact Methods

  • Website URL
    https://www.3fingers.com

Profile Information

  • Gender
    Male
  • Location
    Turin, Italy

Recent Profile Visitors

4,946 profile views
  1. Hi @Robin S, I've sent you a PM, let me know, thanks.
  2. Hi @bernhard, thanks for the module, I'm trying to get my head around. I have this : $matches = $rockfinder->find($selector)->addColumns(['title','image','variante_prodotto.lunghezza'])->getRows(); // Doesn't work 'variante_prodotto' is a ProField of type table and has a subfield 'lunghezza'. How could I retrieve the value of 'lunghezza' using your module? 🙂
  3. Here you can find all the information you need to do so (aka saving form submission to pages and related fields). https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ And here a very nice module to create a dashboard for processwire (read through the docs to find a way to present your form submissions/pages straight in the homepage of the backend). https://processwire.com/talk/topic/22847-processwire-dashboard/
  4. Same as above, inverting the logic: <?php foreach($page->works as $item) { if($item->is(Page::statusUnpublished)) { // do whatever }; continue; }
  5. if ($child->id === $pid ) { $class= 'active'; // Why are you declaring it here for the 2nd time? } elseif ($template= "memorials" && $child->id === $parents ) { // $template == ... missing double equal sign btw $class= 'active'; } I think you get Undefined because you are overwriting class after the first declaration and then sometimes your if statements never run (depending on false conditions) and so $class is not set at that point.
  6. Very interesting read. Thanks for sharing!
  7. Thanks @Robin S, I'm going to put on my black ninja belt and solve this puzzle.
  8. Thanks @Robin S, I'm trying to get my head around it. if ($input->get->lunghezze) { $lunghezza = $sanitizer->selectorValue($input->get->lunghezze); $input->whitelist->lunghezze = $lunghezza; $tolleranza = ($percentuale / 100) * $lunghezza; $val_up = floor($lunghezza + $tolleranza); $val_down = floor($lunghezza - $tolleranza); //SORT DELTA UP $lun_unsorted_up = $pages->find("variante_prodotto.lunghezza>=$lunghezza,variante_prodotto.lunghezza<=$val_up"); foreach($lun_unsorted_up as $lun){ $lun->delta = abs($lun->variante_prodotto[0]->lunghezza - $lunghezza); } $lun_sorted_up = $lun_unsorted_up->sort('delta'); //SORT DELTA DOWN $lun_unsorted_down = $pages->find("variante_prodotto.lunghezza<=$lunghezza,variante_prodotto.lunghezza>=$val_down"); foreach($lun_unsorted_down as $lun){ $lun->delta = abs($lun->variante_prodotto[0]->lunghezza - $lunghezza); } $lun_sorted_down = $lun_unsorted_down->sort('delta'); } I have more input->get variables, and I'm applying the same concept. At a point in time I "join" all the array I get like this: $insieme = $pages->find("id=$lun_sorted_up|$lun_sorted_down"); // and so on... All good...but, if i put a "limit=20" to the selector (for pagination): $insieme = $pages->find("id=$matches|$lun_sorted_up|$lun_sorted_down, limit=20"); The sorting order is completely gone! Why?
  9. Hey all, I'm facing a problem way over my knowledge right now. Big problem and tight deadline :( Basically is this: $percentuale = 20; // percentace if ($input->get->lunghezze) { $lunghezza = $sanitizer->selectorValue($input->get->lunghezze); $input->whitelist->lunghezze = $lunghezza; $tolleranza = ($percentuale / 100) * $lunghezza; // calculating the tolerance $val_up = floor($lunghezza + $tolleranza); // tolerance up $val_down = floor($lunghezza - $tolleranza); // tolerance down $selector .= "variante_prodotto.lunghezza=$lunghezza, "; $tolerance .= "variante_prodotto.lunghezza>=$val_down, "; $tolerance .= "variante_prodotto.lunghezza<=$val_up, "; } $tolerance .= "template=prodotto_alimentare, sort=variante_prodotto.lunghezza"; /* I want to sort the result from the closest to $lunghezza, but now they are sorted by the smallest to the greatest. */ $matches = $pages->find($selector); $with_tolerance = $pages->find($tolerance); $insieme = $pages->find("id=$matches|$with_tolerance"); foreach($insieme as $product) { //etc... } I'm outputting a series of product which has a particular length ($lunghezza) and also other products which are contained inside a particular tolerance ($with_tolerance). How can i sort the results ($insieme) from the closest to $lunghezza onwards? Right now they are sorted by the smallest to the greatest. Hope to have some feedback from you. Thanks!
  10. Thanks Sergio, you've saved my day!
  11. And this particular post it's the key to success 🙂 Here's the solution: if ($input->get->forme_options) { $san_array = array(); foreach ($input->get->forme_options as $forma) { $san = $sanitizer->selectorValue($forma); $san_array[] = $san; $selector .= "forma_prodotto.title=$san, "; } $input->whitelist('forme_options', $san_array); } My Lord, that was hard! (at least for me :)). Thanks!
  12. Thanks @Sergio but I don't think my problem is related to pagination, infact it works correctly on my side. I think it's rather something to do with whitelist on multiple checkbox (eg. forme_options[] ) which I cannot get it works. Also take a look at my url in my last post above: %5B%5D // I think it's [] encoded, but then it get lost on subsequent pages
  13. @Jan Romero Got success for single values but still have troubles with multi-selection choices (such as checkboxes). I'm trying to solve this way, but without success: // In the code for the form foreach($forme_options as $key => $value) { echo "<li class='icons'><input type='checkbox' name='forme_options[]' value='$value' id='ico-$value'><label for='ico-$value'><img src='{$images->eq($i)->url}'/></label></li>"; $i++; } // Later in the logic if ($input->get->forme_options) { $forma = $sanitizer->selectorValue($input->get->forme_options); $input->whitelist->forme_options = $forma; foreach ($input->get->forme_options as $forma) { $selector .= "forma_prodotto.title=$forma, "; } } In the first page of the result I got this GET query back and results are correct: myurl/?forme_options%5B%5D=rettangolare on the second page (and onwards) i GET this, but the query is lost: myurl/page2?forme_options=rettangolare which looks kinda right, but...no. 😞 Sorry but this is my first "complex" search form with processwire and I'm not really an expert with this. Any clue?
  14. @Jan Romero Just here to say thanks for your detailed answer, is such amazing how much this community surprises me even after years. I'm going to test your suggestion tomorrow at office time, and be back here to mark (hopefully) solved this thread. Thanks again, really really appreciated your effort.
  15. Hey all, I know about $input->whitelist and tried all my way down to solve this problem. Basically the query string get lost in some way on the 2nd and subsequent pages I get this url: myurl/page2?q=WireInputData My eyes and brain got a twist and cannot go further. I post my code in here, if somebody would like to help me figuring it out: Here the form Here the logic Many thanks!
×
×
  • Create New...