Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

4 Neutral

About michelangelo

  • Rank
    Jr. Member

Profile Information

  • Location
    Den Haag, NL

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Okay, I start to get the general opinion towards Infinite Scroll :D
  2. Wow @MoritzLost, that's quite a response. Thanks so much! I will post a few examples here of my code but reading all your point made me realise a few things. Let's start from back: We don't need to load the events, but eventually there is going to be many of them in the archive. My idea was to display the most recent ones and if you want you can pull the next most recent, etc. With pagination maybe it will work the best as I can render everything on the server and just display what I need. My idea was to render everything at the server side as it is easier for me. But I completely get your point why this is not scalable. The Infinite scroll was also too complicated for the same reason, I didn't know what's going on in the back scenes. Right now: let postData = { "ajax:": true, "itemOffset": itemOffset, }; $.ajax({ type: "POST", url: url, data: postData, beforeSend: function (xhr) { xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded") }, success: function (data, status) { pageData = data; itemOffset += itemsToLoad; } }).done(function () { // when finished and successful container.insertAdjacentHTML("afterbegin", 'loaded: ' + pageData + ' (by jquery ajax)'); }); and then I wanted to execute that with my load_events.php template: $num_new_events = $_POST['itemOffset']; $events = $pages->find('template=nk-event, limit=$num_new_events'); // Render something about these events title, images, etc... foreach ($events as $event) { $event_title = $event->title; //etc... $events_output+= '<div class='event'>'. $event_title .'</div>'; //etc... } return $events_output; and then my JS will take it again from there. Of course, this didn't work last week, now it works but only from the home page, because it cannot find my load_events.php file or CORS policy issues. So at the end, I thought it's a bit more straight-forward but it seems like I need to rethink my approach. I have spent a lot of time on this project, so maybe I will try to make what I have until now work or switch to pagination. Thanks for the feedback!
  3. Hello guys, I know there are several AJAX threads, but I have been struggling for weeks with AJAX and I really want to get it working... Theoretically I understand what is happening, but how can I make it work in a ProcessWire context? Let's say I have 10 events (pages). I am displaying 5 and when I click 'Load More' it loads 5 more, etc. What I understand until now is: 1. Make a button 'Load More'. 2. Connect the button to AJAX function in JS (vanilla or JQuery or infinite Ajax Scroll). I prefer to be as simple as possible so I can tweak it myself. 3. Send the AJAX request to a php template that renders my content ( the 5 more events ) and returns it to my JS. 4. JS takes the returned content and appends it to my container in the DOM Step 3 is impossible for me. I tried so many different ways to just create a simple query, render my content and return it. If you can share your workflow and small bits of code, that will be the best thing ever. Thank you!
  4. Hello @bernhard, this field looks great! Is it possible for us to use it as well? I would like to implement it in a current project and it seems like it will work perfectly. I saw the module on github but is the inputField also available?
  5. Haha, no worries. I am really getting into Snipcart and SnipWire. I hope it's okay to ask a few more questions the next few days. Actually, I got one now because I am using Polish Złoty which is not parsed correctly so I get this message: I suppose that this comes from the Snipcart API, but then there it is formatted well... Is it because it doesn't have a currency symbol but just letters (pl)?
  6. Aha, thanks, so it is not part of the module and I don't have to tinker with that. Thank you again, great job on the module integration!
  7. Hello again @Gadgetto, I managed to make it work on my dev server, unfortunately after a lot of hassle because Duplicator and Site Export didn't work (Profile not found error). Anyways, now it works. I was wondering if I can implement Paypal payments? Is this something I need to implement or it is not yet in the module? Thanks.
  8. Okay, it seems clear. I am just using the SnipWire Module, I have no idea, whether I need to configure more than just the required steps in the module... Update: I saw that the default products from processwire are not included in the Snipwire db. I added them, but it still doesn't work.
  9. @d'Hinnisdaël I am working on this with ngrok right now. I am still missing something though. What would the workflow for this be? I am trying: 1. Set up processwire and snipcart 2. Open up ngrok on port 8888 which has access to many things but from there I can reach /snipcartTest/snipcart-shop is accessible. (Could this be the problem?) 3. Copy the ngrok generated url and paste in Snipcart domain setup. I can imagine that Snipcart cannot find my snipcart-shop page because my ngrok url is so global. In the domain setup it takes only the base domain (e.g. 1231231.ngrok.io)
  10. Hello @Gadgetto, thank you so much for this brilliant integration. It looks superb! I got this dreadful message in my testing: We have not been able to validate your order. Looks like some product prices might have changed since you added them to the cart. Please review your order and try again. I saw the earlier discussion but that didn't help. As you specified in the module setup, Domain Setup is Snipcart's domain configuration. Here they describe what it does, but what can I put when I am testing it locally? I guess this is not correct: Looking forward to fire up the shop for good! Thank you!
  11. Hello everybody! Thank you for your responses! @BitPoet that's a great tip, I didn't try it but I disabled the AJAX on the repeater as I don't have a lot of content and it works perfectly. @teppo sorry for the misunderstanding and thanks for moving it.
  12. Hello guys, very simple question about repeaters from the Core Modules. I have used them before without issues. This one concerns a weird behaviour which I am not sure whether it's caused by me not using it correctly or a bug. The problem is that when I add content, save it, refresh the page and return to the page, I cannot unfold the repeater. I made a video so you can see the behaviour (below) I tried re-initiating the repeater field, but still doesn't work... Looking forward to your advice! Thanks! repeater-problem.mp4
  13. Hello lads, I know there is some AJAX threads, but my question is super basic. How do I connect and use AJAX within PW? For now I am creating a request and sending it to my template which I want to do some search with PW's find() for me and return what I need as JSON eventually. let xhttp = new XMLHttpRequest(); if (option == undefined) { return; } else { if (option.name == 'options-sorting') { optSorting = option.value; } if (option.name == 'options-filtering') { optFiltering = option.value; } xhttp.onreadystatechange = function () { console.log(this.status); if (this.readyState == 4 && this.status == 200) { console.log(this.responseText); } }; xhttp.open( 'GET', 'site/templates/includes/archive-list-render.php?q=' + optFiltering + ',' + optSorting, true ); //Send the proper header information along with the request xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhttp.send(); This code gives me 403, as PW doesn't allow me to access my archive-list-render.php. What should I do? I read some stuff about creating separate AJAX templates, is that really necessary in this simple case? On the php side I am thinking of something like this: $q = $_REQUEST["q"]; $options = explode(",", $q); // Some logic to define exactly what my query is going to be, e.g. sort=nk-artist $songs = $pages->findMany("template=nk-song, sort=$options"); Then I should get an array of objects that I can render little by little, because the expected results are about 8000 pages. Thank you!
  14. Wow, super nice! The more you know... Thank you!
  • Create New...