-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
160
Everything posted by kongondo
-
Return json from __execute in backend module
kongondo replied to toni's topic in Module/Plugin Development
You cannot reach a backend page -> Process, Setup, etc from the frontend like that. There are various alternatives. A recent one is URL hooks. -
Maybe give Padloper 2 a try. It is a dedicated e-commerce software ? ?. Then again, maybe I am too close to it.
-
Paginated variants on product edit screen
kongondo replied to alexm's topic in ProcessWire Commerce (Padloper) Support
Top of the evening, sorry for late reply @alexm ?. Yes I have. Plan was to release Padloper first then go through the list of planned and requested features. I have been thinking about it though. There's two things here. Lazy loading and pagination. The former is more important as without that, for a variant-heavy page, the product won't load at all, even though one might have to scroll a lot (if no pagination). But this is definitely on my list. Thanks. -
I am receiving questions with respect to the release of Padloper 2. I have added an FAQ section to the first post here. Please have a look. Thanks.
-
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
I reckoned as much ?. That version does not have the bug fixed, sorry. Please use the latest version. The same link I sent you should work. It is valid for one year effective 30 Match 2022. No way! That'd be very unfair ?. Now that Padloper has been released (no longer in beta), although the beta testing programme is finished, your licence does not expire with the end of the testing. In fact, your subscription and access to VIP support 1-year countdown starts from the release date, i.e. 30 March 2022. I hope this answers your question. This would be awesome. Thanks. -
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
Hi @alexm, Are you using the release version? I.e. when did you get your Padloper copy? -
Thanks for the detailed explanation. @3fingers, I have come up with an alternative solution to your original question. It does not use SSE but uses htmx and Local Storage. It is detailed and demonstrated in the topic below:
-
The problem: how to refresh a page's frontend content in real time without a page refresh when the page has been edited in the backend. This is an alternative approach to the one discussed in the topic below. The above topic attempts to solve the problem using SSE. The solution in this topic instead relies on Local Storage and htmx. There is no ajax polling. Please note that auto-refresh here refers to a page refresh during the same session and in the same domain. It is not cross-site. The solution can be summarised as follows: Use a hook in ready.php to inject custom JavaScript to the ProcessWire backend admin, specifically in ProcessPageEdit. This can be a JavaScript file or inline script. The purpose of this file is to update a given Local Storage key after a page has been edited. Instead of listening to the Save Button click, the script just checks on load if a certain hidden input whose value matches the page currently being edited is present. This hidden input is placed inside ProcessPageEdit form using a hook as detailed below. The hook in this step #1 can be: $this->addHookAfter('AdminTheme::getExtraMarkup', null, 'hookAddCustomScriptsToAdmin'); In ready.php, add a hook to listen to saveReady(), e.g. $this->addHookAfter('Pages::saveReady', null, 'hookNotifyFrontendOfBackendPageSave');. When the page is saved, the handler method hookNotifyFrontendOfBackendPageSave will check if there are changed fields. It will then write to a temporary session variable for the current page with the names of the fields that have changed. On page load/reload, there is a hook in ready.php that monitors ProcessPageEdit, i.e. $this->addHookAfter('ProcessPageEdit::execute', null, 'hookAddMarkupToNotifyFrontendOfBackendPageSave'); The handler hookAddMarkupToNotifyFrontendOfBackendPageSave will check if there is a session variable set in #2 indicating that the page has had recent changes in the fields names set to that session variable. If this is true (that there have been changes), this hook will simply append the hidden input in #1 to the ProcessPageEdit form. The JavaScript in #1 will detect the presence of the hidden input. It will then amend the Local Storage value in #1. It cannot simply set the value to the ID of the page being edited as that will not be construed as a change. It will instead append a timestamp to the id of the page as well and set that as the value. This will enable a listener in the frontend, described in the following steps, to detect that change. In the frontend, we have a simple JavaScript file that listens to changes to the Local Storage storage Event. The frontend also has a simple hidden input in the template file whose pages we want to refresh. This hidden input has htmx attributes. Its trigger is a custom event 'autorefreshpage'. It will listen for this event before firing a message to the server. This hidden input also has hx-swap=none as nothing will be swapped to it. Instead, the server will send back results of changed fields in various markup with hx-swap-oob=true. That will enable swapping markup in any parts of the frontend html in one go. When the Script at #4 detects that a given Local Storage value has changed, it first checks if the page ID for that Local Storage value matches the page ID of the page currently being viewed in the frontend. If the answer is yes, it will fire the custom event autorefreshpage. This will make htmx fire a message to the server whose only value is the page ID it has been passed. On the server, in home.php, we have code that is listening to ajax requests. If it detects an ajax request, it checks if the page ID that htmx sent matches an available session that was recently updated. This would be the temporary session detailed in #2 above. If a match is found, it calls a function in _func.php that will set variables for fields for that page. These use partial templates (optional). These partial templates are for different outputs of the page, e.g. images, headline, etc and all their markup have hx-swap-oob='true' in appropriate places. All these content is sent back as one output back to htmx. It will read the hx-swap-oob and find the markup to replace in the DOM using the html IDs of the markup with the hx-swap-oob. This approach allows the developer to have maximum control over what to send back to htmx and over the markup. In this step, we also delete the temporary session, ready for the next updates. The result is as demonstrated below. A simple and effective DOM swap that places very little strain on the server. I'll clean up the code for this and upload to GitHub. This approach will not work with Save + Exit and similar :-).
- 2 replies
-
- 12
-
-
-
I can organise guest access to a backend if anyone wants to have a look. Please PM me if this is of interest. I will be making videos in due course but actually testing it for yourself is still good.
-
Sorry this works, of course it does! Thanks @bernhard. Nothing strange about $sanitizer that I mentioned above...just me. Sorry for wasting your time ?♂️.
-
Good point. I wasn't clear. I also had a typo in there. What I need is this: "blick-docker" to match what is generated in page name field. As you point out & in the URL is not desirable. However, I am facing the inconsistency that @snobjorn mentioned. Here it is again + a strange inconsistency I have seen. User creates a product called "Blick & Docker" <- I have no control over this naming. ProcessWire access that product's title and gives it the name "blick-docker". In the frontend, there is a list of products. Their links to their single product pages are generated dynamically from their titles. However, in the frontend, ProcessWire $sanitizes the title of this specific product as "blick-amp-docker". (see code below). Finding that page using its URL segment fails since #3 does not match #2. <?php namespace ProcessWire; $productName = $sanitizer->pageName($product->title, $beautify = true);// "blick-amp-docker" What'd I'd like is a $sanitizer that gives me "blick-docker", i.e. matches the sanitizer used in a page name field. Maybe it is done at the JavaScript level, hence doesn't exist in $sanitizer? I have tried all the things suggested here (except changing the page name settings as I would like as little effort as possible from the user). What is strange is that pageNameTranslate also adds 'amp' if used in a template file in the frontend. If used in Tracy, there is no 'amp'! EDIT: Please ignore this . Output formatting on/off, duh! I hope this is clearer. Thanks ?.
-
Those with the beta version, please note that there have been some changes to the order template. Some fields have been removed and a few things re-arranged. If you cannot do a fresh install, please let me know and I'll guide you through the changes. Thanks.
-
Been experiencing the same issue and the solutions are not working for me. Let's say I have a product titled "Blick & Docker". In my template file, I'd like to $sanitize that title and use it as a URL segment that will end up as /products/blick-docker/. This would match the page name for this product since I can find that product page from the URL segment. Currently, I am ending up with /blick-amp-docker/ which leads to a 404 as it doesn't match my product page at that URL segment. I know I can use regex to replace 'amp' but that won't work for products that genuinely have 'amp' in them. Any ideas please? Thanks.
-
Padloper 2 has been released I will write a better post later. Need to know for now: Get it from here. We will be transitioning to a new website and/or shop in due course. For now, please get it from that old site. For now, and to allow it to bow out gracefully, initial purchases will be powered by Padloper 1. All hail Padloper 1 :-). Due to #2, and #3 and due to non-SCA compliance on that particular site, there might be Stripe issues. Apologies. Please contact me for help. Support for Padloper 1 has ceased. Security fixes will continue. Things I have promised to look at will be looked at :-). Support subscription period for beta testers' purchases commences today - 30 March 2022. It is a special day...in more than one way... Update 3 April 2022 Frequently Asked Questions A few questions are coming up with respect to this release. For now, I'll answer them here but might start a new threaded dedicated to FAQs. Q: Will beta testers have to purchase a new licence for this release? A: No. Your licence and download link are still valid. The only difference is the countdown of your VIP support commences on 30 March 2022. Subscriptions and updates are valid for one year. This download link was emailed to you when you purchased Padloper 2. Please contact me if you do not have a download link. Q: I have shops built in Padloper 1 that I'd like to migrate to Padloper 2. I don't have the expertise and/or time to do the migration myself. Is there paid support for this? A: Yes, paid support is available. We can migrate your Padloper 1 shop to Padloper 2 per your specifications. This includes both backend and frontend migration. You can purchase either or both backend and frontend migration. Please contact me to discuss. We will soon add this custom work information to our website. Q: Is there a backend/admin demo of Padloper 2 that I can test pre-purchase? A: Yes. We are currently putting final touches to it. An announcement will be made here once this is ready. Q: Which is now the official Padloper support forum? A: This forum will eventually become the official Padloper support forum Although it is a public forum, we will still be able to offer VIP support. The only difference is downloads will be not be available in the forums, since it is open. Support via email will still be available as well. Q: I am getting a called to undefined function bcmul() after install. What does this mean? A: Please see the minimum requirements for Padloper 2. You will need to install the PHP extension bcmath on your server. This is in order to get accurate rounding off of currencies.
- 23 replies
-
- 23
-
-
-
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
This was a bug. Just fixed it now. Thanks. -
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
I see, thanks. Yes, you need at least PHP 7.4 with BC Math extension https://docs.kongondo.com/start/requirements.html -
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
Hi @alexm, Thanks for reporting. I saw the line #2132 the other day and couldn't figure out where it had come from. Must have been some botched find and replace. I have checked all files now and removed the ones in InputfieldPadloperProductStock.php. Does removing them allow you to install? What PHP version are you using. I am wondering why mine did not throw any errors. ps: Please check your email, thanks. -
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
@alexm, No problem. I have sent you an email. Thanks. -
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
Apologies I wasn't clear. I meant the link that was sent to your email when you purchased Padloper 2. Please let me know if you cannot find it and I'll send it to you. Alternatively, please use the resend link form I linked to above. Sorry for the confusion. -
Padloper 2 Update: March 2022
kongondo replied to kongondo's topic in ProcessWire Commerce (Padloper) Support
Hi @alexm, Definitely. Please use the download links that got sent to your email after the purchase. If that never came through, please use this form to request the links to be sent to your the email you used when you made your purchase. Alternatively, please PM me or send me an email and I'll sort it out for you. Thanks. -
NullPage Errors when dealing with Parent Pages
kongondo replied to ErikMH's topic in General Support
It is interesting the this commit for findRaw() to support parent properties/fields in the return value happened in 3.0.192. Maybe it's just a coincidence but I find it interesting that the issue on this thread is about parent values and that commit, whilst for findRaw() was also about parent properties. -
Weekly update – New blog: field and template scalability upgrades
kongondo replied to ryan's topic in News & Announcements
@ErikMH. As requested, I have split the posts relating to your NullPage errors into its own thread ?. @bernhard, @adrian just tagging your for FYI. Thanks. -
NullPage Errors when dealing with Parent Pages
kongondo replied to ErikMH's topic in General Support
Very wild guess here. I'm just wondering what major thing changed between 3.0.184 and 3.0.192? When I read about the lazy loading issues here, I am just wondering if there is a connection. Just a very wild guess. @ErikMH, are you able to upload the code that is not working to some gist or here for us to play with? I haven't followed the whole of this thread so apologies if I have missed it.