Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/23/2019 in all areas

  1. Media Library uses pW image fields behind the scene. So in Setup->Fields you can search for the field which has the label 'MediaImages'. In the field settings, you can add 'svg' to the allowed file types. That should do the trick.
    3 points
  2. I hope that you have had a great week! I’ve been working hard on finishing up the LoginRegisterPro module this week and actually have it ready. But I’ve been told I have to get off the computer in 20 minutes, so so I think I’ll wait till Monday to release it. But I do have the new info page (which is kind of like last week's blog post) and new documentation page now online. The documentation page in particular is pretty comprehensive. In last week’s post there was a form to request more info once it’s released, so if you are interested in this module and haven’t filled out that form, please do. That’s how I’ll be sending out the introduction coupon code this time around, for those that want it. There have also been some core updates this week, but it was just a few commits, so not enough to warrant a version bump today. That’s actually a good thing, as no major new issues turning up means one step closer to merging onto the master branch. There will be a new master version before this year is done! Thank you for reading and I hope that you all have a great Christmas and/or holiday week next week!
    3 points
  3. I can't claim with a straight face that I would've wholeheartedly agreed with every single addition made during the past few years, but neither can I agree with this statement. The truth is that whenever I work with pre-3.x versions of ProcessWire, it reminds me just how much more powerful the system is now. Keeping the system evolving and maintaining the balance is a difficult task, and I think Ryan has done a terrific job in that regard. I guess my point is that more features doesn't automatically equal bloat. Sometimes more is just more: more options and more power. That's all.
    3 points
  4. I have solved this now with a second find since it are not much pages (102 since website launch in 2016). // Workaround $specificSpecialitiesFilteredByClinic = $pages->find("template=specialities-clinics, sort=title, choose_sender_2016={$rootParent->choose_sender_2016}"); $ids = ""; foreach($specificSpecialitiesFilteredByClinic as $speciality){ $ids .= $speciality->parent->id."|"; } $ids = rtrim($ids, "|"); $find = $pages->find("id=$ids, sort=title, limit=24"); KR Orkun
    2 points
  5. Thanks for posting the solution to your problem! To test if a full page object was returned by $pages->get() you can use if($category->id) {...} This is usually enough. When PW doesn't find a page it returns an object NullPage. This NullPage object returns null for id. So the simple test above is sufficient. Since you get your category and subcategory names from the urlSegments, you could test earlier in your code if these exist. If there is no urlSegment(1), $categoryName = $sanitizer->pageName($input->urlSegment(1)); will return an empty string. So you could test for that. I can recommend to start early on using the fabulous debugger module TracyDebugger. It makes dev life easier and can save a lot of time. I use it on every project. Also it is always goo to have the API reference open in a separate tab or browser window ?
    2 points
  6. Hi Gebeer! Thanks for the kind words! Indirectly that line indeed caused the problem. If you have a look at the two if-statements just above this line, you will see that I don't check if the values "$category->id" and "$subcategory->id" are set or not and if they are empty or not. With the faulty code the variable "$selector" in the line of code that you mentioned above is empty. That way, the products are not being loaded when a category is selected. This was problem 1. I've made a second adjustment. In my code I have renamed the template "products_categories.php" to "products.php". As an alternate template name for "products_categories.php" I have set "products.php". I don't really know if an alternate file name is necessary tough? That way I can easily grab a category and select all products linking to that category, I guess? The code that resolved my problem was the following: if(isset($category->id) && !empty($category->id)){ $selector .= ", products_categories=" . $category; } if(isset($subcategory->id) && !empty($subcategory->id)){ $selector .= ", products_categories=" . $subcategory; } Feel free to post any feedback. It's an interesting subject. Greetings.
    2 points
  7. Hi gebeer Thanks for the excellent suggestions! I am going to test these out immediately. In the meanwhile I've adjusted both of the if-statements. It's the little tips that make a lot of difference to me, thanks for that! As I'm gaining more and more experience, I am sure I will discover a lot of other small tips. Thanks again!
    1 point
  8. Thanks Horst. I created a test file with echo phpinfo() and found in the core table output the following listed as disabled: disable_functions shell_exec ,exec, system, popen, set_time_limit this for both local and master value columns in the table. i note your comments about switching or upgrading host! Paul
    1 point
  9. What a beautiful photo! As a father of four (ages 13, 11, 9 and 3), I know how important it is to make the time for family. Thank you for the time you have dedicated to ProcessWire. Have a great holiday!
    1 point
  10. I love the Christmas card. It's a good reminder that Processwire isn't just an incredibly useful collection of code for geeks, but is also a tool that allows people to provide for themselves and their families. I'm not sure how much my daughter understands what I do on the computer, but she does understand it helps pay for holidays and Lego amongst other things. ?
    1 point
  11. I also came from Joomla and was so happy to discover ProcessWire. It was a game changer for me. The good thing about PW is, that you can have all these things on demand as modules. So it is up to the developer to choose features they want to include on a site.
    1 point
  12. Hi everyone. I've just committed v2.0.0 of this module with some BREAKING CHANGES. The breaking change is the removal of the "Enable for API" option. After lots of discussion and testing with @Robin S's help we decided that it's best that this module doesn't handle renaming via the API - it's not really its intended purpose, but there are also too many complications when it comes to dealing with hooks that save pages. This has allowed me to simplify the module significantly as well as now all the renaming is done via JS which is more inline with how the PW core sets the page name when you initially title a page. This update also adds individual Exempt Roles settings for each of relevant settings, rather than the old overarching option. I have also done quite a bit of cleanup and refactoring, but all those should be taken of via the module's upgrade() method. That said, I still recommend taking a good look over the settings page to make sure it's still showing what you expect and that the module's behavior is still correct for your needs. Please let me know if you find any problems. Happy Holidays all!
    1 point
  13. Hey folks! I've been a bit quiet here, but that's mostly because I've been busy building stuff with ProcessWire and Wireframe ? Just wanted to give a quick heads-up for a new feature called components that I'm currently testing (it's in the dev branch of the module already), in case anyone wants to comment on it before it gets merged to the master branch. Wireframe components are classes extending an abstract base class (\Wireframe\Component), and they can either render output directly by implementing the render() method, or they can be rendered using a separate Component View file. This is probably a familiar concept to most, but the general idea is that while partials ("dumb" files with no way to process params, and no clean way to separate code from markup) are enough if you just have some relatively static snippet that you need repeatedly, components add an extra layer where you can a) specify which params they accept, b) process those params, and c) include any additional "business logic" that should be triggered when the component is rendered. Here's a simplified example of how this comes together: /site/templates/components/Card.php (class for the Card component) <?php namespace Wireframe\Component; /** * Card component */ class Card extends \Wireframe\Component { /** * Constructor method * * @param \ProcessWire\Page $item Page related to current Card. */ public function __construct(\ProcessWire\Page $item) { // Pass properties to view $this->title = $item->title; $this->summary = $item->summary; $this->image = $item->get('image|hero_image'); } } /site/templates/components/Card/default.php (default view for the Card component) <?php namespace ProcessWire; ?> <div class="card"> <?php if ($image): ?> <img src="<?= $image->size(640, 480)->url ?>" alt="<?= $image->description ?>"> <?php endif; ?> <h3><?= $title ?></h3> <?php if ($summary): ?> <p><?= $summary ?></p> <?php endif; ?> </div> ... and for fetching and rendering the component, there's a little static helper in the Wireframe module class: <?php foreach ($cards as item): ?> <?= Wireframe::component('Card', [$item]) ?> <?php endforeach; ?> Note that Wireframe::component() actually returns an instance of the component class, not a string, but since \Wireframe\Component::__toString() calls \Wireframe\Component::render(), what we're doing here is essentially the same as echoing out the result of (new \Wireframe\Component\Card($card))->render() ? So, anyway, that's basically what I've been working on here. I'd be happy to hear if you have any comments on this addition – I haven't yet merged it to master since I'm still experimenting with it, and I'd like to avoid as many breaking changes in the master branch as I can. So far this has worked great for me, but to be honest my requirements have been pretty basic. Thoughts?
    1 point
  14. To be fair PHP 7.4 has only been out for a few weeks. I'm not advocating sticking with old versions for any longer than is necessary, but as with most software, going with the cutting edge version of PHP is a bit of a risky move. I'd recommend giving it a few more weeks at least ?
    1 point
  15. With the help of @Noboru I could fix some bugs in the "Extended Resources" installer and with float values in prices. Some rare problems could be fixed and the installer is more stable now. A big problem is the integrated taxes-provider regarding shipping-.taxes. I'm in contact with the Snipcart team to make this as flexible as possible. This isn't easy as we have very different taxes system around the countries of the world.
    1 point
  16. Are you sure your hook gets triggered? Always proceed step by step. I usually start with a hook that only outputs "triggered" via tracy: bd("triggered!"); If you don't see the dump in the tracy bar, your hook does not fire and you have something else wrong (and that's the case here). Try this one and then update the inner code: $wire->addHookAfter('Pages::saveReady(template=product)', function($event) { $page = $event->arguments(0); // your logic here bd("hook fired!"); }); To update your field you don't need "setAndSave", just set your field's value like this: $page->yourfield = 'yourvalue'; That's it ?
    1 point
  17. You should extend your if clause to ignore pages that are in trash (which can also be saved) if ($page->template != "product" || $page->isTrash()) return;
    1 point
×
×
  • Create New...