Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 06/09/2020 in all areas

  1. 11 points
    We have created a module to create BlurHash strings for images while uploading in ProcessWire. This blurry images will be saved in the database because they are very small (20-30 characters) and can be used for Data-URL's as placeholders for image-lazy loading. https://github.com/blue-tomato/ImageBlurhash E.g. where we use this in production: https://www.blue-tomato.com/en-INT/blue-world/ https://www.blue-tomato.com/en-INT/blue-world/products/girls-are-awesome/ https://www.blue-tomato.com/en-INT/buyers-guides/skateboard/skateboard-decks/ https://www.blue-tomato.com/en-INT/team/anna-gasser/
  2. 4 points
    This works for me: $store->getUnformatted('products');
  3. 3 points
    We recently launched The Power Supply Shop, an e-commerce store built using a combination of ProcessWire and SnipCart. The site has in excess of 120,000 products and variations, making heavy use of page references as well as SnipCart's "any page can be a product" approach. The site pulls in its data from an external MS SQL database several times a day. At a glance, the site uses: ProCache - as well as WireCache for some heavy product listing pages (50k+) FormBuilder @adrian's Tracy Debugger A modified version of @Soma's Ajax Search @mtwebit's fantastic Tasker and DataSet modules. And that's about it on the module front. For other libraries we're only really using FancyBox.js for product galleries and Anchorific.js for guide pages. At present the site is geared towards the UK, but if and when this changes I'm looking forward to delving into multi-languages with ProcessWire, something I haven't really worked with yet!
  4. 1 point
    Hi all, I just added the ability to restrict access to custom FieldsetTabs which makes it easier to block certain user roles from having edit access to entire sets of fields (in the selected tabs). I also added a new "Exempt Roles" setting that makes it easy to make sure certain roles are not affected by this module - particularly useful if you use the "View" permissions approach.
  5. 1 point
    It’s having a weird conflict with the multiple pageField.title in the selector. If I have one and name, it works fine, if I have multiple without name it works fine. If I have multiple AND name it throws an error referenced here:
  6. 1 point
    On the same page you've linked: https://processwire.com/blog/posts/pw-3.0.142/#how-to-setup-and-use-custom-fields-in-file-image-fields basically the "trick" is to use a template without a file named matching the name of your image/s field (eg. field-images where "images" is the name of your image field). Ryan explains it way better in the post btw.
  7. 1 point
    Thanks Jonathan. This is actually the first version of the store outside of online marketplaces. I've had the misfortune of using WooCommerce in the past on a site with a large catalogue of products and variations, it wasn't the slightest bit enjoyable! The beauty of ProcessWire is that I could define the PW templates/fields around the existing data, whereas an off the shelf e-commerce product would have required everything to be re-structured to meet the criteria of what it defines a 'product' as, or otherwise rely on another third-party service like Zapier which becomes expensive when daily tasks run into the thousands and feels like an unnecessary step. I really buy into the separation of CMS and e-commerce, and ProcessWire is the perfect framework for that.
  8. 1 point
    That's the thing that isn't possible due to the circular reference issue with "single" Page Reference fields. My suggestion: make one of your Page Reference fields a "multiple" field, even if you are only going to store a single page in it. That way you can use Connect Page Fields and your job will be a lot simpler. You won't need to use PHP to define the selectable pages so you'll be able to use the Page Autocomplete inputfield. Instead you can use a selector string to define the selectable pages and identify pages that not selected by another user with a string like "selected_by_user.count=0" where selected_by_user is a Page Reference field. If your user pages are only managed by superuser then you don't need to do anything special with the inputfield - it won't matter if it technically allows multiple pages to be selected because you'll know to only select a single page. Or if others need to manage the users and you think they'll be confused if the inputfield allows multiple selections then you can limit the number of selectable pages with a hook: $wire->addHookAfter('InputfieldPageAutocomplete::renderReadyHook', function(HookEvent $event) { /** @var InputfieldPageAutocomplete $inputfield */ $inputfield = $event->object; $field = $inputfield->hasField; if($field && $field->name === 'colour') { $inputfield->maxSelectedItems = 1; } }); And of course the value of this field will be a PageArray but you can get the selected page by using the first() method.
  9. 1 point
    I realise this module is deprecated but it is in use on a site I'm working on. I needed to add a RM2 field into a repeater and it didn't work due to the unique nature of repeaters. A little hack to RM2 Inputfield module solved 2 problems at once. The Inputfield works in repeaters AND the repeater item ID is accessible in the parent page via the $session var. <?php /** * Set the field content from the file with the same name */ public function ___getContent() { $out = ''; // get file $name = $this->name; /****** hack - breaks on repeater fields ******/ if (strpos($name,'_repeater') !== false) { // it's in a repeater field $ary = explode('_repeater', $name); $name = $ary[0]; // save the repeater item ID with the original fieldname as the key for future use wire('session')->set($name, $ary[1]); } /****** end of hack - breaks on repeater fields ******/ $file = $this->main()->getFile($name); if(!$file) return "No file found for field $name"; // if a value was set return it if($this->value) $out = $this->value; else { // otherwise try to render the file try { // get page object $page = $this->page; if($this->process == 'ProcessPageEdit') { $page = $this->process->getPage(); } // get markup $out = $this->files->render($file->path, [ 'inputfield' => $this, 'rm' => $this->rm, ], [ 'allowedPaths' => [$file->path], ]); } catch (\Throwable $th) { $out = $th->getMessage(); } } return $out; } It's a bit rough but it works for me and maybe this tip can help others working with repeater fields.
  10. 1 point
    I did try this and couldn't make it work - wasn't sure if something special about repeaters? Just want to call this repeater and include the all of them even if hidden/unpublished. $store->products->sort('title'); I did also try: $pages->find("template=repeater_products,sort=title,include=all"); but nada 😞
  11. 1 point
    @bernhard, maybe something like https://marketplace.visualstudio.com/items?itemName=wwm.better-align ?
  12. 1 point
    Hi devs, Only personal annual plans are eligible. Details: https://blog.jetbrains.com/phpstorm/2020/06/php-turns-25/ And don't foget: https://sales.jetbrains.com/hc/en-gb/articles/207240845-What-is-a-perpetual-fallback-license-
  13. 1 point
  14. 1 point
    Looks great! Cool background on the modals as well. I love seeing PW sites with a vast amount of nested pages with relationships between them as it really shows the power of the system. I cringe when in WordPress land people say "I need a catalog, not an ecommerce site, so let me bring in Woocommerce for that." 🤦‍♂️ Total overkill and loss of flexibility. ProcessWire's got that handled as this site demonstrates, and Snipcart finishes it off. It seems like is this was on a different ecommerce platform previously? If so, what lead to it being re-developed? Any other background you can share?
  15. 1 point
    v0.0.11 adds support for repeater matrix fields 🙂 Thx to @aComAdi of https://www.a-commerce.ch/ for sponsoring this update! 😎 $rm->setMatrixItems('your_matrix_field', [ 'foo' => [ 'label' => 'foo label', 'fields' => ['field1', 'field2'], ], 'bar' => [ 'label' => 'bar label', 'fields' => ['field1', 'field3'], ], ]);
  16. 1 point
    Hey @Sebi have you thought of registering $twack as API variable? // in your module $this->wire('twack', $this); // in any template // no need for $twack = $modules->get('Twack'); $general = $twack->getNewComponent('General');
  17. 1 point
    In terms of making the core smaller, can the old admin system (ie, the contents of /wire/templates-admin/ I believe it is) be done away with? The admin that looks like this: https://i.ytimg.com/vi/eq-9GQCT0lw/maxresdefault.jpg
  18. 1 point
    Yes, I can imagine it would be complex. I think ExpressionEngine did it by means of an inline group-by. For instance: <li class="whatever" groupby="datacolumn"> And then there was a sort-by also: <li class="whatever" groupby="datacolumn" sortby="whatever">
  19. 1 point
    I often use jsdelivr as free javascript CDN. They also offer the files for this slider on their CDN at https://www.jsdelivr.com/projects/flickity Only for those who are interested in. Advantage: you can combine multiple js files from this CDN into one - so only one request will be made Best regards
  20. 1 point
    Hello again. Thought i share my way of creating sliders in my ProcessWire websites, by using the images field type and some HTML, JavaScript, CSS and a pinch of love. Step One: Go to http://flickity.metafizzy.co/ and download Flickity slider. They also have a CDN option for thoose who prefere that. Also have the page handy cause it has alot of usefull info for configuring the slider and such. Note: In my example i use jQuery to initialize Flickity but you can use it without, see the website for more info. So you need to load jQuery before flickity in the header section for my example to work. Step Two: Here is an example of how you could write some code and HTML for your template file where the slider should render. This code assumes your images field is named images. <div class="slider-container"> <?PHP /* check if there is any images to display */ if(count($page->images) > 0) { /* render out the images and resize to 700 pixel width */ foreach($page->images AS $key => $image) { echo('<img src="' . $image->width(700)->url . '" class="slider-container-item" alt="' . $image->description . '">'); } } else { echo('<p>Houston we have a problem...there are no images to see here...</p>'); } ?> </div> Also lets put together some simple CSS for our container and items. Alter it to your own needs and preference. For the Flickitys sliders default CSS and configuring see the website. .slider-container { position: relative; display: block; overflow: hidden; width: 100%; max-width: 700px; padding: 0; margin-bottom: 15px; clear: both; } .slider-container-item { position: relative; display: block; width: 100%; height: auto; max-width: 700px; } Step Three: Put the default CSS and also Flickitys JS files and load jQuery before Flickity in the header of your site so that flickity works as intended. Or use the CDN option mentioned on the flickity website. <link rel="stylesheet" href="/path/to/flickity.css" media="screen"> <script src="/path/to/jquery.js"></script> <script src="/path/to/flickity.pkgd.min.js"></script> Don´t forget to put the Flickity JavaScript initalization code at the bottom of the template file. For all the Options and configuration see the website: http://flickity.metafizzy.co/ In the example code below i use just a few of the many options. <script type="text/javascript"> /* initiate Flickity Slider JS */ $(document).ready(function(e){ $('.slider-container').flickity({ // options cellSelector: '.slider-container-item', cellAlign: 'center', imagesLoaded: true, percentPosition: true, contain: true }); }); </script> Note: This is my prefered way of doing it. But there are alternative ways to initialize Flickity if you read the info on the website. This should be enough to get you started. And with a little imagination i think you could see the potential. Good luck with all your Slider making dreams
  21. 1 point
    I also know what you're saying, but I have to strongly disagree. I could've write this in any other similar thread. The problem is the code posted in a wysiwyg is "horrible" to read and even copy it. Then after this is working (as with 1000 other code here in the forum), there comes the next who takes this code but need another feature.. then the game start again with same story same code but different bugs issues. What I would like to do is helping how to code and debug, not have 1 million snippets that are sometimes very bad coded and not complete best practice or not even working spooking around the forum. It already happened many times and it will get worse by time. I know what you're wanting to do and I understand, but in the long run what we are practicing here since 2 years is very bad for newcomers. We better this energy and time to help with little tutorials and snippets that are good to start with in a dedicated site/place.
  22. 1 point
    Soma, You are removing all my excuses for not learning how to code modules. Dangit.
×
×
  • Create New...