Jump to content

Gadgetto

Members
  • Posts

    394
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Gadgetto

  1. Hi Marco, SnipWire supports multi currency. The taxes handling is very flexible: you could either use Snipcart's own taxes handling, an external taxes provider (like TaxJar) or the custom taxes provider of SnipWire (which has the most flexible taxes handling when it comes to shipping taxes calculation). Starting with 2021 there will be new tax rules in Europe! In simplified terms, the VAT from the customers country must be charged (this is already the case when you sell digital products!). This means that a shop system must reliably determine the country of the customer. This is currently not supported by SnipWire but will be in a future version! Nevertheless, some of the external taxes providers implemented by Snipcart already supports this kind of taxes handling. Hopefully this clears things up a bit! -- Martin
  2. Definitely! Unfortunately Snipcart v3 still isn't feature par with v2. As soon as this is the case I'll implement v3 APIs! I think I know what happened, so I've pushed a fix to the dev branch on GitHub: https://github.com/gadgetto/SnipWire/tree/dev Could you please test if this works now and let me know?
  3. Thanks for your kind words! Implementing a custom payment gateway is definitely possible with Snipcart. It’s quite a bit of work and depends on the API the payment provider offers. EDIT: sorry, only possible with Snipcart v3. As v3 isn’t feature complete, SnipWire currently only supports v2. As far as I know is PayPal also working in Chile! Which other gateway did you have in mind? — Martin
  4. Yep, is enabled! On smaller displays (my MacBook) the 2 bars are overlapping sometimes, but it's great to have this possibility!
  5. This is great, didn't even know this exists! I always have problems with bd() within modals or panels and when a redirect is involved!
  6. UPDATE 2020-04-06 SnipWire 0.8.6 (beta) released! This update adds support for Snipcart subscriptions and also fixes some problems: Finished subscriptions dashboard section Added support for Snipcart subscriptions Added necessary fields for subscription products Added debug output for webhooks request payload data Updated MarkupSnipWire to output subscription data-item-* tags Fixed deletion of segmented caches Fixed display of empty image field in product details Fixed a problem with namespace in Countries.php Fixed a problem with duplicate SKU check on page save Fixed [#3] Installer error: Can’t save page 0: /custom-cart-fields/: It has no parent assigned Please note: The additional fields required for providing subscription based products are automatically installed with this update! You need to create a new template (best is to use the snipcart-product template as a base) and add these fields manually. Snipcart subscriptions are only supported when using the Stripe payment gateway!
  7. @Craig I submitted your report to GitHub issues in SnipCart repo: https://github.com/gadgetto/SnipWire/issues/3 You can follow the fix there!
  8. You are right @bernhard. And I didn't even know I could set selectors via array! I'm still scratching on the surface of ProcessWire... Code refactoring will be done when the module is in a stable state and I've implemented all necessary features.
  9. @bernhard, @dragan, Thanks a lot guys, I could fix it! It now runs bombproof - this is the final code: public function checkSKUUnique(HookEvent $event) { $snipwire = $this->wire('snipwire'); if (!$snipwire) return; $page = $event->arguments(0); if ($snipwire->isProductTemplate($page->template)) { $field = $page->getField('snipcart_item_id'); $sku = $page->snipcart_item_id; // SKU field value if (!$sku) return; // <- ###### only had to add this line if ($page->isChanged('snipcart_item_id')) { $exists = $this->wire('pages')->get("snipcart_item_id=$sku, id!=$page, status<" . Page::statusTrash); // <- ###### and change this line if ($exists->id) { // value is not unique! $error = $this->_('SKU must be unique'); $exception = sprintf( $this->_('SKU [%s] is already in use'), $sku ); $inputfield = $page->getInputfield($field); $inputfield->error($error); throw new WireException($exception); // Prevent saving of non-unique value! } } } }
  10. What I'm not sure about is: If I create a new page with the page editor, the creation process is split into 2 steps. In the first step you enter the title + name. Then you hit "Save". In the second step you can complete all other page fields and options. Are the other page fields (beside title and name) already available for API in first step? Probably not. So my test code from last post could work with "title" field but not with the other page fields?
  11. OK, here is the simplified code for testing in site/ready.php with "title" field used: // To test, add this to your sites/ready.php wire()->addHookAfter('Pages::added', 'presetTitleField', ['priority' => 99]); wire()->addHookAfter('Pages::saveReady', 'checkTitleUnique'); function presetTitleField(HookEvent $event) { $page = $event->arguments(0); $page->setAndSave('title', 'Test' . $page->id); } function checkTitleUnique(HookEvent $event) { $page = $event->arguments(0); $field = $page->getField('title'); $title = $page->title; if ($page->isChanged('title')) { $exists = wire('pages')->get("title=$title"); if ($exists->id) { // value is not unique! $error = __('Title must be unique'); $exception = sprintf( __('Title [%s] is already in use'), $title ); $inputfield = $page->getInputfield($field); $inputfield->error($error); throw new WireException($exception); // Prevent saving of non-unique value! } } } And thanks for the hint to extend the Page class with a new method!
  12. Thanks @bernhard, before I asked for help here, I searched for related information back and forth but couldn't find any relevant infos. The search results from your screenshot also didn't bring any light into this... ?
  13. This looks promising! Thank you. The problem is, I can't use this new class in my module as the PW version requirement is set to 3.0.148. I could borrow the code from this class and build my own method. This would require to rewrite a lot of code instead of getting the hooks working properly.
  14. Yes, I know this field type, but I don’t want to use third party modules in my module.
  15. Hi there, I'd like to prevent duplicate values in a specific page field (FieldtypeText) across all pages. The hook should also prevent saving of the page if a duplicate value is detected. Therefore I created two hook methods but I can't get it to work properly. Here are both hooks placed in init() method of an autoloader module: The first hook is to initially preset the field with the page id. The field value can be customized by the admin before saving. The second hook should check if the value is unique. If I create a new page and try to save, the WireException is already triggered in first step of page creation, where you enter the page title: SKU [] is already in use If I check the value of $sku (with Tracy) it's always empty! Any idea what could be wrong? EDIT: if I remove the second hook, the field value is correctly preset with the page id! $this->addHookAfter('Pages::added', $this, 'presetProductFields', ['priority' => 99]); $this->addHookAfter('Pages::saveReady', $this, 'checkSKUUnique', ['priority' => 101]); And this are the hook methods: public function presetProductFields(HookEvent $event) { $snipwire = $this->wire('snipwire'); if (!$snipwire) return; $page = $event->arguments(0); if ($snipwire->isProductTemplate($page->template)) { if ($page->hasfield('snipcart_item_id')) $page->setAndSave('snipcart_item_id', $page->id); } } /** * Check if the SKU value is unique across all product pages. * (Method triggered after Pages saveReady -> just before page is saved) * * @throws WireException * */ public function checkSKUUnique(HookEvent $event) { $snipwire = $this->wire('snipwire'); if (!$snipwire) return; $page = $event->arguments(0); if ($snipwire->isProductTemplate($page->template)) { $field = $page->getField('snipcart_item_id'); $sku = $page->snipcart_item_id; // SKU field value bd($sku); if ($page->isChanged('snipcart_item_id')) { $exists = $this->wire('pages')->get("snipcart_item_id=$sku"); if ($exists->id) { // value is not unique! $error = $this->_('SKU must be unique'); $exception = sprintf( $this->_('SKU [%s] is already in use'), $sku ); $inputfield = $page->getInputfield($field); $inputfield->error($error); throw new WireException($exception); // Prevent saving of non-unique value! } } } }
  16. Nova definitely supports language server protocol and comes with a bunch of predefined languages! The built in PHP extension is a bit rudimentary (like in VSCode) but there will be IntelliSense extensions available.
  17. Hey there, hope you are all well! I would like to introduce Nova from Panic.inc, a new IDE and code editor for web developers. The application is developed natively for macOS and is the successor of Coda 2 (if you know it). I'm sitting here in my home office (because of Corona) and yesterday I got the invitation for the beta. Now I have been testing Nova for about 1 day. The application is incredibly fast! I haven't used anything comparable so far (including VSCode). The user interface is very clean and skinnable. Here is a small excerpt of the already integrated features (which of course can be extended by plugins): - Project management - Integrated Remote Publishing - Integrated Git Handling (Push, Pull, Commit, etc...) - Integrated Code Completion (PHP, JavaScript, ...) - Full featured integrated remote file browser for all thinkable protocols - Integrated web preview - Integrated console (local and remote) - Tasks (this seems to be huge! I'm telling you more when I figured out what this can do) - etc... This will definitely be my IDE for the next years! Nova is currently in closed beta. No new tester are accepted. But should be in open beta in the next few weeks! Have a nice week and stay healthy! Greetings, Martin
  18. Hi @creativejay, do you still have this issue? If so, could you please file an issue in SnipWires GitHub repo and provide more information: https://github.com/gadgetto/SnipWire/issues I could not reproduce this problem but I think I have too little information.
  19. UPDATE 2020-03-21 SnipWire 0.8.5 (beta) released! This update improves SnipWires webhooks interface and provides some other fixes and additions: Catch module settings access for non super users Fixes [#2] Dashboard not accessible for non SuperUsers Added documentation (php comments) to Webhooks class and hookable event handler methods All Webhooks event handler methods now have a return value (Snipcart payload) Hookable event handler methods: All hookable event handler methods will return an array containing payload Snipcart sent to your endpoint. In addition the following class properties will be set: $this->payload (The payload Snipcart sent to your endpoint) $this->responseStatus (The response status your endpoint sent to Snipcart) $this->responseBody (The response body your endpoint sent to Snipcart) (Use the appropriate getter methods to receive these values!) How to use the hookable event handler methods (sample): $webhooks->addHookAfter('handleOrderCompleted', function($event) { $payload = $event->return; //... your code here ... }); PLEASE NOTE: those hooks will currently only work when placed in init.php or init() or ready() module methods!
  20. Just placed the hook in init.php and now it all works! This is mysterious ...
  21. Good hint with Tracy log()! But I don't understand what you tried to say: You say everything works like expected but then the hook in ready() isn't triggered. So you are having the same problem as I do?
  22. I have written a small test module which simulates the required situation. Unfortunately the hook mentioned above does not work here either. I think I'll file an issue on GitHub. Here is a ZIP with the module files: HookTest.zip
  23. I'll try to write a small test case. Thanks again @bernhard!
  24. Could this be a bug in PW or is it intentional? Should I file an issue? Any ideas from the other pros here? I'm really stuck with this. ?
×
×
  • Create New...