Jump to content

Gadgetto

Members
  • Posts

    383
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Gadgetto

  1. Hang in there and stay healthy!
  2. Austria 2020-03-13 14:00: 361 Covid-19 cases, 1 dead. Starting with coming Monday all shops (except grocery stores, post office, banks, gas stations and similar) closed, schools closed! Some ski areas under complete quarantine. Borders closed. People are hoarding shops. It's really creepy! This is how I imagine the beginning of the Zombie Apocalypse! But our neighbor country Italy is hit much harder: about 15.000 cases, more then 800 dead! Hold on through people!
  3. What would be the benefit of making a custom helper class a module?
  4. I’ll have a look at this! BTW, could you please file your issues on SnipWires GitHub repo? it is hard to keep the overview here in the forum.
  5. I just read you’d like to use subscriptions feature? Subscriptions are not yet supported by SnipWire.
  6. Do you have a hook on path method of PagefilesManager class? I’ll try to reproduce this behavior, but I’d need more infos. Could you please send me the complete stack trace of the exception? You can use TracyDebugger for this. How does your product template look like?
  7. Hi guys (didn't see any gals here), I have a module which has some custom helper classes. One of these classes has methods which are hookable. The class is derived from WireData. An additional complication is that this class has its own namespace. What would be the correct way to provide the hookable methods via API? Here is a very simplified code sample of the class: <?php namespace SnipWire\Services; use ProcessWire\WireData; use ProcessWire\WireException; class Webhooks extends WireData { ... public function ___handleOrderCompleted() { if ($this->debug) $this->wire('log')->save( self::snipWireWebhooksLogName, '[DEBUG] Webhooks request: handleOrderCompleted' ); $this->responseStatus = 202; // Accepted } public function ___handleOrderStatusChanged() { if ($this->debug) $this->wire('log')->save( self::snipWireWebhooksLogName, '[DEBUG] Webhooks request: handleOrderStatusChanged' ); $this->responseStatus = 202; // Accepted } ... } The class itself is invoked/used by a hook from within the main module: Depending of the event, one of the methods of the Webhooks class above is triggered. A developer should now be able to use one of the ___handle* methods to do further things. /** * Check for webohook request and process them. * (Method triggered before ProcessPageView::execute) * */ public function checkWebhookRequest(HookEvent $event) { if ($webhooksEndpoint = $this->get('webhooks_endpoint')) { if ($this->sanitizer->url($this->input->url) == $webhooksEndpoint) { /** @var Webhooks $webhooks Custom ProcessWire API variable */ $this->wire('webhooks', new Webhooks()); $this->wire('webhooks')->process(); $event->replace = true; // @note: Tracy Debug won't work from here on as normal page rendering is omitted! } } } Should I provide a custom API variable e.g. $webhooks? Or how is the best way to do this?
  8. @creativejay I must admit, now I've gotten myself into a bit of a mess. Unfortunately, most of the hookable methods are not yet ready. I am currently working on the final implementation. Sorry, you'll have to be patient. i’ll let you know when it is ready.
  9. Hi @creativejay, you can hook into SnipWire‘s predefined webhook methods. Please have a look into the Webhooks class starting at this lines: https://github.com/gadgetto/SnipWire/blob/8d38ced82bbfc5633a3d6de7cae6217fcd408c39/services/Webhooks.php#L312 For creating/importing products it would be best to write a small importer using the PW API which creates SnipWire (ProcessWire) pages.
  10. UPDATE 2020-03-03 SnipWire 0.8.4 (beta) released! This update improves compatibility for Windows based Systems (thanks @bernhard for your help!)
  11. Thanks @bernhard, problem solved! I decided to use the "convert field type" method.
  12. UPDATE 2020-03-01 SnipWire 0.8.3 (beta) released! In this new release the installation and uninstallation process has been heavily revised! The module and its submodules should now uninstall perfectly. To preserve the full products catalogue and products data, all fields with the custom field type FieldtypeSnipWireTaxSelector are now converted to FieldtypeText on uninstall. If yo want to reinstall SnipWire and reuse your previous products catalogue, you simply need to change the taxes field back to FieldtypeSnipWireTaxSelector. Here is the complete list of changes: Updated products package installer to add specific module config on install The uninstallation process is now much more reliable FieldtypeSnipWireTaxeSelector is now uninstalled properly (existing fields are converted to FieldtypeText) Refactored ExtendedInstaller class to be more reliable Extended resources installer page is now more user friendly Fixed product price JSON output if a currency field is missing Small fixes and code enhancements Updated apexcharts.js vendor plugin to version 3.15.6
  13. I still have no idea on how to handle this problem within my module (SnipWire) properly. The main module comes with 3 required sub-modules and one of them is a custom field type. The custom field type has dependencies in helpers classes of the main module. What should I do if someone tries to uninstall the main module but the custom field type is still in use? Should I prevent uninstallation of the complete module package? Or let the user uninstall the main module but only let the custom field type installed (which would lead to problems because of the dependencies)? One idea is to convert the field which uses the custom field type to a simple text field when the custom field type is uninstalled.
  14. Yep, I know. Therefore I'd like to use your hook you posted above to prevent an uninstallation mess. Currently, if someone uninstalls my module and the FieldType submodule is still in use the uninstall process is interrupted and parts of my module stay installed. Your code snippet seems to handle exactly this. I just wanted to know in which module to place this hook. Sorry, I just had a chat with @bernhard and confused your post with bernhard's.
  15. I'm developing a module which comes with 3 other integrated (and required) modules. On of them is a custom selector FieldType which gets its data from a helper class within the main module. The problem is if one wants to uninstall the main module but wants to preserve the pages which uses the custom selector FieldType, the uninstallation process is interrupted as this FieldType is still in use. I first thought to simply let the FieldType installed (standalone), but it has dependencies in a helper class which won't work when main module is uninstalled.
  16. Hmm.. my FieldType module (and the two other submodules) isn't based on the main module so it seems I need to place the hook into the FieldType module?
  17. I see you placed the hook into the main modules init method. But how is this hook triggered when someone tries to uninstall the submodule?
  18. Hi @bernhard, I have the same situation and just stumbled across your post here! Great solution! Where do I setup this hook? In main module or the submodule?
  19. If you are using the separate ModuleConfig class method you can use it like this: // Get module config. // (Holds merged data from DB and default config. // This works because of using the ModuleConfig class) $moduleConfig = $this->wire('modules')->get('ModuleName'); // You can than access the keys like this: $value = $moduleConfig->name_of_key;
  20. If you are using the separate ModuleConfig class method you can use it like this: // Get module config. // (Holds merged data from DB and default config. // This works because of using the ModuleConfig class) $moduleConfig = $this->wire('modules')->get('ModuleName'); // You can than access the keys like this: $value = $moduleConfig->name_of_key;
  21. I'm developing a module which comes with 3 other integrated (and required) modules. On of them is a custom selector FieldType which gets its data from a helper class within the main module. The problem is if one wants to uninstall the main module but wants to preserve the pages which uses the custom selector FieldType, the uninstallation process is interrupted as this FieldType is still in use. I first thought to simply let the FieldType installed (standalone), but it has dependencies in a helper class which won't work when main module is un installed. Do you have an idea how to solve this? Should I eventually convert to another Fieldtype (e.g. FieldTypeText) while uninstalling this? Is this even possible?
  22. You probably have disabled "Auto file compiler"?
  23. Hey, @bernhard, sorry for my late response! Just stumbled across your post. Thanks for your hints! I've updated the installer page to clearly state which resources will be installed and why the extended installer is necessary and why it's a good idea to backup. I also put a lot of effort into the install/uninstall process and greatly improved the thing.
×
×
  • Create New...