Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Gadgetto last won the day on May 15

Gadgetto had the most liked content!

Community Reputation

127 Excellent

About Gadgetto

  • Rank
    Sr. Member
  • Birthday 10/05/1966

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Mattersburg / Austria

Recent Profile Visitors

379 profile views
  1. I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer). The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire. Here are some highlights: simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months. I'm not sure yet if this will be a "Pro" module or if it will be made available for free. I would be grateful for suggestions and hints! (please have a look at the screenshots to get an idea what I'm talking about)
  2. @Macrura I just stumbled across this interesting older post. Since I'm currently working on a module that accesses an external REST API, the topic of caching is very interesting. I use WireCache to cache the REST queries and am currently working on improving performance. I stumbled across preloadFor. Does anybody have a code example which shows how preloadFor can/should be used to improve performance? This is a sample how I'm currently using WireCache: public function getSettings($key = '', $expires = WireCache::expireNever, $forceRefresh = false) { if (!$this->getHeaders()) { $this->error($this->noticesText['error_no_headers']); return false; } if ($forceRefresh) $this->wire('cache')->deleteFor('SnipWire', self::cacheNameSettings); // Try to get settings array from cache first $response = $this->wire('cache')->getFor('SnipWire', self::cacheNameSettings, $expires, function() { return $this->getJSON(self::apiEndpoint . self::resourcePathSettingsGeneral); }); return ($key && isset($response[$key])) ? $response[$key] : $response; }
  3. That's what I'm doing currently. I thought there should be a more elegant way. If I try to access a module property via $this->my_property ProcessWire should decide whether the value comes from the database (if available) or from the defaults.
  4. @horst This makes sense. I'm using the MyModuleConfig.php Class method to handle module configuration. If accessing module config via $modules->getConfig('MyModule') I only get config from db. If module configuration settings aren't at least saved once I get the following results: $this->config_key --> 'DEFAULT VALUE' $data['config_key'] --> null (key doesn't exists) @ryan says in his blog post regarding "ProcessWire 2.5.5 – New module configuration" https://processwire.com/blog/posts/new-module-configuration-options/ I thought this should be handled automatically? Where is the best place in MyModuleConfig.php Class to merge defaults with db values? In constructor? Think I still don't understand module config behavior fully ...
  5. Hi, while working on 2 new configurable modules (with a lot of config settings) I encountered that the module config is not created/saved to db when the module is installed. You need to hit save to write the default config to database. This is a problem if I need some of these config values at modules runtime. Wouldn't it be better to save the default config values of the module on module install? Do I miss something here?
  6. Just implemented your solution and it works perfectly!
  7. @bernhard this is great! I already tried it with a hook before field render, but the problem was, it was always set to checked even when unchecked by user. I didn't know the setAndSave method.
  8. @bernhard I know how to set a value to an InputfieldCheckox but my problem is, I create a Field type=InputfieldCheckbox via API and assign it to a template. If a user creates a new page with this template, the checkbox should be checked by default.
  9. @ryan how can this be done while creating a field on API side? I tried "defaultValue = 1" property, but didn't work.
  10. Also from me a +1 for Checkbox checked by default property. I just need to set a "taxable" flag to true by default in an e-commerce module. Otherwise the store owner would need to go and check this checkbox for most products (only some of the products will not be taxable).
  11. Hi, I'm just experimenting with Markup Regions and have a question regarding conditional replacement of a region. Is this the right way to do the following: <?php if (!modules()->isInstalled('ModuleRequiredForRendering')) { ?> <div id="content"> <strong>ModuleRequiredForRendering</strong> module is not installed. Module is required to render this page! </div> <?php return; } ?> <div id="content"> // output content ... </div>
  12. Ok, thanks! Solved it like this: /** * Get all templates except system templates (name => label) * * @return WireArray $templates * */ public function getTemplates() { $templates = new WireArray(); foreach ($this->wire('templates') as $t) { if (!($t->flags & Template::flagSystem)) { $templates->add($t); } } return $templates; }
  13. Sorry, just stumbled across that older post searching for an answer regarding templates selectors... I'm looking for a method to select all templates except system templates. This part from your code above doesn't work here: $templates->find("flags!={template::flagSystem}") it could only get it to work like this: $templates->find('flags!=' . Template::flagSystem) But what's more important is: "flags" is a bitmask value, is it OK to simply compare it in a selector?
  14. Hi @kongondo, I'm also using Intelephense and the only thing I added to my VSCode settings is this: "files.associations": { "*.module": "php" },
  • Create New...