Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/29/2018 in all areas

  1. I think mods should split all of the replies to another topic. To save @pwired some time on Bolt CMS investigation, this is talking about the backend: https://docs.bolt.cm/3.6/internals/javascript-css-build#css-bootstrap-and-custom-scss "The CSS is based on Bootstrap 3.3.7, with our own theming and custom styles added to that" You can see at the end of this all the JS and CSS dependencies of the backend: https://github.com/bolt/bolt/blob/3.6/app/src/grunt/concat.js In the frontend you have to use Twig templating. I would like to continue this conversation in a split topic as I am curious to know, why pwired had no problem with jQuery UI being in the backend for ages even though it is very much a CSS framework as well.
    6 points
  2. Thanks, changing it to this worked: $this->wire('files')->compileInclude(wire('config')->paths->root . 'talk/init.php', array('includes'=>true,'namespace'=>true,'modules'=>true,'skipIfNamespace'=>true)); I guess it was a different combination of options else it wanted them to be named (likely the latter now I look at it more closely). Got there in the end - thanks guys! P.S. you've just both helped me do a better forum member integration for the new PW website by the way ? Making two very different scripts play nice was NOT easy!
    5 points
  3. Hi @MarcoPLY, First, apologies I have not had the time to resolve your other issue. I agree. Yes it is possible and that is the approach I have taken and currently working on. All orders have 'payment status' and 'fulfilment status'. Padloper will ship with some common status and shop admins will be able to create custom ones. Examples include: Payment Status: abandoned, paid, pending, refunded, etc Fulfilment Status: pending, cancelled, shipped, delayed, invoiced, exchanged, etc. Some will be set automatically, e.g. order paid will set 'paid' status. I'll write more about this later but it is possible to filter abandoned carts like this: // all abandoned carts $abandonded = $pages->find("template=order,payment_status=$abandonedStatus"); // by specific user $abandonded = $pages->find("template=order,order.payment_status=$abandonedStatus,order.customer_id=1100"); // by cart amount $abandonded = $pages->find("template=order,order.payment_status=$abandonedStatus,order.total_price>100"); // by cart quantity $abandonded = $pages->find("template=order,order.payment_status=$abandonedStatus,order.total_quantity>5"); Remember we will have a possibility to create discounts for customers who abandoned their carts. This is how we'll be able to identify them (depending on the point at which they abandoned their carts). Customers/Users Regarding users, I'll be seeking feedback from your guys. My current thinking is that all customers are users. There will be an option to require login for all purchases, or both login (registered users) and guest checkouts allowed. For registered users will be able to login and manage their account, track past orders, etc. As mentioned in the previous posts, they will stay in the frontend all the time. For guest checkouts, we still need to store at the very least their names and email addresses as well as postal addresses if shipping a physical item to them. In both cases, we do not store credit card details. I don't want to go there, at least now. This is where I need the input of devs. How would you like customers to be handled? I thought about creating a separate customers 'system' but the idea seemed a bit silly since ProcessWire can already handle users. Registered users will have a role, e.g. customer or registered-customer whereas guest customers will have role 'guest-customer'. Guest customers will not be able to login since they will not know their login name. I'm not sure whether the system should auto-generate a cryptic name or base it on their first and last names. We'll also generate a secure password for them. They just won't get sent this information. For registered customers, they'll be able to change their passwords (we'll use the Login/Register module). Any thoughts? Data protection issues? Security?
    5 points
  4. @mntob Yes, it's possible. Take a look at Selectors docs. https://processwire.com/api/selectors/ Your selector shoud be like template=itemProduct1ingle|itemProduct2ingle, sort=-created
    5 points
  5. @theoretic Actualy there are two options for writing selectors as associative arrays and reqular arrays. https://processwire.com/blog/posts/processwire-3.0.13-selector-upgrades-and-new-form-builder-version/#selector-engine-array-support
    4 points
  6. This probably needs to happen inside an autoload module's constructor as module init / init.php is likely too late. Wire() is already available at that time. Here's a little PoC snippet: public function __construct() { $this->addHookBefore("Session::init", function(HookEvent $event) { // fill the data backpack with whatever you extract from the // external session: $this->wire('dataBackpack', ["some" => "thing"]); }); $this->addHookAfter("Session::init", function(HookEvent $event) { foreach($this->wire('dataBackpack') as $k => $v) { // set the retrieved data as session properties: $event->object->set($k, $v); } }); }
    4 points
  7. It sounds to me as if your struggle is not with ProcessWire, but with JavaScript, specifically, JavaScript + Ajax, rather than ProcessWire + Ajax. It doesn't matter what profile is being used in ProcessWire. The only thing that $config->ajax does it to detect whether an Ajax call has been sent. It returns a Boolean; true if Ajax call made to the receiving 'file' (i.e. your template file or page) or false if not. Nothing more. The parameters you send with your Ajax call are up to you. The JS framework/library you use or vanilla JavaScript you use to make the Ajax call are up to you. ProcessWire will not care :-). An Ajax call will hit the server as either a GET or POST request, so you handle it accordingly. The rules for what files/URL you can ping (I can't find the relevant posts at the moment) still apply. If you ping an ADMIN URL, ProcessWire will reject that get/post. If you ping a standalone php file within one of ProcessWire's protected folders, ProcessWire will reject that get/post. So, you can either send your request to the current page and let it include your standalone file or make your standalone file a template file of a template and ping a page that uses that template, etc. Assuming you've sent your Ajax call to a valid 'url', you can handle things server-side like any other input. You validate and sanitize the data. If you have to send user input back to them, make sure you parse it through $sanitizer->entities(). I know you said you are frustrated by the 'Google-about-Ajax' suggestions, but I will tell you the same. A good tutorial/intro to Ajax would probably cost you about 30 minutes of your time :-). If you already have jQuery, use it to make life simpler (I know,... the JS purists here are groaning ;-)). OK, to some quick example if($config->ajax) { # 1. process input variables sent via Ajax $author = $sanitizer->text($input->author);// a parameter/variable 'author' was sent by ajax // validate $author here if(!$author) // error handling here //$email = $sanitizer->email($input->email);// just an example $volumes = (int) $input->volumes;// some integer input # 2. find requested books by the named author $books = $pages->find("template=book,name=$author,volumes>=$volumes,limit=20"); $results = array(); if($books->count) { foreach($books as $book) { $results[$book->id] = array('title'=>$book->title,'year'=>$book->year,'volumes'=>$book->volumes,'co_authors'=>$book->co_authors->explode('title')); } } # 3. prepare output to send back as JSON response to Ajax call if(count($results)) $results['message'] = 'success'; else $results['message'] = 'fail'; # 4. send JSON output back to client browswer echo json_encode($results); exit;// or ProcessWire halt() if applicable } // no ajax else { } You then handle the $results JSON in JavaScript, as you wish. PS: written in browser and not tested.
    4 points
  8. Maybe we should be marketing ProcessWire as "The original headless CMS"
    3 points
  9. Not sure if this helps? https://processwire.com/api/ref/wirefiletools/compile/ In $options, see skipIfNamespace
    3 points
  10. You want an updated video? But I remember it when it was nearly new! *checks video date, feels old* ? I had a similar experience to others - I was looking for a CMS that could meet my non-standard requirements - I remember seeing the site and some of the docs back then and being confused. Fortunately I came back to it a few weeks later and finally watched the video and that sold it to me instantly.
    2 points
  11. As a customer I wouldn't be too happy when I chose to order as a guest and there is an account created in the back-end kinda secretly. Lets say the customer after a guest order wants to create an account and the system errors with a message: you already have an account. Imho the only customer data as a guest should be on the invoice/order. Registered users I would prefer as regular PW users with a role indeed.
    2 points
  12. You can process the queue by calling a script manually, from a seperate cronjob or for example from LazyCron. <?php $modules->get('IftRunner')->processQueue(); // Or if you want to specify how many queues must be executed you can also set a maximum $max = 5; // or whatever how many you want to be executed $modules->get('IftRunner')->processQueue($max);
    2 points
  13. [offtopic] just wanted to mention that always when I log into a site with an older version of tracy I realize how much better the new not-so-colored theme is, thanks for that @adrian and @tpr ?
    2 points
  14. You might find what you need in this post: https://processwire.com/talk/topic/19024-selector-arrays-with-page-reference-fields-with-and-not-or/
    2 points
  15. @modifiedcontent here you go with a very simple example using jQuery (but it's different for all javascript frameworks or vanilla javascript... I'm using the default profile for the example: home.php <?php namespace ProcessWire; if($config->ajax) { $content = "content loaded via ajax @ " . date('d.m.Y H:i:s'); } else { $content = $page->body . renderNav($page->children); } $sidebar = '<button id="loadrandom">load random page</button>'; _main.php: add this before your </head> <script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> <script> $(document).ready(function() { // add an event listener for the click event on #loadrandom button $('#loadrandom').click(function() { // check your console if everything works console.log('button was clicked'); // use the load() method to replace the current content // of div#content by the content of div#content that is // returned from an ajax request to the current url ./ $('#content').load('./ #content'); }); }); </script>
    2 points
  16. Agree on all the above ? This video is really great - and even if it was rebuilt I think it should be linked nearby. 8 years later and the foundation and principles are still the same and more trendy than ever before. Just awesome!! Headless as a totally new concept?! Bore me more ?
    2 points
  17. I have never seen this video before. How did I miss it!? Anyway, watched it in full. Great stuff! Yeah; had that thought when watching the video Forgetting the GUI for a minute, one thing that hit me was that I'd still choose ProcessWire now in 2018 if it was still at version 2.0. You can't beat the underlying architecture, philosophy and approach. Even 8 years later, ProcessWire is still API-centric. It's amazing though how much further along ProcessWire has come since ?
    2 points
  18. Attention: This is the thread for the archived open source version of RockPdf. This module is neither developed any further nor maintained nor will it get any fixes. Modules Directory: https://modules.processwire.com/modules/rock-pdf/ Download & Docs: https://github.com/BernhardBaumrock/RockPDF Please see the new version here:
    1 point
  19. Jumplinks for ProcessWire Latest Release: 1.5.63 Composer: rockett/jumplinks ⚠️ NEW MAINTAINER NEEDED: Jumplinks is in need of a new maintainer, as I’m simply unable to commit to continued development. Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa. The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them. Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation. As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run. Documentation View on GitLab Download via the Modules Directory Read the docs Features The most prominent features include: Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy: Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Open Source Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
    1 point
  20. wireshell 1.0.0 is out See Bea's post -------- Original post ----------- Now this one could be a rather long post about only an experimental niche tool, but maybe a helpful one for some, so stay with me Intention Do you guys know "Artisan" (Laravel) or "Drush" (Drupal)? If not: These are command line companions for said systems, and very useful for running certain (e.g. maintenance, installation) task quickly - without having to use the Admin Interface, first and foremost when dealing with local ProcessWire installations. And since it has a powerful API and an easy way of being bootstrapped into CLIs like this, I think such a tool has a certain potential in the PW universe. It's totally not the first approach of this kind. But: this one should be easily extendable - and is based on PHP (specifically: the Console component of the Symfony Framework). Every command is tidily wrapped in its own class, dependencies are clearly visible, and so on. ( Here was the outdated documentation. Please visit wireshell.pw for the current one )
    1 point
  21. DEPRECATED If you are interested in the new version (commercial module launching in 2023) write me a PM --- Some of you might have followed the development of this module here: https://processwire.com/talk/topic/15524-previewdiscussion-rockdatatables/ . It is the successor of "RockDataTables" and requires RockFinder to get the data for the grid easily and efficiently. It uses the open source part of agGrid for grid rendering. WHY? ProcessWire is awesome for creating all kinds of custom backend applications, but where it is not so awesome in my opinion is when it comes to listing this data. Of course we have the built in page lister and we have ListerPro, but none of that solutions is capable of properly displaying large amounts of data, for example lists of revenues, aggregations, quick and easy sorts by the user, instant filter and those kind of features. RockGrid to the rescue ? Features/Highlights: 100k+ rows Instant (client side) filter, search, sort (different sort based on data type, eg "lower/greater than" for numbers, "contains" for strings) extendable via plugins (available plugins at the moment: fullscreen, csv export, reload, batch-processing of data, column sum/statistics, row selection) all the agGrid features (cell renderers, cell styling, pagination, column grouping etc) vanilla javascript, backend and frontend support (though not all plugins are working on the frontend yet and I don't plan to support it as long as I don't need it myself) Limitations: While there is an option to retrieve data via AJAX the actual processing of the grid (displaying, filtering, sorting) is done on the client side, meaning that you can get into troubles when handling really large datasets of several thousands of rows. agGrid should be one of the most performant grid options in the world (see the official example page with a 100k row example) and does a lot to prevent problems (such as virtual row rendering), but you should always have this limitation in mind as this is a major difference to the available lister options that do not have this limitation. Currently it only supports AdminThemeUikit and I don't plan to support any other admin theme. Download: https://gitlab.com/baumrock/FieldtypeRockGrid Installation: https://gitlab.com/baumrock/RockGrid/wikis/Installation Quikckstart: https://gitlab.com/baumrock/RockGrid/wikis/quickstart Further instructions: https://gitlab.com/baumrock/RockGrid/wikis/quickstart#further-instructions German Translation File: site--modules--fieldtyperockgrid--fieldtyperockgrid-module-php.json Changelog: https://gitlab.com/baumrock/FieldtypeRockGrid/raw/master/changelog.md Module status: alpha, License: MIT Note that every installation and uninstallation sends an anonymous google analytics event to my google analytics account. If you don't want that feel free to remove the appropriate lines of code before installation/uninstallation. Contribute: You can contribute to the development of this and other modules or just say thank you by testing, reporting issues and making PRs at gitlab liking this post buying me a drink: paypal.me/baumrock/5 liking my facebook page: facebook.com/baumrock hiring me for pw work: baumrock.com Support: Please note that this module might not be as easy and plug&play as many other modules. It needs a good understanding of agGrid (and JavaScript in general) and it likely needs some looks into the code to get all the options. Please understand that I can not provide free support for every request here in the forum. I try to answer all questions that might also help others or that might improve the module but for individual requests I offer paid support (please contact me via PM). Use Cases / Examples: Colored grid cells, Icons, Links etc. The Grid also has a "batcher" feature built in that helps communicating with the server via AJAX and managing resource intensive tasks in batches: Filters, PW panel links and instant reload on panel close: You can combine the grid with a chart library like I did with the (outdated) RockDataTables module:
    1 point
  22. 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
  23. This one keeps annoying me, so I wonder if I'm the only one having this problem: Whenever I mention someone in the Forum with the @ feature the editor somehow breaks and does not work properly any more. I just can't enter new paragraphs any more. Shift+Enter still works (making 2 <br> instead of one new <p>) but sometimes the only solution is to reload the window... It seems that this problem also occurs when I click on the name instead of selecting it with the keyboard (arrow down, then enter or tab). Can anybody confirm this? Or is there a hidden trick to make it work? Thx! --- Testing: Selection with keyboard + Enter @ryan // worked Selection with keyboard + Tab @ryan // does not work any more. Don't know why... maybe because I removed the @ryan mention part?! I'll reload the window Next try after reload (keyboard + tab): @ryan // worked @ryan This time I used the mouse to click on it and got this error:
    1 point
  24. I know that there is not only ONE answer to a question. Maybe we have to not see this feature as a "This is the answer" but instead as an "This is an useful answer". StackOverflow was my reference also, because you can upvote multiple answers. Users would know that upvoted answers would/could work. I don't know much about the setup of the forum software, if you can enable the voting function for specific threads or not. Even if not, I do not see why support threads for example should not have an upvote option for useful answers, because of what I mentioned before. I really think, that upvoting answers would help everybody, because most times you (me) are searching for a solution in the forum/thread for hours and find many different solutions, try them out after once, and maybe one solution works. But you have to scan through the whole thread to get the correct one. There also is much bulk/clutter between the question and the answer, which may be a little bit off-topic, asks new questions or something else. I think everybody of us, had this problem more than once, right?
    1 point
  25. Thanks for the insight. I think I'll let Padloper take a passive role on this. Shop admins will decide what data they deem 'required' and what data is optional. Padloper will store what they want to be stored.
    1 point
  26. 1 point
  27. I think this is something that @tpr needs to take care of in AOS, but if someone know better, please correct me. @bernhard Yesterday I tried to replicate this but couldn't. Have you modified z-index in tracy, or have set sticky header in aos?
    1 point
  28. Yeah, actually I just wrote to my notes about why PW is great: Headless got innovative and trendy in 2018, PW works like this for several years now and is extremely mature.
    1 point
  29. Won't find the time to implement this anytime soon, sorry. Everybody feel free to submit a PR regarding this and maybe ping core contributor @justb3a regarding release
    1 point
  30. Not sure yet. I want to balance ease-of-use/user-friendliness and flexibility. I wouldn't want shop admins bothering about roles/permissions, at least not directly. We could maybe prefix our roles and permissions with pad-. If ProcessWire allows it, then OK. I seem to recall such a discussion but I don't know what became of it. Thanks. We still have some time ?
    1 point
  31. Currently I use customer for registered customers, so I prefer that one. Will these names be configurable? How about usernames based on email address? WP/Woo does that too. I'm very busy this week but I will be happy to get back to these around the weekend.
    1 point
  32. @mntob I would like to request adding a [SOLVED] to the title of this thread. This helps others who are looking for working solutions and if an answer is still needed or not. Thank you ?
    1 point
  33. @adrian I tried such hook (without conditions) on PW 3.0.105 and TD 4.10.22 and it works as expected. I got 360 dumps. So, yes, probably it is somehow relative to new tabs in dump panel. wire()->addHook("Page::path", function($e) { bd($e); $page = $e->object; $e->return = "/{$page->name}/"; });
    1 point
  34. I've just moved it down to the function without anything popping up in error log. Load is down by 90% at least, site speed has improved dramatically as well. I'd suggest you really look into this asap ?
    1 point
  35. Use either of the the Go buttons at the bottom in conjunction with the dropdown and then, selecting 'Go back to this page'. This will reload the edit screen BUT not save the data as long as you haven't made any changes directly in phpMyAdmin. Unfortunately, the 'Go back to this page' does not seem to stick if you leave and come back to the edit page. PS: You can also resize columns :-). PS2: For connecting to remote DB, I've not come across anything that beats HeidiSQL. Locally I use phpMyAdmin, but Heidi for all remote connections.
    1 point
  36. Try Adminer instead: https://www.adminer.org/ It's only one file. phpmyadmin feels bloated compared to it.
    1 point
  37. 1 point
  38. I see, so you're packing the dependencies alongside the composer autoloader and including the autoloader on a per-module basis. That's certainly self-contained, very good solution for sites that don't use composer. Though it does mean dependencies can't be reused across modules. I guess there's something to be said for both approaches. Maybe I can put out a little module that provides a wrapper through the composer library (once it's published) so it can be installed through the Processwire GUI and called through the Processwire API. First I gotta get around to finishing it though ^^ I have started to use Composer for my latest two Processwire projects; it's a pretty simple setup, I just put the composer.json and vendor folder one directory above the webroot and then include the autoloader in the init.php file. This way it's no overhead at all, I can just use any libraries I want to and don't need to worry about anything else. Of course I have to update the composer dependencies independently from the modules, but that's just a few CLI commands away. Maybe I'll write a short tutorial for that too :)
    1 point
  39. Maybe because the topic was intended to share a github repo about cool projects around the uikit framework. It was never ment to be a discussion thread about different css frameworks. PW is open to everything, and therefore anybody can choose its favourite. So everybody please come back to topic or open a new one related to discussion about css frameworks. Thanks.
    1 point
  40. did you set the enclosure field in the module settings; i know the module says you can set it from the api, just wondering what effect that has; also make sure the feed is not cached...
    1 point
  41. Having a compile step in software does allow for optimizations in the deployed endproduct, which just wouldn't be possible without it. To run that compile step for javascript one simply needs node, because e.g. a browsers runtime is even harder to get hold of. CKEditor is by it's functionality already tending to be a big package and it really needs to optimize every inch in it's package to save on download times and other performance critical parts of itself. That's the nature of anything you ship directly to the browser of your users. Part of that is modularizing code, so every bit of unused code can just be excluded from the shipped build. The downside of compile steps is that you often cannot directly hack on the end product anymore or it's way harder to do so. But would you rather have a hackable product, which performs worse for your endusers because of missing optimizations or a product, which requires you to setup a build environment, but builds a optimized package, which is not hurting your user's perceived performance. This is not to say node is super great. It does what I described above in a often super (and maybe unnecessary) complex way, but I wanted to give a bit of argumentation on why we see that trend.
    1 point
  42. Hey @thetuningspoon I just tried your suggestion about the WireArray/WireData... It's awesome ? I did it a little differently though, because my RockGrids don't work the way you implemented it. v1.0.9 introduces a new method: $finder->getWireArray(); This will return a WireArray containing WireData objects just as you suggested: For anybody wondering what this update could be used for: You can use all the pw api magic on that objects: New version is on GitHub - I'll change my public projects to github to have the PW modules directory automatically in sync: https://github.com/BernhardBaumrock/RockFinder/commit/46377ba6ea399f8557893684da3c3dd486b2c44e
    1 point
  43. A bit of an update after some more experimentation tonight. I added pages.templates_id as a field always selected in the RockFinder results, and then attempted to use the $pages->newPage() method to take the results of the SQL query and convert them into a PageArray of Page objects. This worked, thus eliminating that second trip to the database I mentioned (and also bypassing the page cache and probably some other nice features of the normal page creation process). Unfortunately, this slowed the whole thing way down again. So I'm thinking now that it is something else about constructing Pages that is slow. Maybe generating the page path or some other properties are the problem. Perhaps I need to load up some additional fields up front. Will have to test more. WireData/WireArray works great, though.
    1 point
  44. We recently finished a relaunch of our agency website: https://www.meuter.de/ Features: Minimalistic and modern design Page transitions and preloading for a really fast browsing expierence Custom content builder for blog posts, references and subpages Content is king: Many case studies and blog posts Under the hood: Webpack with ES6 and SCSS LQIP with Base64 Images Lazy loading with lazysizes Automatic generation of scrset images, Base64 placeholder images and background positions Page transitions with barba.js Preload pages when user hover over link Interactive components which reacts on scroll events. Built with ScrollMagic Handwritten template Modules used: ProFields Markup Sitemap XML Video embed for YouTube/Vimeo Our Content Builder for a reference: Clean page structure: The code for the image generator: <?php // ------------------------------ // Image modifications // ------------------------------ /** * Responsive Image Options */ class imageModifier { // Responsive Sizes from lowest to highest private $responsiveSizes = array(320,640,768,1024,1366,1600,1920,2560); private $base64ImageWidth = 20; private $imageOptions = array( 'upscaling' => true ); // Return a string with the srcset information public function getSrcSet($image){ // Create an emptry output string $srcSetOutputString = ''; // Create each image for each size foreach ($this->responsiveSizes as $responsiveSizeId => $responsiveSizeWidth) { // Check if the image is bigger then the final size if($image->width >= $responsiveSizeWidth){ // Create the image and put the url into the output string $srcSetOutputString .= $image->width($responsiveSizeWidth, $this->imageOptions)->url; // Put the width in the output string $srcSetOutputString .= ' ' . $responsiveSizeWidth . 'w' . ','; } } //When the original image is smaller then the highest quality if($image->width < $this->responsiveSizes[count($this->responsiveSizes) - 1]){ // Create the image and put the url into the output string $srcSetOutputString .= $image->width($image->width)->url; // Put the width in the output string $srcSetOutputString .= ' ' . $image->width . 'w' . ','; } // Remove last commata $srcSetOutputString = rtrim($srcSetOutputString, ','); // Return the srcSet information return $srcSetOutputString; } //Returns the lowest quality image public function getLowestQuality($image){ return $image->width($this->responsiveSizes[0]); } //Returns the highest quality image public function getHighestQuality($image){ // if image is bigger or same than max quality if($image->width >= $this->responsiveSizes[count($this->responsiveSizes) - 1]){ return $image->width($this->responsiveSizes[count($this->responsiveSizes) - 1]); } // When image is smaller then the highest quality else { return $image; } } // Returns the base64 data string public function getBase64($image){ // Get the image path $imagePath = $image->width($this->base64ImageWidth)->filename; // Get the image extension $imageType = pathinfo($imagePath, PATHINFO_EXTENSION); // Get the data of the image $imageData = file_get_contents($imagePath); // Create the base64 Code $base64Code = 'data:image/' . $imageType . ';base64,' . base64_encode($imageData); // Return the code return $base64Code; } // Returns the position point public function getPosition($image){ // Get distance from top $distanceTop = '' . intval($image->focus()['top']); // Get distance from left $distanceLeft = '' . intval($image->focus()['left']); // Return the position with percent return $distanceLeft . '% ' . $distanceTop . '%'; } } Thanks for the community and Processwire. It is a joy to use ?
    1 point
  45. News Update - 10 October 2018 I know many of you are eagerly awaiting the next version of Padloper. I thought I'd give you a couple of updates regarding progress. First, I'd like to thank you for the feature requests and your support. As previously stated, it will not be possible to accommodate all requests and those that may be accommodated may have to wait till other releases. OK, to the update. The following have so far been achieved. FieldtypeProducts A new Fieldtype for storing products including their variants, if any. This allows for easy retrieval and storage of data and and API that makes it easy to filter, search, manipulate, update, etc product details. So..: $foo = $products->find("colour=red,quantity<10"); $bar = $product->first(); echo $bar->size; echo $bar->price; // etc Discounts We have a new discounts class that allows for 4 types of discounts each with generic and specific requirements. Percentage discount Fixed amount discount Free shipping discount Buy X Get Y discount In turn, as applicable, the discounts are subject to generic conditions including customer country,named customers, customers subscribing to your newsletter, global usage, customer usage limits, customers who abandoned carts, start/expiration dates, etc. There are also discount-specific conditions including whether to apply discount to entire order, specific products or specific categories/collections, minimum requirements (purchase amount or quantity of eligible products in cart), etc. Import/Export Products This class allows for importing products into your shop as CSV, JSON or arrays. It is 98% done. It will also allow for exporting products as CSV (and maybe in future, as JSON, if there is demand). MarkupPadloper This is WIP to eventually replace PadRender. This allows for retrieving products, product tags, product categories, etc, either as ready-to-render (i.e. includes the markup) vs retrieving the raw product details so one can use their own markup, anywhere, anyhow, to output products. Other A bit of work on customer notifications (including email templates) and FieldtypeOrders for orders plus some other stuff. I got a lot to do, so I better get cracking! ? Thanks for reading.
    1 point
  46. You should check your template file and all include-files (_init.php, _func.php or whatever you use). As the error msg says: you are re-declaring a function somewhere. With a good IDE you should be able to search across all files and spot it easily.
    1 point
  47. Updated to Version 1.0.3 with one more Inputfield Option which allows to use any custom JavaScript.
    1 point
  48. If RemoveButton is not false then show the button: <?php if (!$single->RemoveButton) : ?> <p><a button href="<?= $single->url ?>" type="submit" id="submit" class="btn btn-blue btn-effect"><?=$single->Text?></button></a></p> <?php endif; ?>
    1 point
×
×
  • Create New...