Jump to content

fruid

Members
  • Posts

    682
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by fruid

  1. cast_language is the select options field's name. It has options (multiple checkboxes) as follows: 1=English 2=Deutsch That matches the title of the available languages. I edited my original post and added the foreach loop to make things clearer.
  2. what I want to accomplish is to actually allow the pages to be english AND/OR german, so they can in fact be english AND german. I want to give the content manager full control over which page is shown in which language. So the problem remains that when I run my code, the value of the selectoptions field gets overwritten and I just don't know how to simply add to the array instead. I'm sure it must be possible somehow.
  3. I have an array of bilingual pages. These pages have a body. If the body is filled, it's in the array. So the array is different in english than in german. Criteria is the body. I want to change that though and use a SelectOptions field as criteria instead. That field would be a multiple value checkbox SelectOptions field with values as follows. 1=English 2=Deutsch Now I want to check one or two of these options for each page via API. Something like: foreach ($suckers as $s) { // :D if (user()->language->title == 'Deutsch') { $s->of(false); if ($s->cast_language == "") { $s->cast_language = "2"; } elseif ($s->cast_language == "1") { $s->cast_language = "1|2"; } $s->cast_language->items->add(1); $s->save(); $s->of(true); } if (user()->language->title == 'English') { $s->of(false); if ($s->cast_language == "") { $s->cast_language = "1"; } elseif ($s->cast_language == "2") { $s->cast_language = "1|2"; } $s->cast_language->items->add(1); $s->save(); $s->of(true); } } But I think that's nonsense, still cannot tell from the documentation how to approach this. The issue is, the array depends on the user's current language, so in order to use this function to set the values right I need to run it once in German and once in English. But at the second run it will overwrite the values of the first run. Don't know how to add to the array of selected options. Thanks for help!
  4. I have some html in a body field of a page including some <a> tag. For some reason the last bit of the link appears in the head in some meta tag and it breaks the page, the text appears on top of everything else. It must have to do with a faulty parsing of the html, meaning the closing of the <a> tag break the entire html but I have no idea how to fix it. The body is a CKEditor field. So it's like: <p>whatever whatever, <a href="https://www.domain.com/whatever" rel="noreferrer noopener" target="_blank">blablabla</a>.</p> and then I see on top of the page above all other content: blablabla. " /> Any ideas?
  5. Thanks, I already put the memory_limit to 320MB which didn't help. It works on my test-installation though, which however has a smaller database. So I guess if setting the RAM to 512MB works, that solution would only be temporarily as well. Any more ideas?
  6. I have troubles using AdminActions. I get… Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) (Zeile 1325 in wire/core/WireDatabaseBackup.php) However, if I disable automatic backup, it works fine. So now I wonder how to fix this properly, without disabling the automatic backup. Which memory is exhausted exactly? Hardly is it the server, we have unlimited storage. Thanks for help
  7. On the testing environment – subdomain, same server – I actually left the ChangeLog module active and the CSV-upload still works like a charm. I talked to the host, they don't see any difference in the server settings on both. They put the max memory for the live server. Still doesn't work. I compared the active modules on both installations, there is virtually no difference, in fact more modules are active on the testing environment which works fine. I deleted the cache in the assets folder, which is pointless, I reckon. Any help is appreciated.
  8. I uninstalled ProcessChangelog, but that didn't help. My client is still experiencing the same issue when uploading. Any more ideas what this error could mean?
  9. This might be a very basic question, don't know what's the easiest solution though… Let's say I have some pagetree like that: beverages > whiskey > > Jameson > > Ardberg > beer > > Heineken > > Leffe sweets > cake > > cheesecake > > chocolate > ice cream > > stracciatella > > raspberry I want an array of all these pages in order of appearance in the page tree. I tried: $homepage = $pages->get('/'); $items = $homepage->descendants("template=menu"); But when I loop through it foreach ($items as $item) { echo $item->title; } it first shows level 1, then level 2, then level 3 like this: beverages, sweets, whiskey, beer, cake, ice cream, Jameson, Ardberg, Heineken, Leffe, cheesecake, chocolate, straciatelly, raspberry Thanks for help!
  10. I'm having a similar issue as @ceberlin when uploading a CSV file to import pages Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) (Zeile 1325 in wire/core/WireDatabaseBackup.php) (I started there: https://processwire.com/talk/topic/26256-allowed-memory-size-of-268435456-bytes-exhausted-tried-to-allocate-4096-bytes-zeile-1325-in-wirecorewiredatabasebackupphp/ which brought me here.) Is there any way to fix this issue other than deactivating/uninstalling the module?
  11. how do I do that? I do indeed use that very module ProcessChangelog. Might that be the problem? That module is actually not installed in said test environment, so it looks like that could be it. I'd love to better understand this… Not sure if the database is huge but it will be much bigger soon once we migrated everything.
  12. Hi people, my client reports an issue when trying to import a CSV-file via a custom action I wrote on top of the ProcessAdminActions module. This is the error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) (Zeile 1325 in wire/core/WireDatabaseBackup.php) I had put a copy of the whole website on a subdomain on the same productive server for testing purposes. Now I tried to upload the same CSV-file there with no issues. We encountered this issue before I think I already reached out here, just cannot find the thread anymore. A working solution I think was to update the post_max_size etc. within the php.ini file, but that seems suboptimal, my client, who is quite tech savvy, thinks there must be a bottleneck somewhere. Any ideas? Thanks for help!
  13. 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!
  14. 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.
  15. 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.
  16. 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?
  17. 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.
  18. 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);
  19. 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.
  20. 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!
  21. @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.
  22. thanks, but what about the function sortOutEmpty(); ?
  23. Unforunately, it makes no difference, just tried it.
  24. @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.
×
×
  • Create New...