Jump to content

kongondo

PW-Moderators
  • Posts

    7,470
  • Joined

  • Last visited

  • Days Won

    144

Everything posted by kongondo

  1. I'll see if I can come up with something later...
  2. Just adding that the pagination I am talking about in Lister is ajax powered.
  3. Why would you think so? Pagination has been available in the backend ever since I can remember. Lister (page finder) uses pagination ?. I also know this since I have been using pagination in my modules.
  4. Hi @Spiria Could you please test version 0.2.8 currently on the dev branch? You will have to install it manually. It fixes the issue: Please let me know if it works. Thanks.
  5. Hi @Spiria, Sorry, didn't get a chance to look at it. There are two 'issues' you have reported: #1 If your profile is set in a language other than the default language, and you are building a menu with the MenuBuilder module, your menu won't appear correctly in the other language. I am working on a fix now. I hope to fix over the weekend. No promises though. #2 if you build the menu with language in your profile other than the default language, the menu will not translate correctly to the language chosen by a visitor, as my examples show. By default Menu Builder will display the title of the page as it was when it was added to the menu. If you want it to be dynamic depending on the current title and current language, you need to use the default_title option as documented here. For example: <?php namespace ProcessWire; $menu = $modules->get('MarkupMenuBuilder'); // render the menu by title and show the current title of the page in the user's language $content = $menu->render('My Menu', ['default_title' => 1]);
  6. Hello @hanna clarke, Is your site a ProcessWire site?
  7. Not sure I understand this bit. Is it related to the 'switching user language profile' issue you've mentioned?
  8. What @teppo said. Apologies this slipped under the radar. I'll have a look this weekend.
  9. Yes. this -> Repeater items markup are ready before the assets are. Have a look at Inputfield::renderReady(). https://processwire.com/api/ref/inputfield/render-ready/ Also have a look at example implementations in ProcessWire Inputfields. Written in a hurry; sorry cannot go into further details.
  10. I haven't had the need yet. Yeah, I see your point. Would hooking into page edit form solve the multiple injections issue or does each repeater come with its own page edit form? Just wondering. Gut feeling is that this could work. Would it be just for loading Alpine.js?
  11. Padloper 2 uses Alpine.js (and htmx) in lots of places, including Process modules and Inputfields. Without defer, as you point out, Alpine.js goes funky. My solution is to use inline scripts. ProcessWire does so itself, in several places. For Process modules, I have a method like below that I use to inject Alpine.js script where I need it: <?php namespace ProcessWire; private function getInlineScripts() { // @note: need to load alpine as 'defer' $url = $this->wire('config')->urls->$this; $alpinejs = "{$url}vendors/scripts/alpinejs/alpinejs.3.2.4.min.js"; $out = "<script src='{$alpinejs}'defer></script>\n"; return $out; } It might not look pretty for some people but your browser doesn't care and it doesn't bother me either . For Inputfields, I have this: <?php namespace ProcessWire; public function ___render() { // .....some code /** @var PageArray $value */ $value = $this->attr('value'); $form = $this->buildForm($value); $out = ''; //---------- // ...etc //---------- // MAIN render content $out .= $form->render(); // ------- /** @var str $preloadInlineAssets */ $preloadInlineAssets = $this->renderPreloadInlineAssets(); if (!empty($preloadInlineAssets)) { $out .= $preloadInlineAssets; } //---------- // APPEND any configs for this Inputfield that might be needed by JavaScript // E.G. translated strings. $out .= $this->renderJavaScriptConfigs(); //------------- return $out; } private function renderPreloadInlineAssets(){ // ...some code: conditions, etc // ---- $out = "<script src='{$source}'{$defer}></script>\n"; return $out; } I've been meaning to make a request to have this handled by config->scripts->add(), e.g. <?php namespace ProcessWire; $config->scripts->add($alpinejs, ['defer' => true, 'integriy'='some_hash', type="module"]);
  12. Hi @Jan Fromm. Glad it worked! Yes, you will need a custom field. Customers do not have their own template You would need to add the field to the order template itself (padloper-order). Please see Demo 2. It explains how you can do this. Good idea. But there are alternatives with respect to the Notes feature. Also see the caveats below. Apologies. Documentation is still lacking. Notes are stored in the field padloper_notes. This field is used in the template padloper-order. Padloper notes are a type of WireArray. You have access to all the methods of WireArray. Back to notes... Caveats Dedicated Text or Custom Field OR Notes Given that padloper_notes can take multiple notes and given that some of these are generated programmatically, using it to save a very specific note as described in your case might not be the better approach. For instance, you would need to search the WireArray of Notes for your 'reverse charges hint note' before you can display it on their invoice. Searching is not a big deal as you would be searching the WireArray in-memory, however, you will need some key words to match the note you are looking for amongst the order's other notes. An alternative is to add and use a dedicated text field in the order's template similar to the customer's VAT number above. A third alternative is to create your own custom field to store both notes and VAT numbers. Just a few thoughts. If you want to add a note using the API, it is quite simple as shown below. This example assumes you are doing this via a Hook. <?php namespace ProcessWire; # CONTENT OF A HOOK METHOD # /* if hooking $this->addHookAfter('PadloperProcessOrder::orderSaved', null, 'nameOfYourHookFunction'); */ // Retrieve argument by name /** @var Page $orderPage */ $orderPage = $event->arguments('orderPage'); $orderNoteText = "The text of my note. This customer has a VAT..."; # @note: this method will add tje created and modified times for you # you can add your user ID if you want, as the 3rd argument to this method /** @var WireData $note */ $note = $padloper->buildNote($orderNoteText,'admin'); $orderPage->of(false); // add the $note to the order page $orderPage->padloper_notes->add($note); // save the page $orderPage->save('padloper_notes'); # --------- OR ------------- // $notes = $orderPage->padloper_notes; // $notes->add($note); // $orderPage->setAndSave('padloper_notes', $notes); Method to Hook Usually hooking into __orderSaved would be fine. However, this method will be called every time the order is amended during the payment process. For instance, a customer can go to checkout and enter their details. This will cause an order to be created. Whilst in the order confirmation/payment page, the customer could decide to amend their shopping cart and subsequently head to the checkout. Since we already have an order created, it won't be recreated, however, it will be amended if needed, hence orderSaved() will be called again. This might mean your note would be created multiple times. You might not want this. You could always check if such a note exists for the given order and amend it if necessary. To avoid this, it could be better to hook into the PadloperProcessOrder::sendConfirmation() method instead as shown below. This method will be called only once, when the order checkout processing is complete. <?php namespace ProcessWire; # CONTENT OF A HOOK METHOD # /* if hooking $this->addHookAfter('PadloperProcessOrder::sendConfirmation', null, 'nameOfYourHookFunction'); */ $padloper = wire('padloper'); // @NOTE: Retrieve argument by name <- won't work since argument value is Null // instead, we get the orderPage from the session /** @var Page $orderPage */ $orderPage = $padloper->getOrderPage(); // ------------- $orderNoteText = "The text of my note if sendConfirmation() Hook. This customer has a VAT..."; # @note: this method will add the created and modified times for you # you can add your user ID if you want, as the 3rd argument to this method /** @var WireData $note */ $note = $padloper->buildNote($orderNoteText, 'admin'); $orderPage->of(false); // add the $note to the order page $orderPage->padloper_notes->add($note); // save the page $orderPage->save('padloper_notes'); Hope this helps!
  13. Hi @gebeer. I have now added this feature to MM 013. I have also added fixes for the issues you've raised above (MM missing required value; PagePaths vs settings issue and finfo_open(FILEINFO_MIME_TYPE) for JqueryFileUpload). Are you able to please test this new version for me before I release it? I have sent you a PM with details. Please note this version needs version 009 of JFU. Thanks.
  14. Great catch! Some users have reported this in the past but never managed to nail it down to PagePaths! I'll have a play and get back to you. Thanks!
  15. Thanks for reporting. Looks like a rookie mistake on my part. Good solution. I'll probably use wireClassName() or wireInstanceOf().
  16. @alexm I have not seen this setId() on null error since Padloper 1! ? Not sure what's going on here. Sorry about this. Are you able to recall the steps to reproduce the error? Looks like a payment gateway page is not reachable for some reason.
  17. @csaggo.com Thanks for the detailed instructions. I'll create this setup on a fresh install and hopefully be able to replicate. I'll then report back here. Thanks.
  18. Hey @alexm Happy Sunday! Sounds like a good idea! Will need to think about the product title of the clone or maybe let ProcessWire handle it if possible. In addition, would need to take care of variants. I'll have a think. How do you check if page clone is enabled? Thanks.
  19. @csaggo.com. Great find! Thanks for looking into this. I'll try to reproduce. Please clarify this: Do I? Install ProcessWire and select a non-language profile. Activate language support (not sure how to do this - never done it before; are there instructions somewhere? thanks) Default-language in place: is this English? Import translation files: Never done this before. A hint or guide would be helpful, thanks...
  20. No, unless security related. With respect to MM, I am moving to use an in-house htmx-alpine-js-tailwind-css solution. Most welcome. I'd certainly look at PRs. Thanks!
  21. Hi @gebeer, Thanks for using MM. Thanks for reporting this. I went through a lot of back and forth with this module in this respect. There were a number of conflicting experiences and/or recommendations out there. For instance: The above is considered by some to be insecure. I had this as an option for a time until I found out it was deprecated. But I have now found it was 'un-deprecated'! I'll have a think as I am in the process of writing the next version of MM. JFU will no longer be a dependency. In fact, we won't even need jQuery for it.
  22. Based on this comment: Plus activity and familiarity, I am also thinking summernote ?, or Trumbowyg. Although there is a million other possibilities here.
  23. Hi @bubu2110, Welcome to the forums. Please see the following documentation for Media Manager: Media Manager Objects - link. Accessing Media Manager Objects Properties - link. Other topics listed under Frontend Output of Media Manager Fields would also be of interest. Please let me know if you require further assistance.
×
×
  • Create New...