Jump to content

SnipWire - Snipcart integration for ProcessWire


Gadgetto

Recommended Posts

  • 2 weeks later...

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
Link to comment
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

 

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 3 weeks later...

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.

Link to comment
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
Link to comment
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, ...?

Link to comment
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?

Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
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
Link to comment
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
×
×
  • Create New...