eelkenet

Members
  • Content Count

    57
  • Joined

  • Last visited

  • Days Won

    2

eelkenet last won the day on December 5

eelkenet had the most liked content!

Community Reputation

46 Excellent

About eelkenet

  • Rank
    Full Member

Profile Information

  • Gender
    Not Telling
  • Location
    Amsterdam

Recent Profile Visitors

1,880 profile views
  1. eelkenet

    Hmm, that is weird, in that case it is probably being reset somewhere. Have you tried doing a full search of your project's code for places where it might be overridden? Maybe some module or template is accidentally setting it, instead of checking for the value.
  2. eelkenet

    You should not overwrite this file. Instead, edit the config in site/config.php.
  3. eelkenet

    I ran into this issue too. I edited the Mollie module to fit my own needs, a bit too many changes to create a merge request, but it deals with this issue. <?php namespace ProcessWire; // Here you can find more information about the Mollie php api https://github.com/mollie/mollie-api-php require_once __DIR__ . "/vendor/autoload.php"; class PaymentMollie extends PaymentModule { public static function getModuleInfo() { return [ 'title' => 'PaymentMollie', 'version' => '0.0.2', 'summary' => 'Mollie Payment method', 'singular' => false, 'autoload' => false, 'requires' => 'ProcessWire>=3.0.98, PaymentModule', ]; } public function init() { ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); } public function getTitle() { return $this->_("Mollie: iDeal, Bancontact"); } public function getFailureReason() { return "Error"; } public function processPayment() { $payment_id = wire()->input->post->id; $order_id = wire()->input->urlSegment2; $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey($this->test_api_key); if ($this->live_check == "1") { $mollie->setApiKey($this->api_key); } $payment = $mollie->payments->get($payment_id); $order_id = $payment->metadata->order_id; wire()->log->save("mollie", "Processing payment for... $order_id"); if ($payment->isPaid() == true) { wire()->log->save("mollie", "Order $order_id was paid using mollie!"); $order = wire()->pages->get($order_id); $order->of(false); $order->pad_paid = time(); $order->addNote($this->_("Order paid using Mollie") . ": " . $payment->id); $order->removeStatus(Page::statusUnpublished); $order->save(); return true; } elseif ($payment->isOpen() == FALSE) { return false; } return false; } public function getMollieMethods() { $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey($this->test_api_key); if ($this->live_check == "1") { $mollie->setApiKey($this->api_key); } $methods = $mollie->methods->all(); $return = [ ]; foreach ($methods as $method) { $return[] = [ "title" => htmlspecialchars($method->description), "icon" => htmlspecialchars($method->image->size1x), "icon2x" => htmlspecialchars($method->image->size2x), ]; } return $return; } public function render() { $output = ""; $mollie = new \Mollie\Api\MollieApiClient(); $mollie->setApiKey($this->test_api_key); if ($this->live_check == "1") { $mollie->setApiKey($this->api_key); } $paymentInfo = [ "amount" => [ "value" => number_format(($this->getTotalAmount() /100), 2, '.', ''), "currency" => 'EUR', ], "description" => "Bestelling van: " . $this->customer->givenName . " " . $this->customer->familyName, "redirectUrl" => $this->httphost . "checkout/?id=" . $this->id, "webhookUrl" => $this->httphost. "checkout/processmollie/" . $this->id . "/", // Specify here wat you want "metadata" => [ "order_id" => $this->id, /* "customer_name" => $this->customer->givenName, "customer_familyName" => $this->customer->familyName, "customer_address" => $this->customer->streetAddress, "customer_locality" => $this->customer->locality, "customer_postalCode" => $this->customer->postalCode, "customer_country" => $this->customer->country, "customer_email" => $this->customer->email */ ], ]; // $output .= "<pre>" . print_r($paymentInfo, true) . "</pre>"; $payment = $mollie->payments->create($paymentInfo); wire()->log->save("mollie", "Creating the payment... $order_id"); // Type here your custom HTML // use $payment->getPaymentUrl() as url for your payment link foreach ($methods as $method) { $output .= '<div style="line-height:40px; vertical-align:top">'; $output .= '<img src="' . htmlspecialchars($method->image->size1x) . '" srcset="' . htmlspecialchars($method->image->size2x) . ' 2x"> '; $output .= htmlspecialchars($method->description) . ' (' . htmlspecialchars($method->id) . ')'; $output .= '</div>'; } $output .= "</div>"; $output .= "<div><form action='{$payment->getCheckoutUrl()}'> <button type='submit'>". __('Pay') ."</button></form></div>"; return $output; } public static function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); // Test API $live_api_field = wire('modules')->get('InputfieldText'); $live_api_field->name = 'test_api_key'; $live_api_field->label = __("Test API Key"); $live_api_field->notes = __(""); if (isset($data['test_api_key'])) { $live_api_field->value = $data['test_api_key']; } $inputfields->add($live_api_field); // Live API $test_api_field = wire('modules')->get('InputfieldText'); $test_api_field->name = 'api_key'; $test_api_field->label = __("Live API Key"); $test_api_field->notes = __(""); if (isset($data['api_key'])) { $test_api_field->value = $data['api_key']; } $inputfields->add($test_api_field); // Select live or test API $check_api_field = wire('modules')->get('InputfieldCheckbox'); $check_api_field->name = 'live_check'; $check_api_field->checked = $data['live_check']; $check_api_field->label = __("Use Live API Key"); $check_api_field->notes = __("If not selected, the test-api will be used. Keep in mind that you also have to activate the Live api on your Mollie dashboard"); if (isset($data['live_check'])) { $check_api_field->value = $data['live_check']; } $inputfields->add($check_api_field); // HTTP Host url $httphost_field = wire('modules')->get('InputfieldURL'); $httphost_field->name = 'httphost'; $httphost_field->label = __("HTTP Host"); $httphost_field->notes = __(""); if (isset($data['httphost'])) { $httphost_field->value = $data['httphost']; } $inputfields->add($httphost_field); return $inputfields; } }
  4. eelkenet

    I ran into an issue that is related to the way the RestAPI circumvents the pagetree structure (running the checkIfApiRequest hook before rendering any page). This method made it impossible to use ProCache for API requests that could (and should) return a cached result, such as for static site content. I thought about creating a custom caching system on top of RestApi, but ProCache is just too well designed to ignore here. I wrote a post about this on the ProCache VIP-forum, but as this forum is not accessible to all people I'd like to share my (admittedly hacky) solution for this. Basically I add another (cacheable) endpoint in the pagetree, which pipes the request to the RestApi endpoint: Create a new template and corresponding page (I called both 'api'). Set the content-type of this template to application/json, and disable any prepending/appending of files. Add the following code to the template: <?php //site/templates/api.php $protocol = $config->https ? "https://" : "http://"; $endpoint = $modules->get("RestApi")->endpoint; $hostname = $config->httpHost; $segments = implode("/", $input->urlSegments); $url = $protocol.$hostname."/".$endpoint.$segments; return file_get_contents($url); I'm sure there would be a better, cleaner way of doing this. A current downside is that there now are 2 seemingly identical endpoints for my site. One is cached, and the other is 'live'. Any ideas?
  5. eelkenet

    Great, that works! Thank you for the fix.
  6. eelkenet

    I installed the module (v0.1.3) on an existing site, running PW in the current Master release, v3.0.98 on Php 7.2. After enabling the module for a regular Fieldset (Open) I kept running into this error: Method InputfieldFieldsetOpen::wrapClass does not exist or is not callable in this context This is because Inputfield::wrapClass() has not been added to the Master yet, it is only available on the ProcessWire dev release (currently 3.0.119). The fix for this issue is to replace lines 107-109 with: // Add classes to inputfield $inputfield->wrapClass .= ' MinimalFieldset'; if(!$field->no_spacing) $inputfield->wrapClass .= ' MinimalFieldsetSpaced';
  7. eelkenet

    While it is not an 'out of the box' solution, it is perfectly possible to for instance to use the RestAPI module to parse any bit of content, such as (items from a) repeater matrix. Just like when you would write your regular template logic, it does require some custom programming on your end though: you will have to go through the matrix' items and decide how they should be presented through your API. Which is exactly the flexibility which makes PW our go-to solution for pretty much any modern (headless) webapp or old-school site!
  8. eelkenet

    Tip: If you install TracyDebugger, you automatically also get Adminer, with which it is very easy to import/export your full database from and to your local/staging server.
  9. eelkenet

    Hi @thomasaull, I have been using this module during the last week, to rebuild my API logic from the ground up. It's really nice work, thank you for releasing it! One thing I've noticed though, is that the exceptions handler (Router::handleException) is a bit overactive, and shuts everything down on non-critical exceptions. For instance, when running a PNG file through the PW ImageResizer ($img->size() etc), PW throws an exception, because the exif_read_data function is not available for PNG's. PW deals with this by using the error control operator (@method): the code still runs fine, while silently throwing an exception message. However, using the RestAPI module, this renders (and logs) an error message and stops any further output. It is of course easy to just comment out Router.php line 25, where you set the handler. But perhaps this could work in another way? Maybe making it a configurable option?
  10. eelkenet

    Bump, I am seeing this too, and others may also on certain shared hosting environments. Of course it is not visible when $config->debug = false, but still I guess this should be optional? Warning: set_time_limit() has been disabled for security reasons in /subdomains/staging/wire/core/FileCompiler.php on line 384
  11. eelkenet

    For my use case, I want to give my user the possibility to add images and videos to a (sortable) fullscreen slideshow on the front-end. Of course I can accomplish this using simple repeaters, or a repeater matrix, or a page table or something like that, meaning each slide comes from a single element inside. However, when dealing with a large amount of images (batch upload) this gets really annoying, after all you need to upload each image individually - just to be able to also add videos. So to me it makes total sense to add the video-preview images to the same Images field as I use for the other images. Technically I would use the order of the Images to define the order of my slides, and then when outputting this into my API check if the filename fits the expected video-ID format and search for the corresponding Video URL. A completely different solution would be to allow for batch creation of repeater matrix items, from a multiple file upload. But that seems like a lot more work to achieve. I already have a working version locally, but it is a bit messy. I'll try to clean it up a bit and create that PR for you in the near future.
  12. eelkenet

    Hi @adrian, I just took a look at this specific behavior, and found that while it does work, it does not work as I expected. Expected: Add repeater, each row has an URL field. Also add a single Images field, to collect the images. Video images load into central images field on page. Actual: Add a repeater, each row has a URL field and an Image field. Video images load within each repeater row's Image field I think it makes sense for the module to check it it is running on a repeater, and then (optionally) trying to load the images in an Images field inside the parent template. I'll try to implement this.
  13. eelkenet

    Hi @Nurguly Ashyrov, this looks like a great module - thank you for developing it! I'm a complete noob to the world of GraphQL, and have been trying for two days to get this module running in combination with Ember.js. If I could get it to work, it sure would be a glorious combination. But so far it has been pretty frustrating One thing that I keep running into, is that your implementation always returns an array of pages, using the 'list' field* inside the query. However, this makes it impossible to request a single page. Even when using something like limit=1 in the selector. For instance, I could imagine this to work fine { basic_page(s: "name:contact") { first { id name } } } Which then could return { "data": { "basic_page": { "first": { "id": "1017", "name": "contact" } } } } Basically, any of PW's regular PageArray methods to find something would be a welcome addition ( ie. ->eq(n), ->get(selector), ->first(), ->last(), etc.) Is this something I can achieve with the getQuery hook? Or in another way? Thanks in advance for any pointers or help. (* I have to say, this use of the field keyword is very confusing for a long time PW user).
  14. eelkenet

    Hi @kongondo, I have just purchased the module and started testing it. One thing I ran into immediately is that it does not seem to support multilanguage text fields, even Title does not show up in the Data Source options. Are you aware of this? For now I can bypass this by adding an extra single language textfield, but I would expect it to work out of the box. Perhaps just by showing the Default language content. For large existing multi-lingual sites this could be a big issue.
  15. @fbg13 Yes, that fixes it! Congratulations, no errors, and the file is on the S3