Jump to content

SnipWire - Snipcart integration for ProcessWire


Gadgetto

Recommended Posts

Thanks for your attention on those hookable methods, Gadgetto. Those will definitely be necessary for launching this site (the subscription pause button will get us in a lot of trouble otherwise!)

Another item for the list: when a user role with snipwire-dashboard permissions clicks on the additional tabs (Orders, Subscriptions, Abandoned Carts, Customers, Products, Discounts) within the Dashboard, they reach the 404 page instead. 

Link to comment
Share on other sites

I have another issue to report.

When I:

  • use "+ Add New" buttons to add a new page with my product template (as children of any of the three allowed parent templates)
  • enter the page Title on the admin /page/add/
  • hit Save

I get the error "New page '/page/path/' must be saved before files can be accessed from it"

If I uninstall SnipWire, the error message goes away. The product templates are my own, not the default SnipWire templates.

Link to comment
Share on other sites

5 hours ago, creativejay said:

I have another issue to report.

When I:

  • use "+ Add New" buttons to add a new page with my product template (as children of any of the three allowed parent templates)
  • enter the page Title on the admin /page/add/
  • hit Save

I get the error "New page '/page/path/' must be saved before files can be accessed from it"

If I uninstall SnipWire, the error message goes away. The product templates are my own, not the default SnipWire templates.

Do you have a hook on path method of PagefilesManager class?

I’ll try to reproduce this behavior, but I’d need more infos. Could you please send me the complete stack trace of the exception? You can use TracyDebugger for this.

How does your product template look like?

Link to comment
Share on other sites

On 3/10/2020 at 7:15 PM, creativejay said:

Thanks for your attention on those hookable methods, Gadgetto. Those will definitely be necessary for launching this site (the subscription pause button will get us in a lot of trouble otherwise!)

I just read you’d like to use subscriptions feature? Subscriptions are not yet supported by SnipWire.

Link to comment
Share on other sites

On 3/10/2020 at 7:15 PM, creativejay said:

Another item for the list: when a user role with snipwire-dashboard permissions clicks on the additional tabs (Orders, Subscriptions, Abandoned Carts, Customers, Products, Discounts) within the Dashboard, they reach the 404 page instead. 

I’ll have a look at this!

BTW, could you please file your issues on SnipWires GitHub repo? it is hard to keep the overview here in the forum.

Link to comment
Share on other sites

  • 2 weeks later...

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!
 

  • Like 1
Link to comment
Share on other sites

On 3/11/2020 at 5:34 PM, creativejay said:

I have another issue to report.

When I:

  • use "+ Add New" buttons to add a new page with my product template (as children of any of the three allowed parent templates)
  • enter the page Title on the admin /page/add/
  • hit Save

I get the error "New page '/page/path/' must be saved before files can be accessed from it"

If I uninstall SnipWire, the error message goes away. The product templates are my own, not the default SnipWire templates.

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.

Link to comment
Share on other sites

Hi there, thanks so much for working as hard as you have been/still are on this module! I'm testing it out at the moment, and have come up against the error that was previously reported:

Quote

Can’t save page 0: /custom-cart-fields/: It has no parent assigned

Having dug into the code, I think I found the cause. My test PW installation is in a subdirectory - not its own host - and snipWireRootUrl returns the full path include the folders:

/misc/pw-snipwire/processwire/setup/snipwire/

In the installer, as this variable is only used to set the parent page for custom-cart-fields, could ExtendedInstaller.php be updated to use the path instead of full URL?

I updated it like this, re-installed, and it worked:

// In ExtendedInstaller::__construct():

$this->snipWireRootPath = rtrim($this->wire('pages')->findOne('template=admin, name=snipwire')->path, '/') . '/';

// in _installPage():

// Page "parent" key may have "string tags"
$parent = \ProcessWire\wirePopulateStringTags(
    $item['parent'],
    array('snipWireRootPath' => $this->snipWireRootPath)
);

// In SystemResources.php

'parent' => '{snipWireRootPath}',

 

  • Like 2
Link to comment
Share on other sites

1 hour ago, Craig said:

Hi there, thanks so much for working as hard as you have been/still are on this module! I'm testing it out at the moment, and have come up against the error that was previously reported:

Having dug into the code, I think I found the cause. My test PW installation is in a subdirectory - not its own host - and snipWireRootUrl returns the full path include the folders:

/misc/pw-snipwire/processwire/setup/snipwire/

In the installer, as this variable is only used to set the parent page for custom-cart-fields, could ExtendedInstaller.php be updated to use the path instead of full URL?

I updated it like this, re-installed, and it worked:


// In ExtendedInstaller::__construct():

$this->snipWireRootPath = rtrim($this->wire('pages')->findOne('template=admin, name=snipwire')->path, '/') . '/';

// in _installPage():

// Page "parent" key may have "string tags"
$parent = \ProcessWire\wirePopulateStringTags(
    $item['parent'],
    array('snipWireRootPath' => $this->snipWireRootPath)
);

// In SystemResources.php

'parent' => '{snipWireRootPath}',

 

Oh, you are right for sure! Thanks, I'll fix this.

Link to comment
Share on other sites

On 3/21/2020 at 1:04 PM, Gadgetto said:

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.

I wasn't able to correct it, but the website had to launch so I uninstalled the Module and am using the direct API for Snipcart in the php templates and their dashboard for managing orders.

Before I uninstalled, I couldn't find a single logged error anywhere.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Hello.

I am impressed by the work you have done with your module. Congratulations! You are incredible!.

I am evaluating snipcart for a store for a friend who has a very low budget. I would like to know how difficult it is to implement a new payment gateway, in my case I am from Chile and none of the gateways offered by snipcart can be used by credit cards here. I am not an expert in php nor in processwire. I have implemented websites in processwire, so I have some experience with the framework.

Link to comment
Share on other sites

11 hours ago, Krlos said:

Hello.

I am impressed by the work you have done with your module. Congratulations! You are incredible!.

I am evaluating snipcart for a store for a friend who has a very low budget. I would like to know how difficult it is to implement a new payment gateway, in my case I am from Chile and none of the gateways offered by snipcart can be used by credit cards here. I am not an expert in php nor in processwire. I have implemented websites in processwire, so I have some experience with the framework.

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

Link to comment
Share on other sites

On 4/10/2020 at 5:27 PM, Gadgetto said:

EDIT: sorry, only possible with Snipcart v3. As v3 isn’t feature complete, SnipWire currently only supports v2.

@Gadgetto thank you for your reply, Do you plan to update Snipwire to version 3?

In the meantime, I am testing your module to see if I can use it in any project in the near future.

Everything is working fine except when I try to place an order in test mode I get this error in the last step of the check out:

Everything works perfect, except when I'm placing an order and in the last step the payment throws this error:

We have not been able to validate your order. Looks like some product prices might have changed since you added them to the cart. Please review your order and try again.

 I changed the payment currency from Euro to CLP and snipwire was able to correctly read the change from Snipcart dashboard. I removed snipcart_item_price_eur field from snipcart-product template and added snipcart_item_price_clp.

Then it gives me the following message:

It looks like this item is not available anymore. You may need to contact the merchant to get this resolved as it may be a configuration problem. By continuing this item will be removed from your cart.

 


When I check the Snipwire log file I see this:

Snipcart product with SKU [BEER-10001] could not be fetched. 500 Internal Server Error:

I'm testing in my local machine.

Processwire 3.0.148.

 

 

Link to comment
Share on other sites

10 hours ago, Krlos said:

Do you plan to update Snipwire to version 3?

Definitely!
Unfortunately Snipcart v3 still isn't feature par with v2. As soon as this is the case I'll implement v3 APIs!

10 hours ago, Krlos said:

Everything works perfect, except when I'm placing an order and in the last step the payment throws this error:

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?

Link to comment
Share on other sites

Hello,

I'm new to Snipcart and SnipWire, just a few questions before I try your module, which looks very promising!

I'm working on a multilanguage site (Italian/English/Cech) and I need to have three different currencies and (maybe) taxes.

Am I covered with SnipWire?

?

Link to comment
Share on other sites

16 hours ago, Marco Angeli said:

Hello,

I'm new to Snipcart and SnipWire, just a few questions before I try your module, which looks very promising!

I'm working on a multilanguage site (Italian/English/Cech) and I need to have three different currencies and (maybe) taxes.

Am I covered with SnipWire?

?

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

  • Like 1
Link to comment
Share on other sites

Hello,

I'm also getting this kind of error


Uff da… Fatal Error: Uncaught Error: Call to undefined function ukIcon() in site/templates/snipcart-shop.php:45

#0 wire/core/TemplateFile.php (318): require()
#1 wire/core/Wire.php (380): TemplateFile->___render()
#2 wire/core/WireHooks.php (823): Wire->_callMethod('___render', Array)
#3 wire/core/Wire.php (450): WireHooks->runHooks(Object(TemplateFile), 'render', Array)
#4 wire/modules/PageRender.module (536): Wire->__call('render', Array)
#5 wire/core/Wire.php (383): PageRender->___renderPage(Object(HookEvent))
#6 wire/core/WireHooks.php (823): Wire->_callMethod('___renderPage', Array)
#7 wire/core/Wire.php (450): WireHooks->runHooks(Object(ProcessW (line 45 of site/templates/snipcart-shop.php)

This error message was shown because: site is in debug mode. ($config->debug = true; => site/config.php). Error has been logged.

I installed SnipWire to my best knowledge, did the additional steps, created a SnipCart account, generated the public and the secret API key which I put in the module's settings, installed the product Snipcart products package, just not necessarily in that order. The only thing I didn't do is to set up the domains cause I'm working on the MAMP server

I also downloaded the _uikit.php clone from github as suggested by @dragan but I don't know how to install that.

So how to install that or is there another way to fix solve this issue?

Also, is there an alternative shopping module to snipcart because my requirements are very primitive. Just buying a product, no insights, no stats, no fancy stuff like "clients also bought" and whatnot. Really just a shopping cart, enter shipping and billing address and then checkout with paypal. Maybe a confirmation email. 

thanks for help!

 

Link to comment
Share on other sites

12 minutes ago, fruid said:

Hello,

I'm also getting this kind of error


Uff da… Fatal Error: Uncaught Error: Call to undefined function ukIcon() in site/templates/snipcart-shop.php:45

#0 wire/core/TemplateFile.php (318): require()
#1 wire/core/Wire.php (380): TemplateFile->___render()
#2 wire/core/WireHooks.php (823): Wire->_callMethod('___render', Array)
#3 wire/core/Wire.php (450): WireHooks->runHooks(Object(TemplateFile), 'render', Array)
#4 wire/modules/PageRender.module (536): Wire->__call('render', Array)
#5 wire/core/Wire.php (383): PageRender->___renderPage(Object(HookEvent))
#6 wire/core/WireHooks.php (823): Wire->_callMethod('___renderPage', Array)
#7 wire/core/Wire.php (450): WireHooks->runHooks(Object(ProcessW (line 45 of site/templates/snipcart-shop.php)

This error message was shown because: site is in debug mode. ($config->debug = true; => site/config.php). Error has been logged.

I installed SnipWire to my best knowledge, did the additional steps, created a SnipCart account, generated the public and the secret API key which I put in the module's settings, installed the product Snipcart products package, just not necessarily in that order. The only thing I didn't do is to set up the domains cause I'm working on the MAMP server

I also downloaded the _uikit.php clone from github as suggested by @dragan but I don't know how to install that.

So how to install that or is there another way to fix solve this issue?

Also, is there an alternative shopping module to snipcart because my requirements are very primitive. Just buying a product, no insights, no stats, no fancy stuff like "clients also bought" and whatnot. Really just a shopping cart, enter shipping and billing address and then checkout with paypal. Maybe a confirmation email. 

thanks for help!

 

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 rewrite the template source. If you like to run a quick test - just install PW using the "regular" profile.

Link to comment
Share on other sites

Hi fruid,

Quote

Also, is there an alternative shopping module to snipcart because my requirements are very primitive. Just buying a product, no insights, no stats, no fancy stuff like "clients also bought" and whatnot. Really just a shopping cart, enter shipping and billing address and then checkout with paypal. Maybe a confirmation email. 

If your requirements are more basic you can always use snipcart with their default Dashboard. There's a good tutorial here:

https://snipcart.com/blog/processwire-ecommerce-tutorial

 

  • Like 1
Link to comment
Share on other sites

9 minutes ago, Marco Angeli said:

Hi fruid,

If your requirements are more basic you can always use snipcart with their default Dashboard. There's a good tutorial here:

https://snipcart.com/blog/processwire-ecommerce-tutorial

 

Even if your requirements are very basic it would be much easier to use the SnipWire module, because it comes with all necessary product fields and settings and an easy to use API variable to output cart and products.

Link to comment
Share on other sites

On 4/21/2020 at 5:22 PM, Gadgetto said:

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 rewrite the template source. If you like to run a quick test - just install PW using the "regular" profile.

thanks, went for a new installation with "regular"-profile and it worked out fine.

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...