Jump to content

Gadgetto

Members
  • Content Count

    295
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Gadgetto

  1. 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.
  2. 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.
  3. 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.
  4. 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?
  5. 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?
  6. 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?
  7. 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;
  8. 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;
  9. 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?
  10. You probably have disabled "Auto file compiler"?
  11. 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.
  12. It's hard to tell without getting more informations. The second call will only work inside a class. The first one should work. Where did you place your template file? Did you add the ProcessWire namespace to your template file? Could you provide a little more code?
  13. No problem, 🙃 I know the uninstaller needs some work to be perfect. Uninstalling a shop system and such a huge plugin is nothing trivial. Page<->field<->template dependencies needs to be resolved and you need to be very careful to prevent unintended deletion of your whole products catalogue and templates. I'm just thinking about a "fire-and-forget" uninstaller which can only be called via URL param...
  14. Thank you @dragan, very constructive critic! Sorry you didn't like SnipWire... There is a single page under admin > setup which has the system flag (I decided to use the system flag because if this page is deleted SnipWire won't work). I just have not yet implemented the uninstall routine for this special page in the beta. #todo If you have a look at the docs: https://docs.bitego.com/snipwire/getting-started/install-uninstall/ the following is stated: All other SnipWire components are uninstalled perfectly here (just tested)!
  15. UPDATE 2020-02-08 SnipWire 0.8.2 (beta) released! Its now possible to change the cart and catalogue currency by GET, POST or SESSION param via form submit or by adding an URL param or setting a session variable!
  16. I don't know your setup for the frontend templates and what you changed in the samples, but if you use the plain "Regular" site profile from PW installation it should work like in the screenshots. I decided to use the "Regular" profile for the samples because it has easy understandable templates and the most modern output strategy. Also with its replaceable markup regions, it was very easy to implement a shop interface without changing too much. SnipWire is built with the ProcessWire philosophy: To be as flexible as possible and to absolutely let the site developer decide what will be outputted in the front-end.
  17. You need to activate the field "Product is stackable" otherwise there will be added a separate item each time you click the "Add to cart" button.
  18. It should be no matter which output strategy you use.
  19. Great! Just let me know if you need some help in using SnipWire as the docs are in the early stages at best... 😀
  20. Hi @dragan, this is a front-end problem: The sample templates, which come as an additional installation, are based on the Regular site profile which is based on Markup regions output strategy and UIKit CSS framework. ukIcon is a function in _uikit.php which is part of the regular site profile. If you are using another profile or output strategy, you'll need to adapt the template source. If you like to run a quick test - just install PW using the "regular" profile.
  21. Hey @bernhard, this is not the problem. In front-end we could set the currency via POST, GET or SESSION or even via a API call $snipwire->setCurrency('usd'); But I'd like to set a parameter for MarkupSnipWire so that the module internally uses the desired currency for output rendering.
  22. I'm just struggling with a problem regarding my MarkupSnipWire module (which is a part of SnipWire) and maybe I can get some hints here. MarkupSnipWire is an autoloader module which - amongst other things - writes CSS and JS output required by Snipcart on page render. One of the required JS params is the currency in which the Snipcart shopping cart should run. By default it uses the "first" currency from SnipCarts module config. I now want to implement a kind of "currency switcher" which should allow to (as the name says) switch the currency from within a ProcessWire template on the fly. So MarkupSnipWire should be able to receive the currency string (ISO 3 letters) and internally switch the used currency formats. What would be the best method to send a param to an autoloader module? If you have a look at the module code you can see there is a renderCSSJS method which is triggered by a hook after pager render in init(). https://github.com/gadgetto/SnipWire/blob/3d7af17a37fb20dcdd4038cd99339ecb704e5aef/MarkupSnipWire/MarkupSnipWire.module.php#L154 When this method is called, the $this->currency property already needs to be set. A setCurrency method is already available! The goal is to let a developer use the SnipWire API variable in his templates like this: $snipwire->setCurrency('usd');
  23. UPDATE 2020-02-03 SnipWire 0.8.1 (beta) released! This update mainly serves to move all custom classes into their own namespaces! This should fix the annoying class naming conflicts with other modules. Its now time to put some effort into the SnipWire docs!
×
×
  • Create New...