Jump to content
Gadgetto

SnipWire - Snipcart integration for ProcessWire

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. 

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Thanks! 🙂

Share this post


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

Share this post


Link to post
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!

Share this post


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

Share this post


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

Share this post


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

 

 

Share this post


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

Share this post


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

🙂

Share this post


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

Share this post


Link to post
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!

 

Share this post


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

Share this post


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

Share this post


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

Share this post


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

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   0 members

    No registered users viewing this page.

  • Similar Content

    • By MoritzLost
      This module allows you to integrate hCaptcha bot / spam protection into ProcessWire forms. hCaptcha is a great alternative to Google ReCaptcha, especially if you are in the EU and need to comply with privacy regulations.

      The development of this module is sponsored by schwarzdesign.
      The module is built as an Inputfield, allowing you to integrate it into any ProcessWire form you want. It's primarily intended for frontend forms and can be added to Form Builder forms for automatic spam protection. There's a step-by-step guide for adding the hCaptcha widget to Form Builder forms in the README, as well as instructions for API usage.
      Features
      Inputfield that displays an hCaptcha widget in ProcessWire forms. The inputfield verifies the hCaptcha response upon submission, and adds a field error if it is invalid. All hCaptcha configuration options for the widget (theme, display size etc) can be changed through the inputfield configuration, as well as programmatically. hCaptcha script options can be changed through a hook. Error messages can be translated through ProcessWire's site translations. hCaptcha secret keys and site-keys can be set for each individual inputfield or globally in your config.php. Error codes and failures are logged to help you find configuration errors. Please check the README for setup instructions.
      Links
      Github Repository and documentation InputfieldHCaptcha in the module directory (pending approval) Screenshots (configuration)

      Screenshots (hCaptcha widget)

       
       

       
    • 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="text/plain" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="text/plain" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="text/plain" 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.1.1 Debugging: fixed error during uninstall 0.1.0 Added new detection of async scripts for W3C Validation 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
    • By bernhard
      --- Please use RockFinder3 ---
    • By MoritzLost
      Cacheable Placeholders
      This module allows you to have pieces of dynamic content inside cached output. This aims to solve the common problem of having a mostly cacheable site, but with pieces of dynamic output here and there.  Consider this simple example, where you want to output a custom greeting to the current user:
      <h1>Good morning, <?= ucfirst($user->name) ?></h1> This snippet means you can't use the template cache (at least for logged-in users), because each user has a different name. Even if 99% of your output is static, you can only cache the pieces that you know won't include this personal greeting. A more common example would be CSRF tokens for HTML forms - those need to be unique by definition, so you can't cache the form wholesale.
      This module solves this problem by introducing cacheable placeholders - small placeholder tokens that get replaced during every request. The replacement is done inside a Page::render hook so it runs during every request, even if the response is served from the template cache. So you can use something like this:
      <h1>Good morning, {{{greeting}}}</h1> Replacement tokens are defined with a callback function that produces the appropriate output and added to the module through a simple hook:
      // site/ready.php wire()->addHookAfter('CachePlaceholders::getTokens', function (HookEvent $e) { $tokens = $e->return; $tokens['greeting'] = [ 'callback' => function (array $tokenData) { return ucfirst(wire('user')->name); } ]; $e->return = $tokens; }); Tokens can also include parameters that are parsed and passed to the callback function. There are more fully annotated examples and step-by-step instructions in the README on Github!
      Features
      A simple and fast token parser that calls the appropriate callback and runs automatically. Tokens may include multiple named or positional parameters, as well as multi-value parameters. A manual mode that allows you to replace tokens in custom pieces of cached content (useful if you're using the $cache API). Some built-in tokens for common use-cases: CSRF-Tokens, replacing values from superglobals and producing random hexadecimal strings. The token format is completely customizable, all delimiters can be changed to avoid collisions with existing tag parsers or template languages. Links
      Github Repository & documentation Module directory (pending approval) If you are interested in learning more, the README is very extensive, with more usage examples, code samples and usage instructions!
    • By Craig
      I've been using Fathom Analytics for a while now and on a growing number of sites, so thought it was about time there was a PW module for it.
      WayFathomAnalytics
      WayFathomAnalytics is a group of modules which will allow you to view your Fathom Analytics dashboard in the PW admin panel and (optionally) automatically add and configure the tracking code on front-end pages.
      Links
      GitHub Readme & documentation Download Zip Modules directory Module settings screenshot What is Fathom Analytics?
      Fathom Analytics is a simple, privacy-focused website analytics tool for bloggers and businesses.

      Stop scrolling through pages of reports and collecting gobs of personal data about your visitors, both of which you probably don't need. Fathom is a simple and private website analytics platform that lets you focus on what's important: your business.
      Privacy focused Fast-loading dashboards, all data is on a single screen Easy to get what you need, no training required Unlimited email reports Private or public dashboard sharing Cookie notices not required (it doesn't use cookies or collect personal data) Displays: top content, top referrers, top goals and more
×
×
  • Create New...