Jump to content
Gadgetto

SnipWire - Snipcart integration for ProcessWire

Recommended Posts

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:

order_handling.thumb.gif.4dc4ced581d0f2c409d62613bb8f3358.gif

  • Like 16
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi @Gadgetto,

Thank you for this great module, currently I'am using it for a test-case.

When I updated with your recent version I get the following error when I want to navigate to the dashboard / products page:

Fatal error: Uncaught ProcessWire\PageFinderSyntaxException: Field does not exist: snipcart_item_id in /Users/macbookweb014/Documents/BB/localhost/wetthrasport/wire/core/PageFinder.php:1272 Stack trace: #0

Can you help me fixing it? Do I need to create a snipcart_item_id field?

Thanks in advance!

Kind regards, 
Peejay

 

Share this post


Link to post
Share on other sites
4 hours ago, Peejay said:

When I updated with your recent version I get the following error when I want to navigate to the dashboard / products page:

Fatal error: Uncaught ProcessWire\PageFinderSyntaxException: Field does not exist: snipcart_item_id in /Users/macbookweb014/Documents/BB/localhost/wetthrasport/wire/core/PageFinder.php:1272 Stack trace: #0

Can you help me fixing it? Do I need to create a snipcart_item_id field?

Hi @Peejay,

did you run the Additional stepsInstall 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

  • Like 3

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

@Gadgetto,

For now the performance is OK! I'm still in testing mode. In two weeks I put the site live and when I have some orders I let you know how the performance is!

Pj

Share this post


Link to post
Share on other sites
21 minutes ago, Peejay said:

@Gadgetto,

For now the performance is OK! I'm still in testing mode. In two weeks I put the site live and when I have some orders I let you know how the performance is!

Pj

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!

  • Like 3

Share this post


Link to post
Share on other sites

Hi Martin,

that looks very promising! Unfortunately I can't get the module to work properly. I'm using the last dev version of processire. I get the following error when I try to install the sample products:
Raw data option with CURL not supported for GET 
In /wire/core/WireHttp.php line 642

Then I get when saving a product:
Snipcart product with SKU [1032] could not be fetched. [500 Internal Server Error: ]

I tried it in different environments, but in MAMP I also get these errors.

Share this post


Link to post
Share on other sites
6 hours ago, Noboru said:

Hi Martin,

that looks very promising! Unfortunately I can't get the module to work properly. I'm using the last dev version of processire. I get the following error when I try to install the sample products:
Raw data option with CURL not supported for GET 
In /wire/core/WireHttp.php line 642

Then I get when saving a product:
Snipcart product with SKU [1032] could not be fetched. [500 Internal Server Error: ]

I tried it in different environments, but in MAMP I also get these errors.

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

  • Like 1

Share this post


Link to post
Share on other sites

@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, ...?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

I would say that this answers your question 🙂

13 minutes ago, Gadgetto said:

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.

Don't make more work for yourself, both in coding and in support.

 

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, rick said:

 

Don't make more work for yourself, both in coding and in support.

Completely agree. The module will only profit from you enjoying working on it, so go easy on yourself and make use of available core features where necessary. Besides, ProcessWire is ridiculously easy to keep updated, so I don't feel like you're leaving anybody behind.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, d'Hinnisdaël said:

Completely agree. The module will only profit from you enjoying working on it, so go easy on yourself and make use of available core features where necessary. Besides, ProcessWire is ridiculously easy to keep updated, so I don't feel like you're leaving anybody behind.

Exactly, I am always on the latest dev version whenever I need to work on a site as it is so easy to update, and it is always stable in my eyes.

Share this post


Link to post
Share on other sites
4 hours ago, Gadgetto said:

I'm planning to release the module with a minimum requirement of PW version around 3.0.148

+1 🙂

Share this post


Link to post
Share on other sites
5 hours ago, Gadgetto said:

my upcoming SnipWire module

BTW, when can we expect that to happen? Sounds like sooner than the end of December maybe? Is it going to be the first production ready version?

Thanks for sharing all your hard work, and do not forget to ship it with a "Donation button".

  • Like 3

Share this post


Link to post
Share on other sites
9 hours ago, Gadgetto said:

@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, ...?

Hi @Gadgetto,

I'm using MAMP Pro 5.5.1 with PHP 7.3.8 (tried it with 7.1.31 with the same result), 
 

/Applications/MAMP/Library/bin/curl --version
curl 7.65.1 (x86_64-apple-darwin13.4.0) libcurl/7.65.1 OpenSSL/1.0.2o zlib/1.2.8 nghttp2/1.29.0
Release-Date: 2019-06-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets

It's also an naked PW 3.0.147 without any other modules.

Its the same result like on my webhost (curl 7.19.7 , PHP 7.3.12).

More testing on webserver (because webhooks and full configuration):
If I set the price to a value without a comma everything works as expected (SnipWire log: Fetched Snipcart product with SKU [1116] / ID [xxx-xxx-xxx-xxx]. 

But if the product price is for example 11.50, I get Snipcart product with SKU [1116] could not be fetched. [500 Internal Server Error: ]

I've tried different settings for decimal separator in app.snipcart.com Regional Settings.

The Markup for the Add-to-cart-Button looks like this:

 

<button class="snipcart-add-item" title="Add to cart" data-item-name="Axolotl Juicer" data-item-id="1116" data-item-price="11,5" data-item-url="https://roland.zumpixel.de/shop/axolotl-juicer/" data-item-description="Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." data-item-image="https://xxx.xx.de/site/assets/files/1116/beer3.65x65-hidpi.jpg" data-item-metadata="{&quot;id&quot;:1116,&quot;created&quot;:1576098063,&quot;modified&quot;:1576185868,&quot;published&quot;:1576098063,&quot;created_users_id&quot;:41,&quot;modified_users_id&quot;:41}" data-item-quantity="1" data-item-quantity-step="1" data-item-stackable="true" data-item-taxable="true" data-item-taxes="20% VAT" data-item-has-taxes-included="true" data-item-shippable="true">Add to cart</button>

 

Armin

Edited by Noboru
more details

Share this post


Link to post
Share on other sites
1 hour ago, Noboru said:

Hi @Gadgetto,

I'm using MAMP Pro 5.5.1 with PHP 7.3.8 (tried it with 7.1.31 with the same result), 
 


/Applications/MAMP/Library/bin/curl --version
curl 7.65.1 (x86_64-apple-darwin13.4.0) libcurl/7.65.1 OpenSSL/1.0.2o zlib/1.2.8 nghttp2/1.29.0
Release-Date: 2019-06-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets

It's also an naked PW 3.0.147 without any other modules.

Its the same result like on my webhost (curl 7.19.7 , PHP 7.3.12).

More testing on webserver (because webhooks and full configuration):
If I set the price to a value without a comma everything works as expected (SnipWire log: Fetched Snipcart product with SKU [1116] / ID [xxx-xxx-xxx-xxx]. 

But if the product price is for example 11.50, I get Snipcart product with SKU [1116] could not be fetched. [500 Internal Server Error: ]

I've tried different settings for decimal separator in app.snipcart.com Regional Settings.

The Markup for the Add-to-cart-Button looks like this:

 


<button class="snipcart-add-item" title="Add to cart" data-item-name="Axolotl Juicer" data-item-id="1116" data-item-price="11,5" data-item-url="https://roland.zumpixel.de/shop/axolotl-juicer/" data-item-description="Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." data-item-image="https://xxx.xx.de/site/assets/files/1116/beer3.65x65-hidpi.jpg" data-item-metadata="{&quot;id&quot;:1116,&quot;created&quot;:1576098063,&quot;modified&quot;:1576185868,&quot;published&quot;:1576098063,&quot;created_users_id&quot;:41,&quot;modified_users_id&quot;:41}" data-item-quantity="1" data-item-quantity-step="1" data-item-stackable="true" data-item-taxable="true" data-item-taxes="20% VAT" data-item-has-taxes-included="true" data-item-shippable="true">Add to cart</button>

 

Armin

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

Share this post


Link to post
Share on other sites
3 hours ago, szabesz said:

BTW, when can we expect that to happen? Sounds like sooner than the end of December maybe? Is it going to be the first production ready version?

Thanks for sharing all your hard work, and do not forget to ship it with a "Donation button".

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! 👍

  • Like 3

Share this post


Link to post
Share on other sites
11 hours ago, Noboru said:

...
The Markup for the Add-to-cart-Button looks like this:


<button class="snipcart-add-item" title="Add to cart" data-item-name="Axolotl Juicer" data-item-id="1116" data-item-price="11,5" data-item-url="https://roland.zumpixel.de/shop/axolotl-juicer/" data-item-description="Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." data-item-image="https://xxx.xx.de/site/assets/files/1116/beer3.65x65-hidpi.jpg" data-item-metadata="{&quot;id&quot;:1116,&quot;created&quot;:1576098063,&quot;modified&quot;:1576185868,&quot;published&quot;:1576098063,&quot;created_users_id&quot;:41,&quot;modified_users_id&quot;:41}" data-item-quantity="1" data-item-quantity-step="1" data-item-stackable="true" data-item-taxable="true" data-item-taxes="20% VAT" data-item-has-taxes-included="true" data-item-shippable="true">Add to cart</button>

 

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!

  • Like 2

Share this post


Link to post
Share on other sites

With the help of @Noboru I could fix some bugs in the "Extended Resources" installer and with float values in prices. Some rare problems could be fixed and the installer is more stable now.

A big problem is the integrated taxes-provider regarding shipping-.taxes. I'm in contact with the Snipcart team to make this as flexible as possible. This isn't easy as we have very different taxes system around the countries of the world.

  • Like 4

Share this post


Link to post
Share on other sites

@Gadgetto this module looks fantastic! I'm looking at using SnipCart to create an ecommerce site because it seems very user friendly (important for when I pass this site off) and it has support for some of the features I need.

One of those features is subscriptions. Do you have advice for setting up monthly subscriptions vs one-time purchases? I'm new to both your module and SnipCart and I didn't see anything obvious after the initial install and a bit of poking about in the admin but I do see it in the Module's page under Setup and references to subscriptions in the module files.

Am I overlooking something, or do I just need to add custom fields to the snipcart-product template (and output them in the markup) to correspond to the button attributes listed in https://docs.snipcart.com/v3/setup/products ?

Thanks!

Share this post


Link to post
Share on other sites
20 hours ago, creativejay said:

@Gadgetto this module looks fantastic! I'm looking at using SnipCart to create an ecommerce site because it seems very user friendly (important for when I pass this site off) and it has support for some of the features I need.

One of those features is subscriptions. Do you have advice for setting up monthly subscriptions vs one-time purchases? I'm new to both your module and SnipCart and I didn't see anything obvious after the initial install and a bit of poking about in the admin but I do see it in the Module's page under Setup and references to subscriptions in the module files.

Am I overlooking something, or do I just need to add custom fields to the snipcart-product template (and output them in the markup) to correspond to the button attributes listed in https://docs.snipcart.com/v3/setup/products ?

I'm glad you like SnipWire! 🙂

Important: SnipWire is not yet ready for production environments!

Subscriptions are on my backlog and will be definitely in the first release!

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   1 member

  • Similar Content

    • By Macrura
      PrevNextTabs Module
      Github: https://github.com/outflux3/PrevNextTabs
      Processwire helper modules for adding page navigation within the editor.
      Overview
      This is a very simple module that adds Previous and Next links inline with the tabs on the page editor. Hovering over the tab shows the title of the previous or next page (using the admin's built in jqueryUI tooltips.)
      Usage
      This module is typically used during development where you or your editors need to traverse through pages for the purpose of proofing, flagging and/or commenting. Rather than returning to the page tree or lister, they can navigate with these links.
      Warnings
      If you are using PW version 2.6.1 or later, the system will prevent you from leaving the page if you have unsaved edits.
      For earlier versions, to avoid accidentally losing changes made to a page that might occur if a user accidentally clicks on one of these, make sure to have the Form Save Reminder module installed.
      http://modules.processwire.com/modules/prev-next-tabs/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.2.0
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      - + - + - + - + - + - + - + - + - + - NEWS - 2020/03/19 - + - + - + - + - + - + - + - + - + - 
      There is a new Version in the pipe, that supports WebP too: 
       
      - + - + - + - + - + - + - + - + - + - NEWS - 2020/03/19 - + - + - + - + - + - + - + - + - + - 
       
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By Robin S
      Inspired by a recent question.
      Image Crop Ratios
      Allows preset aspect ratios to be defined per image field for the ProcessWire image crop tool.
      The module adds a select dropdown to the crop tool. Choose an aspect ratio and the crop area will be fixed to that ratio.
      Screencast

      Installation
      Install the Image Crop Ratios module.
      Configuration
      Default aspect ratios for all image fields can be defined in the module config. Aspect ratios for specific image fields can be defined on the Input tab of the field settings. You can override the ratio settings in template context if needed. Insert a hyphen as the first item in the ratio settings unless you want to force a ratio to be applied to the crop tool. The hyphen represents a blank option that allows a free crop area to be drawn. Usage
      Click the "Crop" link on the details view of an image thumbnail. Click the "Crop" icon at the top of the editor window. Choose an option from the "Ratio" select dropdown.  
      https://github.com/Toutouwai/ImageCropRatios
      https://modules.processwire.com/modules/image-crop-ratios/
    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="optin" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="optin" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: PrivacyWire Git Repo
      Download as .zip
      I would love to hear your feedback 🙂
      CHANGELOG
      0.0.6 CSS-Debugging for hiding unused buttons, added ProCache support for the JavaScript tag 0.0.5 Multi-language support included completely (also in TextFormatter). Added possibility to async load other assets (e.g. <img type="optin" data-category="marketing" data-src="https://via.placeholder.com/300x300">) 0.0.4 Added possibility to add an imprint link to the banner 0.0.3 Multi-language support for module config (still in development) 0.0.2 First release 0.0.1 Early development
×
×
  • Create New...