Leaderboard
Popular Content
Showing content with the highest reputation on 01/19/2020 in all areas
-
UPDATE 2020-01-19 I finally finished the integrated taxes provider - SnipWire now also handles shipping taxes correctly - and in a very flexible way which should cover pretty much all tax calculation methods/requirements worldwide! The integrated SnipWire taxes provider is now even more flexible than Snipcart own integrated provider! A store merchant can choose between the following shipping taxes calculation methods: No shipping taxes Apply a fixed tax rate: A fixed shipping tax rate from taxes configuration is used. Apply predominant tax rate: The shipping costs are allocated entirely to the economic good with the highest tax rate. So the highest tax rate from cart is used to calculate shipping taxes. Proportionally split and apply tax rates: The shipping service is divided as a secondary service and shares proportionally the fate of the respective main service. Part of the shipping service is thus subject to the normal tax rate, part to the reduced tax rate. If you find any other constellations which cannot be covered by the present options, please drop me a line and I'll add it.5 points
-
Great so see the comments field get an update. Would it be possible to add some modern needs (options? hooks?) for the comments form to be able to include a mandatory GDPR checkbox with some legal text decide which fields from the form are mandatory and which not saving or not saving the IP address with a setting how long to keep those make it easier go apply UIKIT3 to the layout There are existing workarounds in this forum (by modifying a field clone in /site/) but that is a bit hacky i.m.h.o. for those common needs. Also the documentation linked to from the field admin feels a bit dated for all the extra stuff available...3 points
-
Hi everyone, Introducing my first module https://github.com/christophengelmayer/StaticWire It's a simple way to convert your ProcessWire site to static HTML files via CLI or the admin interface. Useful in CI/CD scripts or to use ProcessWire as a simple static site generator.2 points
-
Anything that repeats in any programming language calls for, invariably, something you can iterate/traverse (e.g. an array) and the tool you use for the traversal/looping, (e.g. foreach). Let's go with these two. Looking at the UIkit markup you've pasted, I suppose some of the classes are automatically injected by UIkit JavaScript. However, the basic structure of the markup that repeats is the same. Hence, I'll ignore markup classes for now. The main differences in the images ratio markup are the following: The main containers for the images vary in the class they have. The first, the second and the fourth have the class: <div class="uk-width-expand@s">...</div> The 3rd image container has a different class: <div class="uk-width-2-3@s">...</div> Secondly, the <img> markup themselves have different values for their data-height attribute. Hence, we will need some variable to store these differences. Although some of the values are shared, for instance, the class for the main images container for the 1st, 2nd and 4th images (as stated above), I prefer to store each image's values separately. This can help down the line if the markup changes resulting in different values that were previously identical. Although it may be simple to assume that the images in your image field (which I will refer to as images) are already arranged in order and are in the correct size, from experience, we know that this will most likely NOT be the case. Clients can upload images that are not of the correct size and arrange them randomly. You may need to cater for this, e.g. have the clients tag the images with first, second, etc....but that may be too much work. OK, for the fun part. Please note that in the examples below, I only focus on the images' container part. I have also left in the CSS just for reference, although they may be auto-injected as stated above. We have at least two ways to loop through our images. Both ways involve having an array that will have 4 nested arrays, one each for our 4 images. The first way to loop through our images is to loop through the images themselves and access the array with images info inside this loop as shown below: The main downside to the above approach is we are assuming there will always be four images in the images field. What if a client adds more? What if there are less images? All these will require adding checks in the code (within the loop) to check how many images we have. To counter some of these challenges, we can instead loop through the array with the info for images as shown below: This is just basic code to get you started. There are a number of things that could be improved. For instance, you may want ProcessWire to resize the images for you (done once) rather than depending on your browser to contain larger images. See the Resize and crop section in the API documentation here. There are alternative approaches as well to the examples shown above. PS: code untested2 points
-
2 points
-
Tracy Debugger for ProcessWire The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger Modules Directory: http://modules.processwire.com/modules/tracy-debugger/ Github: https://github.com/adrianbj/TracyDebugger A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.1 point
-
Hi all. Just thought I'd add the updated site I made for the Judo/BJJ club I run. For some odd reason I decided I wanted to try making a single-page website but still use ProcessWire's great page management tools. The site uses the excellent Template Engine Twig module (slightly modified to work with Twig 3) and dynamically builds itself using the page tree (no hard-coded sections). I'm no great designer, but using the above along with Bootstrap 4 and some probably-excessive animate-on-scroll effects I think it looks clean enough to differentiate itself from more standard martial arts websites. Anyways, you can visit the site at http://jkma.club and hopefully enjoy!1 point
-
Done! ? - donation button in GitHub repo, forum signature and initial SnipWire forum post. (I hope this is not against forum rules?)1 point
-
A great module that works absolutely fine out of the box but I am not happy having the SMTP password in plain text in the database. Is there maybe a reason I am just not getting why this is necessary?1 point
-
The session cookie is unique to a browser session, and seldom used without you holding more information about the user, which by my impression does fall in the definition of personal data how gdpr defines it: https://gdpr-info.eu/art-4-gdpr/ But as I said the gdpr doesn‘t explicitly demand banners. It demands that users are informed about the usage of the data (privacy documents).1 point
-
This looks amazing, thanks for your effort and your transparency in developing this module. Please make it very obvious how to donate or contribute to the project in whatever way is helpful ?1 point
-
It does, it's just not documented unfortunately. I linked to information about it in my earlier post above. Here is a demo... Page structure: Field settings for subcategory field: "page.category" will be replaced with the ID of the page selected in the Category inputfield in Page Edit, whenever that field changes. The "has_parent" part is just to avoid unwanted pages appearing in the Subcategory inputfield if the Category inputfield is changed to empty (no page selected). Result:1 point
-
Here's an example that works without having to first save & re-load the page you're editing. The setup: In my page tree somewhere (usually under a parent I call "meta", "settings" or similar), I have main and sub-categories as pages: The sub category pages have template "empty" with just the title field and nothing else - not even a physical template.php file. The main category pages have tpl "maincat", which holds an addtl. field "main2sub", which is a page reference field. Here you map your sub-categories to each main category. My (simplified) product tpl has two fields: maincat -> page reference field single. Parent = main cat / 1366 select_categories -> page reference field multiple / output as checkboxes. No configuration set in field settings "selectable pages". So far, so boring. I need JS + PHP for the auto-switch to happen. I created site/templates/admin/admin.js In order for PW to even load it, I edited site/templates/admin.php: $config->scripts->add($config->urls->templates . "admin/admin.js"); require($config->paths->adminTemplates . 'controller.php'); // this must stay as the last line admin.js looks like this: It's written in plain JS (ES6). With jQuery it would have been a bit shorter, no doubt, but I got into the habit of using as much vanilla JS as possible. If you need to support older browsers, you'd need to run it through something like Babel. In nearly every PW installation, I create a dedicated template + page that acts as an API / AJAX endpoint. Create a new template "api", enable URL-segments, create a file "api.php" in site/templates/, and finally create a hidden page somewhere that uses this template. Use the option "must have trailing slashes" (check yes). The api.php looks something like this: Basically, what happens, is: On page load and on main-category-dropdown change, I send an AJAX request to my API script with the page ID I'm currently editing and the main category page id. The API script then sends back the matching sub-categories as JSON. JS again then loops through all checkboxes, and de-activates and hides all non-matching choices. It works, but it's not perfect*. I wish PW had an in-built way to handle such scenarios. As always, YMMV. * There's a split second on page load where you see all sub-categories. And also, when you select again the same main-category (without having saved the page), if you made selections previously, they're being erased. The first (minor) issue could probably easy be prevented if you set your subcat field to closed. You could first do your JS-syncing and at the end make them visible with Inputfields.open. Speaking of Inputfields JS API... I found that Inputfields.reload() didn't work here in my example (I tried several types of fields). Pity - would have made such a thing much easier...1 point
-
ProcessWire 3.0.149 on the dev branch includes various improvements and a few minor fixes. Here are the most significant differences relative to 3.0.148 master: There have been several improvements to the $notices API variable as well as a significant refactoring of the code. Several new flags are now supported and can be specified by name rather than just by bit mask. While these updates won’t matter much for front-end site work, they are going to be helpful for the admin as well as potentially in other modules that work in the admin. Some of the updates are still a work in progress, so more will likely be added in the near future. (Commit) The Comments Fieldtype and related classes have received upgrades as well. (Commit) Several new API methods have been added for handling the parent/child relationships involved in threaded comments. The ProcessCommentsManager has also received major upgrades and it puts these new API functions to use by now allowing you to change which page a comment lives on (move a comment from one page to another), as well as change which comment another one replies to. Lots of refactoring was done in this module as well. (Commit) A minor but useful detail in AdminThemeUikit: if you click in the search box (top right corner) and don’t immediately start typing, it now suggests that you try typing “help” for options. Since this is an English word, the “help” term can also be translated in the AdminThemeUikit files (_search-form.php file). PW’s admin search engine can do quite a bit more than I think people realize at first, so I thought this was one way to help more people see what the options are with it, at least in AdminThemeUikit. (Commit) There were several other minor updates as well, but the above are the ones that I thought were the most interesting. Thanks for reading and have a great weekend!1 point
-
One other small thing - can you add support for the built in 'title' field in the Page type? I tried this locally editing the getBuiltInFields() function at line 41 in src/Type/PageType.php Thanks, Tom1 point
-
1 point
-
For anyone wanting to trace how it is that Pages::trash is called twice... Pages::trash (first call) calls PagesTrash::trash, and when the "save" argument is true (as it is when trashing via the admin) then Pages:save is called, which calls PagesEditor::save. And if that saved page is in the trash then Pages::trash is called (second call) with the "save" argument false. As to whether this second Pages::trash call is necessary and correct, I don't know. Best thing is to hook Pages::trashed as suggested above - this method only fires if the page is successfully trashed, which is probably what is wanted in most cases.1 point
-
@sodesign Ok, I think I found the problem. I was able to get the same error as yours and patched the module to fix it, just now. Try the latest version and let me know if the issue is resolved for you. New Release 1.1.4 - Fix FieldtypePage bug when FieldtypePage:derefAsPageOrNullPage option is enabled.1 point
-
@sodesign First, I want to clarify some stuff. You are saying that you want to create a page and using a mutation field "createConfiguratorQuote" but supplying it with "ConfiguratorQuoteUpdateInput" which is an incorrect input type. You should supply "ConfiguratorQuoteCreateInput" for creating and "ConfiguratorQuoteUpdateInput" for updating a page. The "add" and "remove" for page references always expects an array of ids. So your latest format for variables is correct for creating a page. Just change UpdateInput type to CreateInput type. But, if you're trying to update a page then "page" input variable should include "id" field. It should look like this... variables: { "page": { "id" : 11111, // <=== you should tell which page you're trying to update. "name": "test-quote", "title": "Test Quote", "parent": "22905", "colour": { "add": [10392] } } } Let me know if I'm missing something.1 point
-
https://processwire.com/api/ref/page/get-unformatted/ $timestamp = $page->getUnformatted('event_start');1 point
-
of() is a method of Page objects, but you're trying to use it on an PageArray of Repeater pages. Try: // Get the page you want to work with $home = $pages->get("template=home"); // Turn output formatting off for the page $home->of(false); // Change the Repeater field value $home->submissions->removeAll(); // Save the page $home->save();1 point