Jump to content

fruid

Members
  • Posts

    392
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by fruid

  1. I think I made a tiny progress, but still far from satisfying… I get… Notice: Undefined index: mc_gross in /home/.sites/66/site2760076/web/dev/site/assets/cache/FileCompiler/site/modules/PaymentPaypal/PaymentPaypal.module on line 87 I use the exact code as described in the github README example and set the get-variable ?step=process manually just to test. I'm not sure the above is even a big issue, but it's not working anyway, or hard to tell exactly. No sign of payment in my sandbox account anyway. A couple of questions… I set my paypal account to send IPN upon payment, does that even work here? I ask because it says: 'summary' => 'PaymentPaypal - using standard payment API and PDT for verification', so I wonder if those are the exclusive alternatives to IPN. And then, why do I send an address to paypal? To my understanding, a user would pay with their paypal account in which they stored their address beforehand anyway, so why send it? Can paypal separate a shipping and a billing address? Because if not, then one could make an argument as to why that makes sense after all. Next looking at the code from the github example and the module code itself, it's hard to tell where I am in the transaction with all that back and forth to and from paypal. Is data[mc_gross] missing in the array/object sent to paypal or coming from paypal? I guess it's the former. Still, would be great to have some more documentation because it's hard enough to work with paypal as it is. Thanks for help!
  2. a bit late to the party here… hello everyone. I'm currently building or I just built a custom checkout flow from scratch, mostly frontend with automatic order and confirmation email. I also integrated a paypal button following the tutorials from paypal.com. This kinda works but it's also the only thing that doesn't quite yet work. I still need to figure out how to get the shipping and billing address from paypal so I can include it in the order and confirmation email, because in the checkout flow the address form is presented only for payment methods other than paypal (the reason being that paypal already stores these details in the user's account). So apparently I need to use the IPN functionality from paypal and parse that notification, also send it back unparsed, wait for a validation, check the ID and whatnot, all that good stuff. I'm not sure what this module here actually help with. Can it do the IPN handling? I went through the source code on github but it's still not clear to me. Any more suggestions or should I keep writing from scratch at this point? – also learned about padloper just now 😅😐 so maybe next time I give this one a shot.
  3. I need to correct myself, the above, as expected, doesn't work or at least very inconsistently. So I'm now using the version with the sortOutEmpty function, which is a working solution. The downside I believe is that it's all loaded in memory now before paginating, so I'm still on the lookout for a better solution. Thanks so far.
  4. forget the part where I said I need to filter it twice because the second part would not be paginated anyway, just have a limit, that's all. The way you explain it, I think I didn't get it too wrong after all, just wasn't so lucky implementing it. So how would I go about paginating it without storing everything in-memory but instead accessing the database directly (?) given the above starting point?
  5. yes! I can confirm that @matjazp's solution works for me as well! As you might be able to see when comparing my actual code and the example / prove of concept code, I was getting close. As for the load from db or load from in-memory, I've always been confused about this stuff. If you don't mind my asking: is that basic php knowledge or specific to PW? I actually need to load the pages and filter them twice because I have two subsections to be displayed on the page. So I don't know how to do that properly, without loading all at once. And I don't know how I would accomplish all of this in the given scenario, with the custom PaginatedArray and all, but I'm curious to find out and appreciate your input. That said, I can also confirm that works now. I'm almost certain though that I've used this syntax before with the empty single quotes so I'm very sceptical. Or I'm delirious. It's like the first approach one would use before ending up with what I did (building that function sortOutEmpty() etc. so I seriously doubt I didn't try that out before.
  6. yes of course that works. But please, you try this now: $items = $pages->find("id>1"); $home = $pages->get("id=1"); $customPaginatedArray = new PaginatedArray; foreach ($items as $item) : if ($item->parent == $home) : $customPaginatedArray->add($item); endif; endforeach; // should return an array of pages that are direct children of the homepage $total = $customPaginatedArray->count(); $customPaginatedArray->setStart(0); $customPaginatedArray->setLimit(10); $customPaginatedArray->setTotal($total); foreach ($customPaginatedArray as $c) : echo $c->title . '<br>'; endforeach; $pager->render($customPaginatedArray);
  7. without the start specified, the pager also doesn't work. Right now it's just the results that are not split up among the pages.
  8. Let's step back for a second. I need to select pages where a certain field is empty. $pages->find("template=cast, has_parent=$page, start=$start, limit=$limit, sort=$sort, body!="); doesn't work So I created a PaginatedArray and looped through the items. If the field (body) in question is empty add them to the PaginatedArray. But then I – correct me if I'm wrong – need to use the ->setStart() ->setLimit() in order to paginate, which simply doesn't work. That's all I need. If I get it sorted without the methods, good, but the methods remain to be proven functional. Thanks!
  9. @adrian thanks but the linked topic is quite unrelated, I read through it, even the linked topics within in. I don't see how the approaches discussed can be helpful here. I'm not trying to merge two array objects, I'm trying to build an array object where a specific field is not empty and then paginate it. I challenge whoever reads this to show me an example where a custom PaginatedArray is successfully paginated afterwards using ->setStart() ->setLimit() and ->setTotal() because I don't remember seeing it working. I always only succeeded by using selectors and never the methods.
  10. thanks, but what about the function sortOutEmpty(); ?
  11. Unforunately, it makes no difference, just tried it.
  12. @matjazp thanks for the suggestion, doesn't work either, just tried it. The only difference I see in your code is count($casts) instead of $casts->count() I think I also tried that before.
  13. nope, just tried. But thanks anyway. $limit = 6; $start = $limit * ($input->pageNum() - 1); $decider = 'body'; $allcasts = pages("template=cast"); // 35 $matches = $allcasts->find("has_parent=$page, sort=$sort"); // 32 $casts = sortOutEmpty($matches, $decider); // 31 $total = $casts->count(); // 31 $casts->setStart($start); // 0 on page 1, 6 on page 2, 12 on page 3, … $casts->setLimit($limit); // 6 $casts->setTotal($total); // 31 echo $casts->count(); // !!! 31 shouldn't that be 6 now that I set start and limit above? I thought ->count always returns the number of items on the current paginated page, not the total function sortOutEmpty($items, $decider) { $out = new PaginatedArray; foreach ($items as $item) : if ($item->$decider != '') : $out->add($item); endif; endforeach; return $out; } the items are not paginated, meaning they are not distributed among several pages but they are always returned in total. This pagination API is just garbage, it just never works when you build a custom PaginatedArray.
  14. If I start over and don't use any additional function, I need to put the decider!= in the selector which doesn't work. Also, even if it did work in the classic way (which seems to be the only way), as opposed to building a custom PaginatedArray, it would solve the problem now but not in the long run. Building a custom PaginatedArray and then paginate it properly is almost impossible.
  15. yes of course. I should have led with that.
  16. $limit = 12; $start = $limit * ($input->pageNum() - 1); $allcasts = pages("template=cast"); $casts = $allcasts->find("has_parent=$page, sort=$sort"); $casts = sortOutEmpty($casts, $decider); $casts->setTotal($casts->count()); $casts->setStart($start); $casts->setLimit($limit); // just to test echo $casts->getStart(); // 0 or 12 or 24 or 30 respectively echo $casts->getLimit(); // 12 echo $casts->getTotal(); // 31 or whatever the total echo casts($casts); // never mind this, it's just for markup creation and works fine $pager->render($casts, $pagerOptions); // I store the name of a specific field as a string in a variable so I can dynamically sort out content of which that field is empty in the current language function sortOutEmpty($items, $decider) { $casts = new PaginatedArray; foreach ($items as $item) : if ($item->$decider != '') : $casts->add($item); endif; endforeach; return $casts; } I get the right number of pages in the pager. Pager works but the results never paginate. This pagination API is driving me nuts, it just doesn't work! I can't be the only one who's having issues with this, it's hard to find any topic where issues are discussed and the API-documentation is, as usual, very laconic. Thanks for help!
  17. OK so I guess it doesn't make more sense to anyone else out here either. Every time I try to use pagination I spend hours guessing and trying and when I get it to work, I'm back to where I started and I'm not one bit smarter than before because when at the time I will use pagination again, it might be a slightly different scenario that also will require hours of guessing. Here's what I'm trying now (for a different project) $start = $limit * ($input->pageNum() - 1); $allcasts = pages("template=cast"); // first store in in-memory db? $casts = $allcasts->find("has_parent=$page, sort=$sort"); // then find in in-memory db? $casts = sortOutEmpty($casts, $decider); $casts->setStart($start); $casts->setLimit($limit); // I use $decider as a variable so I can dynamically set a field that // depending if it's empty or not // decides whether the page should be displayed in the current language or not function sortOutEmpty($items, $decider) { $casts = new PaginatedArray; foreach ($items as $item) : if ($item->$decider != '') : $casts->add($item); endif; endforeach; return $casts; } The above doesn't work. I understand I need to set the "total" for the array but like I said, I never know how to do that properly. Thanks for help!
  18. could someone help me find the javascript bug? https://codepen.io/bbblgmsp/pen/LYxWJJa or here: https://foobar.roofaccess.org/carousell/ I want it to be NOT draggable on desktop but draggable on mobile devices. Also, on mobile, the element that I drag into focus should automatically be active, but on desktop, only when I click it. It works fine on desktop, but when you drag on mobile, after the dragged element is active and you click it, it switches back and forth between this and the previous element (assigns the active class to the previous element). I already tried to find help elsewhere, since this is not directly PW related but only frontend, but it's hard to find support or a community for uikit. PW seems to be using it quite a lot though… Thanks for help
  19. OK so this might be a very dumb/basic question which is why I can’t find any docs on this topic. I want to develop a module, namely a very basic e-commerce checkout function. For that to work, I need to store the purchases and the user input somewhere in the database. I haven’t really developed any PW module as such before, just simple pages with fields, any user input either ended up being sent via email or being stored in some field on the page. I guess it‘s not the best practice to create a field solely for that purpose on the page the checkout happens on, just as I‘m not putting the code on a page template either, since it‘s supposed to be a module and not just a page. The user input I would display in some sort of dashboard, somewhere on the module‘s admin page. So where and how and do I at all create a „fields“ for that reason or what is the right way to go about this? Thanks for help.
  20. still no progress… I don't see any place where to put the Client ID or the "Secret" or the Sandbox account email, just the Identity Token, the paypal email and the API endpoint. What am I missing?
  21. I'd like to create a slimmer version of the Page-Manipulator-Admin-action. For that purpose I would also need to simplify the array of type "selector", you know, where you select from all possible system fields and custom fields, operators and enter a value, and instead restrict it to only what I want the user to select. Is this selector field part of the AdminActions core module? or PW core? Can I accomplish that customisation all in the same array-item of the defineOptions function or should I create separate array-items for each criteria? Thanks for help!
  22. reCaptcha v2 invisible doesn't seem to be working (or what am I to expect? I've never seen an example for the invisible version anyway – kind of ironic, I know). I had reCaptcha v2 (the regular one) working just fine. Now that I want to change it to invisible I… added a new site-project in the reCaptcha-settings on google.com selected "invisible" in this module's settings and entered the newly created site key and secret key in this module's settings as well as in the div-attribute on the template. refreshed the page (cleared cookies and cache just to be save) but I see no change whatsoever. Thoughts?
  23. is this module discontinued?
  24. how can I return the type of an object? if it's a page array return PageArray. If it's a single page return PageObject etc. In plain php, this is done by gettype. When I use that here, everything is object, so it's not useful…
  25. [SOLVED] it actually started working for not good reason. I'm sure I tried before what I tried just now, but then it didn't work. Maybe by showing you the final code will clear things up $options = array( 'listClass' => 'inline-flex flex-center', 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentItemClass' => 'bg-red-400 text-white', 'itemMarkup' => '<li class="bg-green-400 px-3 py-2 {class} h-auto hover:bg-red-400 hover:text-white ">{out}</li>', 'currentLinkMarkup' => "<a>{out}</a>", 'separatorItemClass' => '', 'nextItemClass' => 'rounded-r-full', 'previousItemClass' => 'rounded-l-full', 'lastItemClass' => 'rounded-r-full', 'firstItemClass' => 'rounded-l-full', 'nextItemLabel' => '>>', 'previousItemLabel' => '<<', 'separatorItemLabel' => '<span>…</span>', ); thanks Edit: That said, what I don't like very much is the space between <a> and surrounding <li> tag which is not clickable but still changes its color upon hover. Hard to fix in this case at least.
×
×
  • Create New...