Jump to content
Gadgetto

SnipWire - Snipcart integration for ProcessWire

Recommended Posts

On 12/4/2020 at 11:05 PM, Gadgetto said:

If you mean the Snipcart version 3 - then it's not supported yet.

Are you planning to support Snipcart v.3 any soon? Thank you for this great peace of work.

Share this post


Link to post
Share on other sites
On 1/7/2021 at 5:41 PM, palacios000 said:

Are you planning to support Snipcart v.3 any soon? Thank you for this great peace of work.

Compared to v2, there is still one feature missing in v3 of Snipcart:

  • Recurring subscriptions

As soon as v3 is feature complete I'll starting development on v3 support.

  • Like 1

Share this post


Link to post
Share on other sites
On 4/21/2020 at 11:22 AM, Gadgetto said:

If you are using another profile or output strategy, you'll need to rewrite the template source.

I'm using the Beginner profile, any chance I could convince one of you coding wizards to show me some example code for snipcart-product.php, snipcart-shop.php, and snipcart-cart.php? I'm definitely not a PHP expert but I'm feeling more and more comfortable in PW every day... I'd really like to get this working but my entire site is already built using the Beginner profile and is currently public, I can't rebuild it using the markup regions output strategy. I have my Snipcart account created, the API test is validated but I have the same issue as reported above by @fruid:

Call to undefined function ProcessWire\ukIcon()

Note: this project is for a non-profit association and I'm currently donating my time but I would 100% not mind paying someone for their help, feel free to PM me if that's preferred 😃 

Share this post


Link to post
Share on other sites

This thread isn’t my place at all, but Gadgetto’s post you quoted tells me you need to copy the file _uikit.php from the regular site profile and somewhere at the top of your own template call include_once('./_uikit.php');. Should be a safe fix for that specific error.

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, Jan Romero said:

This thread isn’t my place at all, but Gadgetto’s post you quoted tells me you need to copy the file _uikit.php from the regular site profile and somewhere at the top of your own template call include_once('./_uikit.php');. Should be a safe fix for that specific error.

Thanks for jumping in @Jan Romero!

This will work but can have side effects.

Share this post


Link to post
Share on other sites
30 minutes ago, Ben Sayers said:

I'm using the Beginner profile, any chance I could convince one of you coding wizards to show me some example code for snipcart-product.php, snipcart-shop.php, and snipcart-cart.php? I'm definitely not a PHP expert but I'm feeling more and more comfortable in PW every day... I'd really like to get this working but my entire site is already built using the Beginner profile and is currently public, I can't rebuild it using the markup regions output strategy. I have my Snipcart account created, the API test is validated but I have the same issue as reported above by @fruid:

Call to undefined function ProcessWire\ukIcon()

Note: this project is for a non-profit association and I'm currently donating my time but I would 100% not mind paying someone for their help, feel free to PM me if that's preferred 😃 

You'll need to have a look at the snipcart-shop and snip cart-product templates and modify them so they use the preferred rendering method.

Share this post


Link to post
Share on other sites
11 minutes ago, Jan Romero said:

Should be a safe fix for that specific error.

Yup, that worked. Thanks so much @Jan Romero! I can see the demo products now.

2 minutes ago, Gadgetto said:

This will work but can have side effects.

Oh no! Hi @Gadgetto, can you elaborate on the side effects? Basically, I'm trying to add a way for this association to offer paid memberships. I initially tried doing this with @ryan's FormBuilder and Stripe Payment Processor modules but it quickly became too complex for that route. The association's board came up with 9 different membership plans they'd like to offer, some with one user, others with potentially hundreds or more. For instance, when a school registers, they'd like to be able to offer a coupon code to their students so they can register for free, using the school's plan that they paid for. I think the only way I can really make this work is using a cart system so I can enable coupon codes. If you're interested, I can PM you links to the mock-ups I've created that might help shed some light on what I'm trying to do.

Share this post


Link to post
Share on other sites

@Ben Sayers:

Hey Ben,

that's what I meant - simply including _uikit.php won't do the job. The whole templates are built using UIKit CSS framework.

You'll need to write your own templates for product overview and product-details. If you have a look at the two sample templates which are installed by SnipWire installer, you will see how it works. Please have a look at the comments in the php files.

I currently don't have the time to write sample code based on your rendering method. But if you are familiar with ProcessWire development this should be an easy job.

Having a look at the snipcart-shop template, all in all, that's all you need:
(please note this is a quick composition of the required code and might not fully work. And you need to use your own CSS classes based on your framework)

<!--
The content element holds your products catalogue.
-->
<div id="content">
    <?php
    $products = page()->children('limit=9');
    echo productOverview($products); 
    ?>
</div>

<?php
/**
 * Render a shop product overview
 *
 * @param PageArray $products
 * @return string
 *
 */
function productOverview(PageArray $products) {

    if (!$products->count) return '';
    
    $out = '<div class="product>';

    foreach ($products as $product) {
        
        // We use the first image in snipcart_item_image field for demo
        $imageMedia = '';
        if ($image = $product->snipcart_item_image->first()) {
            $productImageMedium = $image->size(600, 0, array('quality' => 70));
            $imageDesc = $productImageMedium->description ? $productImageMedium->description : $product->title;
            $imageMedia = '<img src="' . $productImageMedium->url . '" alt="' . $imageDesc . '">';
        } else {
            $imageMedia = 
            '<div title="' . __('No product image available') . '">' . 
                ukIcon('image', array('ratio' => 3)) . // you need to use your own image output function here because ukIcon is based on UIKit CSS
            '</div>';
        }
        
        // This is the part where we render the Snipcart anchor (buy button)
        // with all data-item-* attributes required by Snipcart.
        // The anchor method is provided by MarkupSnipWire module and can be called 
        // via custom API variable: $snipwire->anchor()
        $options = array(
            'label' => ukIcon('cart'), // use your own image output function
            'class' => 'button button-primary',
            'attr' => array('aria-label' => __('Add item to cart')),
        );
        $anchor = wire('snipwire')->anchor($product, $options);
        
        // Get the formatted product price.
        // The getProductPriceFormatted method is provided by MarkupSnipWire module and can be called 
        // via custom API variable: $snipwire->getProductPriceFormatted()
        $priceFormatted = wire('snipwire')->getProductPriceFormatted($product);

        $out .=
        '<a href="' . $product->url . '">' .
            '<div class="product-detail">' .
                '<div class="media-top">' .
                    $imageMedia .
                '</div>' .
                '<div class="card-body">' .
                    '<h3 class="card-title">' . $product->title . '</h3>' .
                    '<p>' . $product->snipcart_item_description . '</p>' .
                '</div>' .
                '<div class="card-footer">' .
                    $anchor .
                    '<span class="align-right text-primary">' . $priceFormatted . '</span>' .
                '</div>' .
            '</div>' .
        '</a>';
    }

    $out .= '</div>';

    return $out;
}
?>

 

  • Like 1

Share this post


Link to post
Share on other sites
8 minutes ago, Gadgetto said:

Having a look at the snipcart-shop template, all in all, that's all you need:
(please note this is a quick composition of the required code and might not fully work. And you need to use your own CSS classes based on your framework)

@Gadgetto thank you very much for taking your time to provide that example. I'll kick it around and see what I can do. Cheers 🍻

Share this post


Link to post
Share on other sites

Hi @Gadgetto, I finally have a working demo (see it here) using the Beginner Profile that is incorporated with my custom design but I have a few questions:

  1. Where is the data saved for custom fields? I added some custom fields and completed a transaction but I don't see any of the custom field data saved anywhere in Setup -> SnipWire -> Customers or in my Snipcart account.
  2. Is there a hook I can use to replace the "Order Info" with "Member Info" in the tab label?
  3. I'm using SnipWire to sell Membership plans and I'm hoping to have them renew automatically using the subscription option, I don't see any information in your documentation on this, can you provide an example?
  4. Is there a way to set a default option on a select field in the Billing Address? This association is only for Michigan (US) so I'd like to set that as the default under the State/Province field.
  5. Is there a way to use conditional custom fields depending on the product that is selected? I'm hoping to be able to add/hide certain *required* & optional fields on the Order Info and Billing Address tabs as some membership plans are for businesses and others are for individuals. Each product will likely have custom requirements so if I can create some sort of if/else statement, that would be great.

EDIT: Is there anyone out there that can help? All suggestions are welcome! 🙏

Edited by Ben Sayers
Need Help

Share this post


Link to post
Share on other sites
On 5/15/2019 at 4:17 PM, Gadgetto said:

Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire.
With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required.

Could anybody having experience with this module please explain what the module EXACTLY does? I don't really get it from the description. And SnipCart itself claims this:

Quote

Add a shopping cart to any website

Start accepting international payments in minutes.

As I understood it's as simple as adding custom button markup to the site and you are up and running your snipcart site. The dashboard in this case would obviously be hosted at snipcart and not inside my processwire project, but is that the only reason for this module? I have the feeling that I must be missing something 🙂 

Thx for your insights!

Quote

With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop

As far as I understood I don't need SnipWire for that?!

Quote

The SnipWire plugin helps you to get your store up and running in no time.

Well... what exactly takes time if I am NOT using SnipWire? Isn't it just adding snipcart buttons?

Quote

SnipWire is the missing link between Snipcart and the content management framework ProcessWire.

Which link is missing? I thought the missing link were just some data-attributes?

<button class="snipcart-add-item"
  data-item-id="starry-night"
  data-item-price="79.99"
  data-item-url="/paintings/starry-night"
  data-item-description="High-quality replica of The Starry Night by the Dutch post-impressionist painter Vincent van Gogh."
  data-item-image="/assets/images/starry-night.jpg"
  data-item-name="The Starry Night">
  Add to cart
</button>

https://docs.snipcart.com/v3/setup/products

Share this post


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

As I understood it's as simple as adding custom button markup to the site and you are up and running your snipcart site. The dashboard in this case would obviously be hosted at snipcart and not inside my processwire project, but is that the only reason for this module? I have the feeling that I must be missing something 🙂 

  • SnipWire integrates the Snipcart dashboard into your ProcessWire backend
  • SnipWire installs all necessary fields for setting up your products editor (> 22 different fields)
  • it automatically generates the necessary Snipcart anchor markup based on those fields
  • SnipWire provides an easy way to integrate the Snipcart shopping cart into your project (including cart button, customer profile, login, logout, ...)
  • provides sample templates to setup your online shop.
  • handles and calculates all of the different VAT handlings worldwide
  • handles multi currency
  • process refunds right from your ProcessWire back-end
  • process abandoned carts and send messages to customers right from the ProcessWire back-end
  • provides hookable ProcessWire events for orders, customer registration, ...
  • ...

How would you handle the custom data attributes markup without an engine generating it? If you only have a handful products this might be possible by writing the markup by hand but if your client should be able to manage a shop, SnipWire is the best way to do it.

As a sample - how would you do this manually?

<button
  class="snipcart-add-item uk-button uk-button-primary"
  title="Add to cart"
  aria-label="Add item to cart"
  data-item-name="Festish Wet Warmer"
  data-item-id="1713"
  data-item-price='{"usd":"22.20","eur":"19.90"}'
  data-item-url="http://domain.com/snipcart-shop/festish-wet-warmer/"
  data-item-description="A short product description..."
  data-item-image="http://domain.com/site/assets/files/1713/beer2.65x65-hidpi.jpg"
  data-item-categories="Beer"
  data-item-metadata='{"id":1713,"created":1563363120,"modified":1580402487,"published":1563363120,"created_users_id":41,"modified_users_id":41}'
  data-item-quantity="1"
  data-item-quantity-step="1"
  data-item-stackable="true"
  data-item-taxable="true"
  data-item-taxes="10% VAT"
  data-item-has-taxes-included="true"
  data-item-shippable="true">
      <span uk-icon="icon: cart"></span> Add to cart
</button>

 

I probably don’t get your message, but as an experienced developer you should get the benefit.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thx @Gadgetto

my message was not meant as criticism. I just don't get WHY SnipWire does all that. Ok, I get that you need to setup some fields that hold necessary data (vat, description, image) and then you need to create the markup. That should be quite simple though without using SnipWire (for example using RockMigrations which you can guess I'm using in every project 😉 ). The cart-button could then look somewhat like this:

<button
  class="snipcart-add-item uk-button uk-button-primary"
  title="Add to cart"
  aria-label="Add item to cart"
  data-item-name="<?= $page->title ?>"
  data-item-id="<?= $page->id ?>"
  data-item-price='<?= $page->price ?>'
  data-item-url="<?= $page->httpUrl ?>"
  data-item-description="<?= $page->description ?>"
  ...>
  <span uk-icon="icon: cart"></span> Add to cart
</button>

Ok... I get that's quite tedious and having a helper method for that could for sure be handy. What I still don't get is why you took all that effort to get all (or at least many?) of the features of snipcart into the pw backend? Wouldn't it be a lot easier if the clients just managed their snipcart shop via the snipcart website? As far as I understood the client has to register an account there and then gets a login where he/she can manage their products/sold items etc?

It's obvious that SnipWire can do a lot and I'm quite impressed - I'm just not getting the WHY behind all that. Maybe it's just because I don't know anything of the PAIN you are solving because I've never setup a snipcart store manually...

Share this post


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

Thx @Gadgetto

my message was not meant as criticism. I just don't get WHY SnipWire does all that. Ok, I get that you need to setup some fields that hold necessary data (vat, description, image) and then you need to create the markup. That should be quite simple though without using SnipWire (for example using RockMigrations which you can guess I'm using in every project 😉 ). The cart-button could then look somewhat like this:


<button
  class="snipcart-add-item uk-button uk-button-primary"
  title="Add to cart"
  aria-label="Add item to cart"
  data-item-name="<?= $page->title ?>"
  data-item-id="<?= $page->id ?>"
  data-item-price='<?= $page->price ?>'
  data-item-url="<?= $page->httpUrl ?>"
  data-item-description="<?= $page->description ?>"
  ...>
  <span uk-icon="icon: cart"></span> Add to cart
</button>

Ok... I get that's quite tedious and having a helper method for that could for sure be handy. What I still don't get is why you took all that effort to get all (or at least many?) of the features of snipcart into the pw backend? Wouldn't it be a lot easier if the clients just managed their snipcart shop via the snipcart website? As far as I understood the client has to register an account there and then gets a login where he/she can manage their products/sold items etc?

It's obvious that SnipWire can do a lot and I'm quite impressed - I'm just not getting the WHY behind all that. Maybe it's just because I don't know anything of the PAIN you are solving because I've never setup a snipcart store manually...

If you only need/want to render the Snipcart anchors/buttons then you could do it by simply using php and ProcessWire output (but for example handling VAT splitting and multi currency will be another thing).

For all other things I listed above, SnipWire will do the job for you. 

Share this post


Link to post
Share on other sites

Hi I'm curious if there are any developers out there that have experience with SnipWire who might be available to hire? I already have the module installed and integrated with the client's Stripe account. This is a non-profit company that would like to offer 9 different membership plans. Everything is working for the basic plan but there are some advanced options that I'll need some assistance with. I've reached out to the developer and I had someone that was going to help but that didn't work out - I do have a description/overview of the project written out which I can forward to you in a DM. From what I understand, this shouldn't be too terribly difficult for an experienced programmer. Thank you! 🙏

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 horst
      Wire Mail SMTP

      An extension to the (new) WireMail base class that uses SMTP-transport

      This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times.

      The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only).
       
      Here are Ryans announcement.



      Current Version 0.6.0
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
      get it from the Modules Directory Install and Configure

      Download the module into your site/modules/ directory and install it.

      In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature.
      You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts.


      Usage Examples
      The simplest way to use it:
      $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient.
       
      You may also use the object oriented style:
      $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire:
      $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients.
      $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array:
      $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working:
      $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; }  
      A MORE ADVANCED DEBUG METHOD!
      You can add some debug code into a template file and call a page with it:
      $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage.
      The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one:
       
      Following are a ...


      List of all options and features


      testConnection () - returns true on success, false on failures


      sendSingle ( true | false ) - default is false

      sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+)


      to ($recipients) - one emailaddress or array with multiple emailaddresses

      cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses

      bcc ($recipients) - one emailaddress or array with multiple emailaddresses

       
      from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here

      fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here


      priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest

      dispositionNotification () or notification () - request a Disposition Notification


      subject ($subject) - subject of the message

      body ($textBody) - use this one alone to create and send plainText emailmessages

      bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback)

      addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here
      (only available if a signature is defined in the config screen)

      attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename


      send () - send the message(s) and return number of successful sent messages


      debugSend(1) - returns and / or outputs a (pre formatted) dump that contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection. (See above the example code under ADVANCED DEBUG METHOD for further instructions!)


      getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,


      logActivity ($logmessage) - you may log success if you want

      logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly
       
       
      useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here

      sentLogReset ()  - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter

      sentLogGet ()  - is called automaticly within the send() method - returns an array containing all previously used emailaddresses

      sentLogAdd ($emailaddress)  - is called automaticly within the send() method
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
       
       
    • By Cybermano
      Food Allergens Module
      A simple List of Food Allergens
      My needs were to provide a simple list of food allergens for our clients with restaurant related activity.
      The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window.
      This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea.
      This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens.
      ---
      Main features
      The basis
      All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard
      First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module).
      Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list).
      A step further
      With the tips of  @bernhard, @Soma (and many others), see here , the magic happens. 
      The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list.
      A little further
      Why scroll to the top of the page to click a link?
      The next step was to create a sticky button only in the food menu pages.
      Again with a @bernhard tip I moved into the customization of this simple module and the related hook.
      ---
      How to use this module
      After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page
      Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM):
      View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the  asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens".
      At the same way, the option for the sticky button, but with a plus
      The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>.

      Video Explanation
      In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call.
      This because I've set a specific one for each allergen to show up a tooltip in the front end.

      Registrazione #33.mp4  

      Registrazione #34.mp4 ---
      Last but not the least
      Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible.
      I always learn a lot here, so I would share my code for whom it could be interested.
      I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module.
      Obviously you are free to modify the code as per your needs.
      Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). 😉
      I hope be helpful or for inspiration.
      Bye
      ready.phpList-ITA.htmlList-ENG.htmlAllergens.module
      README.md
    • By Robin S
      This module is sort of an upgrade to my earlier ImageToMarkdown module, and might be useful to anyone working with Markdown in ProcessWire.
      Copy Markdown
      Adds icons to images and files that allow you to copy a Markdown string to the clipboard. When you click the icon a message at the top left of the screen notifies you that the copying has occurred.
      Screencast

      Note: in the screencast an EasyMDE inputfield is used to preview the Markdown. It's not required to use EasyMDE - an ordinary textarea field could be used.
      Usage: Images
      When you hover on an item in an Images field an asterisk icon appears on the thumbnail. Click the icon to copy an image Markdown string to clipboard. If the "Description" field is populated it is used as the alt text.
      You can also open the "Variations" modal for an image and click the asterisk icon to copy an image Markdown string for an individual variation.
      Usage: Files
      When you hover on an item in a Files field an asterisk icon appears next to the filename. Click the icon to copy a link Markdown string to the clipboard. If the "Description" field is populated it is used as the link text, otherwise the filename is used.
       
      https://github.com/Toutouwai/CopyMarkdown
      https://processwire.com/modules/copy-markdown/
    • By BitPoet
      I've realized that I've been jumping back and forth between the PW API docs and the source code for site modules far too much. The idea to hold all necessary documentation locally in one place has occurred to me before, but getting PHPDocumentor et al set up and running reliably (and producing readable output) as always been too much of a hassle. Today I was asked how I find the right hooks and their arguments, and that inspired me to finally get my backside down on the chair and whip something up, namely the
      Module Api Doc Viewer
      ProcessModuleApiDoc
      It lets you browse the inline documentation and public (optionally also protected) class/method/property information for all modules, core classes and template files in the ProcessWire instance. The documentation is generated on the fly, so you don't have to remember to update your docs whenever you update a module.
      The module is quite fresh, so expect some bugs there. Behind the scenes it uses PHP-Parser together with a custom class that extracts the information I needed, and the core TextformatterMarkdownExtra module for rendering the description part in the phpdoc style comments.
      This is not a replacement / competitor to the API Viewer included in the commercial ProDevTools package. There is quite some information included in the inline documentation that my module can't (and won't) parse, but which makes up parts of the official ProcessWire API docs.
      This, instead, is a kind of Swiss army knife to view PHPDoc style information and get a quick class or function reference.
      If you feel daring and want to give it a spin, or if you just want to read a bit more, visit the module's GitHub repository.
      This is the overview page under "Setup" -> "Module API Docs":

      And this is what the documentation for an individual class looks like:

      The core module documentation can of course be found online, but it didn't make sense not to include them.
      Let me know what you think!

    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
×
×
  • Create New...