Jump to content

Gadgetto

Members
  • Posts

    394
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Gadgetto

  1. The first one is the actual code. The assignment within a comparison is a legitimate usage. And yes, the second one is an empty array check. Is this not allowed in PHP 7? It works and throws no warning or error.
  2. I have a function which returns a WireArray of field names based on allowed field types. When I set $allowedFieldTypes to 'FieldtypePage' it doesn't return anything - although the template definitely has a field with this type. Setting $allowedFieldTypes to 'FieldtypeText' (or other existing field types) it works as expected. This is the method: /** * Get all fields from product template * * @param string $defaultFieldName * @param array $allowedFieldTypes * @return WireArray $fields * */ private function _getProductTemplateFields($defaultFieldName, array $allowedFieldTypes = array()) { $fields = new WireArray(); if ($productTemplate = $this->wire('templates')->get(MarkupSnipWire::snipcartProductTemplate)) { $fields = $productTemplate->fields; if ($allowedFieldTypes) $fields->filter('type=' . implode('|', $allowedFieldTypes)); } else { $defaultField = $this->wire('fields')->get($defaultFieldName); $fields->add($defaultField); } return $fields; } This call works: $allowedFieldTypes = array( 'FieldtypeText', 'FieldtypeTextLanguage', 'FieldtypePageTitle', 'FieldtypePageTitleLanguage', ); $productTemplateFields = $this->_getProductTemplateFields($defaults['data_item_name_field'], $allowedFieldTypes); foreach ($productTemplateFields as $ptField) { $f->addOption($ptField->name, $ptField->name, array()); } This not: $allowedFieldTypes = array( 'FieldtypePage', ); $productTemplateFields = $this->_getProductTemplateFields($defaults['data_item_categories_field'], $allowedFieldTypes); foreach ($productTemplateFields as $ptField) { $f->addOption($ptField->name, $ptField->name, array()); } Edit: If I remove the filter temporarily it returns all template fields including the field with type 'FieldtypePage'! Am I overlooking something? -- Martin
  3. This is also locale aware as floatval will return a float number with either a . (dot) or a , (comma) as decimal separator depending on your locale setting. This behavior is perfectly covered by $sanitizer->float. The problem is, I need a float sanitizer which always returns a float number with . as dezimal separator - but it shouldn't be a string which will be returned (so str_replace drops out)
  4. The current float sanitizer should have options like 'localeAware' (true/false) and 'decimalSeparator' (,/.)
  5. Hmm... 99.99 --> 99.9899999999999948840923025272786617279052734375 99,99 --> 99 990 --> 99 0.99 --> 0.9899999999999999911182158029987476766109466552734375
  6. Is there a sanitizer like $sanitizer->float($value) which is not local aware? I'd need return values which are float but always with . (dot) as decimal separator.
  7. FYI - @Noboru and I am just trying to solve the problem via PN chat (in German language). After I have fixed this, I'll post back the infos here!
  8. It’s hard to tell when the first release version will be ready. I’m currently struggling with the custom taxes provider which will allow a very flexible VAT handling for all countries worldwide. I’m in contact with the Snipcart team, because I’m having problems with shipping taxes ... When the taxes provider is finished, the biggest part is done and I should be able to release a first beta. And thanks for the hint with the donation button! ?
  9. @rick, @d'Hinnisdaël, @cb2004, @szabesz Thanks for your input! So the coming PW master version will be the minimum required by SnipWire. This will make things definitely easier for me...
  10. Regarding the CURL error in WireHttp - could you please provide the exact steps until the error occurres (starting from module installation? The other problem: The data-item-price property is definitely wrong. It should be 11.5 not 11,5. I’ll need to check the float sanitizer. What is your locale setting? BTW, Its really great to get SnipWire tested - this helps me a lot! Thanks @Noboru
  11. I have a general question regarding required PW version for my upcoming SnipWire module: SnipWire is a huge module which touches big parts of the PW core API. As a sample - only the WireHttp class had at least 10 fixes and improvements since v 3.0.123 which are mandatory for SnipWire to work properly. I'm planning to release the module with a minimum requirement of PW version around 3.0.148 (which should represent the coming master version). Do you think this is a good idea or should I stay at - let's say 3.0.123 and struggle with many workarounds to stay downwards compatible?
  12. @Noboru, I just tried to reproduce the problem but couldn't. I installed ProcessWire 3.0.147 on a fresh MAMP host and installed SnipCart on the naked system. Also installed the additional resources package from within SnipWire settings - and it worked like expected. Could you please provide more infos regarding your setup? PHP version, CURL version, additional installed modules, ...?
  13. Hi @Noboru I have a clue what's causing this problem. I need a little time. I'll contact you when I have fixed that. In the meantime you could comment out the following lines in file SnipWire.module.php (should be line 96-98) $this->addHookAfter('Pages::saved', $this, 'publishSnipcartProduct'); $this->addHookAfter('Pages::unpublished', $this, 'unpublishSnipcartProduct'); $this->addHookAfter('Pages::trashed', $this, 'unpublishSnipcartProduct'); -- Martin
  14. Thanks for your answers, guys! I think I will also only support the UIKit theme. This will make the development a lot easier and I can concentrate on more important features!
  15. Thanks for reporting back! I just published a new version on GitHub which has some great performance improvements and a lot of other new features! The orders list is now loaded in 1 - 1.5 seconds (instead of 4 seconds). The dashboard is also affected by these changes and should load much faster now!
  16. I am currently working on 2 large modules (SnipWire and GroupMailer). The further the development progresses the more complex it is to fully support the 3 main themes (UIKit, Reno and Default). What do you think: is it worth the effort or will the older themes soon disappear? Should I concentrate on UIKit only? How do you handle this with your modules?
  17. @Peejay, great! what would be interesting for me is: do you think that the performance in SnipWire dashboard/backend is OK or do I need to find another way to fetch Snipcart data? — Martin
  18. Hi @Peejay, did you run the Additional steps / Install Snipcart products package in SnipWire module settings? This step installs product templates, files, fields and some demo pages required to build a Snipcart product catalogue. This additional step is needed to prevent unintended deletion of your Snipcart products catalogue when main module is uninstalled. In the current alpha version this isn't yet checked by SnipWire. If you did already run the additional step with an earlier SnipWire version there will be fields missing which were added in a later version. So you will need to re-run this step. The missing resources(fields, templates, pages, ...) will then be installed. Existing ones won't be touched! To re-run this step, you will need to edit/remove a key in database directly: DB table: "modules" -> find entry with class "SnipWire" -> edit the "data" field and remove the Json key: "product_package":true (be sure to leave a valid Json string - you will need to also remove the corresponding comma : {"api_key":"YOUR_LIVE_API_KEY","api_key_test":"ODQzZTc1MjktZGQxNy00YmUzLWFkMWYtZDE3MDQ2YTk1ODNjNjM2ODE3NTg5NzUyNDQxOTc0","api_key_secret":"YOUR_LIVE_API_KEY_SECRET","api_key_secret_test":"","snipcart_environment":"0","single_page_shop":"","single_page_shop_page":1,"credit_cards":["visa","mastercard","amex"],"currencies":["eur","usd"],"show_cart_automatically":1,"shipping_same_as_billing":1,"show_continue_shopping":1,"split_firstname_and_lastname":1,"snipcart_debug":1,"snipcart_css_path":"https:\/\/cdn.snipcart.com\/themes\/2.0\/base\/snipcart.min.css","snipcart_css_integrity":"","snipcart_js_path":"https:\/\/cdn.snipcart.com\/scripts\/2.0\/snipcart.js","snipcart_js_integrity":"","include_jquery":"","jquery_js_path":"https:\/\/code.jquery.com\/jquery-3.3.1.min.js","jquery_js_integrity":"sha256-FgpCb\/KJQlLNfOu91ta32o\/NMZxltwRo8QtmkMRdAu8=","excluded_templates":["promailer-email","promailer-subscribe"],"cart_image_width":65,"cart_image_height":65,"cart_image_quality":70,"cart_image_hidpi":1,"cart_image_hidpiQuality":50,"cart_image_cropping":1,"data_item_name_field":"title","uninstall":"","submit_save_module":"Submit","taxes_included":1,"webhooks_endpoint":"\/webhooks\/snipcart","include_snipcart_css":1,"taxes":"[{\"name\":\"20% VAT\",\"numberForInvoice\":\"\",\"rate\":\"0.20\",\"appliesOnShipping\":[]},{\"name\":\"10% VAT\",\"numberForInvoice\":\"\",\"rate\":\"0.10\",\"appliesOnShipping\":[]},{\"name\":\"10% VAT (Shipping)\",\"numberForInvoice\":\"\",\"rate\":\"0.10\",\"appliesOnShipping\":[\"1\"]}]","snipwire_debug":1,"data_item_categories_field":"snipcart_item_categories","product_package":true} After the key is removed, visit the SnipCart module settings again and re-run the product package installer! In the release version of SnipCart, this will be handled automatically. On each update it will check if there are new fields or other resources to be installed. Hope this helps! p.s. You could also completely uninstall the SnipCart module and then reinstall - this should also activate the product package installer link! -- Martin
  19. UPDATE 2019-11-15 In the last 3 weeks I (nearly) finished the complete order handling for store merchants (ProcessWire backend). This includes the following features: search for orders filter orders extensive overview of all order details download of invoices resend invoices to customers refund amounts to customers ... all right from within your ProcessWire backend! That doesn't sound like much, but it was a good piece of work. ? Here is a short clip to demonstrate the new features:
  20. Thanks for the kind words! Snipcart has a lot of different discount features! Here is a cut out from my process module which should show what's possible: $this->discountsTypes = array( 'FixedAmount' => $this->_('Fixed amount deducted from order total'), 'Rate' => $this->_('Percentage rebate on order total'), 'AlternatePrice' => $this->_('Discount price provided by alternate price list'), 'Shipping' => $this->_('Discount on shipping'), 'FixedAmountOnItems' => $this->_('Fixed amount deducted on specified products'), 'RateOnItems' => $this->_('Rate deducted on specified products'), 'FixedAmountOnCategory' => $this->_('Fixed amount deducted on items of specified categories'), 'RateOnCategory' => $this->_('Rate deducted on products of specified categories'), 'GetFreeItems' => $this->_('Free products when customer buys specified quantity of product'), 'AmountOnSubscription' => $this->_('Fixed amount on subscription'), 'RateOnSubscription' => $this->_('Rate on subscription'), ); $this->discountsTriggers = array( 'Code' => $this->_('Enter discount code'), 'Product' => $this->_('Specific product added'), 'Total' => $this->_('Order reaches specific amount'), 'QuantityOfAProduct' => $this->_('Product added a number of times'), 'CartContainsOnlySpecifiedProducts' => $this->_('Cart only contains specified products'), 'CartContainsSomeSpecifiedProducts' => $this->_('Cart contains some of specified products'), 'CartContainsAtLeastAllSpecifiedProducts' => $this->_('Cart contains at least all specified products'), ); Yes, invoices can be downloaded in PDF format and the layout is customizable via the Snipcart dashboard!
  21. What I forgot to tell: Snipcart recently became even more interesting in terms of cost! Snipcart removed the Pro Pack bundle (70 USD/month) from their pricing. All Pro features will be available on Standard plan: Abandoned carts recovery Real-time shipping estimates Inventory management Custom email templates TaxCloud & TaxJar integrations
  22. UPDATE 2019-10-18 Some time has passed since the last update. But don't worry I've been working on it! A good back of time devoured the development of our new documentation platform. The new docs website can be found here: https://docs.bitego.com (of course it runs under ProcessWire) Most contents of existing projects are already imported. And I just started with the documentation for SnipWire. Of course development on SnipWire itself has been continued as well: the stability of the REST queries and their processing has been significantly improved the filter (search) functions for the list views (orders, customers, products) have been implemented. native ProcessWire pagination for list views has been implemented more snipcart fields have been added to the product definition several bugs have been fixed Next steps: finishing detail-views for Customers, Products and Orders development of a parallel process that continuously fetches data from Snipcart and makes it available as a local cache. (this should significantly minimize the waiting time for REST queries) implementation of Abandoned Carts Handling implementation of Refunds Handling Thats it for now! I also hope some of you will find the time and testing the current status. I would be very grateful for your feedback.
  23. Just stumbled across this older post and need to make an addition to @ryans post: You need to add: ... // make this to give MarkupPagerNav what it needs $a = new PageArray(); $a->setDuplicateChecking(false); // <-- add this line! ... just below the PageArray creation - otherwise this won't work, as you will always having only 1 item in the final PageArray.
  24. @NorbertH I'll contact you via PM!
  25. @bernhard & @wbmnfktr thanks guys for recommending me!
×
×
  • Create New...