Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by Cybermano

  1. 2 hours ago, Cybermano said:


    I would like to test it, but I need two clarification if it's possible


    Maybe I've found my way playing a bit.

    For other newbies like me, I think the pointed requests are:

    1. setApikey=> sk_key
    2. according to pw syntax $session->set('key', 'value') => $session->set('prod', $page->title)
    3. form stands for an html <form></form> with options to get info such as shipping methods, product quantity, discount codes, coupons and so on... to calculate the final amount


    I think Stripe Payment Links work greatly with a simple <a> tag, such as

    <a title="Stripe checkout for This Product" href="https://buy.stripe.com/my_productlink" target="_blank">This Product</a>

    in PW we could have a template with a field for the link and output the same as

    <a title="Stripe checkout for <?= $page->title ?>" href="<?= $page->stripe_payment_link ?>" target="_blank"><?= $page->title ?></a>

    and in this case we could also publish into some socials from PW like fb, telegram, and so on.


    But I think I've missed something important from your post:

    How does a Stripe Pyment Link interact with the above php checkout?

  2. Hi Angelo, thanks for sharing this.

    I would like to test it, but I need two clarification if it's possible (from you o from who already tested it):

    • Point 3) Use variables in template 'product':

    Does $page->title need quotation marks or not? If yes, are you sure to use without concatenation syntax? eg.

    '"' . $page->title . '"'
    • Point 4) Insert a form in the template 'product':  what "form" stands for?

    It's a specific html form with buying data or something else?


    ...and last, but not least: please, can you specify which ApiKey to use?

    Many thanks in advance.



  3. 14 hours ago, Robin S said:

    @Cybermano, I don't understand what you are doing with this line inside the foreach:

    $boat->barca_results->sort('id', $race);


    Hope this helps:

    // Get the page containing the Repeater items
    $p = $pages(1066);
    // Turn off output formatting for the page because we are going to save it later
    // Sort the Repeater items alphabetically by title
    // $i is a counter we will use to set the sort value of each Repeater item/page
    $i = 0;
    foreach($p->test_repeater as $repeater_item) {
    	$repeater_item->sort = $i;
    	$i++; // Increment the counter
    // Save the test_repeater field for $p


    Hi Robin, many thanks for your time and for your "academic" exposition. 👍

    You have clarified me a lot.

    Surely I have misunderstood your exposition for the sorting by index, into the the linked thread. 

    foreach($r_items as $index => $r) {
        // Update the sort value of the repeater page
        // See: https://processwire.com/api/ref/pages/sort/
        $pages->sort($r, $index);

    I had assumed that in this foreach $pages->sort() stands for  $page->repeater_item->sort()

    I beg your pardon... 🙂

    And for the record, now with your help (😇) my whole mess (🤣) is working perfectly ... 

    • Like 2
  4. 17 hours ago, MarkE said:

    Sorry to hear that @Cybermano. I’m away from my desk (and IDE) for a week, so can’t look into it just now.  Give me a prod next week if it’s still not working. 

    Don't worry, in fact I'm sorry for invading your post. Now I'm looking deeper into RobinS indication and affectively it works fine. Surely the fault is mine. Thanks again. 😉

  5. On 6/16/2021 at 10:03 AM, MarkE said:

    and save the page.

    Hi MarkE, sorry for bothering you...

    Unfortunately, compared to expectations, it didn't work out as I hoped.

    In my case, I have a matrix of scores stored by race, but when I add one or more races (repeater items) for all the competitors, some of this items shift randomly (4 digits are the id of the items, only for debug). Not all the times, but "sometimes"... also randomly... Completing the blank scores, the ID clarify the shift of the repeater items...

    1153054547_Schermata2021-07-10alle17_17_32.jpg.36e84f3b4f6a575ea094c63f14c67125.jpg 831337889_Schermata2021-07-10alle17_18_29.jpg.043e99975f0b3c0af8e68d1f1dd2b2af.jpg 1443728810_Schermata2021-07-10alle17_19_25.jpg.37a19e4638509f0ba5ce79ca5d1d45ec.jpg

    The ADD/REMOVE items process is done by hook, with getNew() and add() methods (also tried append(), but nothing changed)...

    In Tracy Debug I can order the repeaters properly, but nothing more: it seems that after sorting the page is not saved ...


    And into the single competitor page, with Tracy all seems working good, but on each page refresh the repater items are always shifted. The repeater is not saved...





    Looking for other posts besides your, I found this one by @Robin S

    but the sorting by index  didn't work... 😶

    Do you have any suggestion?

  6. 47 minutes ago, wbmnfktr said:

    Wow... Thank you so much @Cybermano!

    That helped a lot and gave a good insight, ways, options, and things the module can do.

    Next step for me will be... playing around with it as there is quite a lot to play with.


    You’re welcome, and I hope you could enjoy it!

    Please, let me know if it could be helpful.

  7. Hi wbmnfktr,

    Don't worry, you didn't offend me 😉 : maybe I could be too verbose and not clear.

    First of all, this module  doesn't install a kind of "tool" that manages food allergens in an automatic way. It moved from a need of this kind.

    Let's me explain better, if I can.

    Admin editors (webmaster or their clients too) may need to check recursively some data when edit lot of pages, e.g. inserting allergens in food menu (for each dish).

    So I thinked to a kind of "post-it" (or a sticky note) to check when I need to edit a page: for example, I'm not a chef nor a restaurant manager and I don't know by heart all the food allergens. So, for many clients that asked to us to maintain web editing and data entry, I built an admin page where I can check the list of allergens.



    But this slows down the editing process, because the page is loaded as a new page (or it could be loaded as a new tab, switching between it and the page that I'm editing).

    With the help of many people here, I have developed this module do build a system of "links" that they make appear a "panel" or a "modal" with the list of allergens.

    Obviously, you must have already setted all your fields, templates and logics.

    In my case, we have Hanna Code shortcuts to put into "Allergens" field, into a "menu repeater", that will be rendered as a button with tooltip.





    My Hanna Code item, in this case, is :

    <button type="button" class="btn btn-sm btn-warning rounded" data-container="body" data-html="true" data-toggle="popover" data-placement="top" data-content="<strong>Mustard</strong> and foods containing mustard."> 10 </button>

    In other way, you can set a SelectOptions field with Checkboxes:


    The code logics to display these buttons could be very similar, it doesn't matter.


    Here comes the help of my module: you can set where to insert the link to the list (e.g. the notes of the "allergens" field, or a sticky button that follow your scrolling).

    So you can limit the visibility of the link only to specific template, pages, and/or fields.

    Ad you don't have to open new tab or switching between them: it's available immediately. It helps me very much and speeds up my workflow for data entry.


    But this is not only for List of Allergens, of course.

    You could embed video (with the powerful tool of Video Emebed TextFormatter) , pdf manuals (just insert a link with target="_self", and it will be displayed into the panel or modal windows. In the second case it will be displayed into the whole modal like a "preview", very useful...), and other stuff.

    Let's think about technical manuals, videotutorials and text abstracts: 


    All you need to do, it's simply edit the CKEditor textarea into the settings of the module, as you do for each page that you edit. Then you will find a "reminder" where you would to see it.


    I hope I have explained better the use of this module to you and maybe to everybody that would try it.

    Now I will upload the upgrades with the corrections of @teppo .


    • Thanks 1
  8. On 6/27/2021 at 9:22 AM, teppo said:

    Done — https://processwire.com/talk/topic/25815-custom-notes/. Moved the two posts introducing Custom Notes and placed them in the Modules forum section instead of module development (it's a proper module after all), hope that's fine 🙂

    Hi @teppo

    PR merged on the trust. 😉

    As posted on GitHub , your eyes will surely solve my newbie errors.

    ASAP I will check deeply all. 

    Thanks again.

    • Like 1
  9. 50 minutes ago, teppo said:

    Hey @Cybermano,

    Just letting you know that I opened an issue for the module here: https://github.com/cybermano/CustomNotes/issues/5. Minor things, but they are kind of showstoppers for the module right now. After fixing those, things seemed to work pretty nicely 🙂

    That would make sense in my opinion. Or if you prefer to, I can split the thread starting from that message (https://processwire.com/talk/topic/25435-custom-notes-former-list-of-allergens/?do=findComment&comment=213864) into a new thread — just let me know.

    Hi Teppo.

    First of all, many thanks for you time and for your suggestions. Very appreciated.

    At the moment I’m on mobile and far from my pc.
    ASAP I will check it and fix as you pointed.

    In the meantime, please split the discussion as you see fit and as it’s more convenient for the forum.

    Many thanks again for your support.

    • Like 1
  10. Hi to everybody!

    I found this useful module and it works fine on desktop (either pc and mac, Chrome/Safari/Opera/FireFox/Vivaldi and IE), but sometimes I've encountered different behaviours on mobile (tested on Android and iOs, with Chrome, Firefox, Opera, and Safari).

    Briefly, I built an html table in delayed output (a race ranking, one for each different race pages), I collect it into a variable and passed it throug a $_SESSION index to another page where it's grabbed with a ob_start()/ob_get_contents()/ob_end_clean() statement (no echos are present out of this one ob_start/ob_end).

    Despite the desktop pdf output it's ok (I can show()/save()/download() the files and open them with Acrobat, and into docs properties I found each custom setting, e.g. title, author, application and so on) on mobile, instead, I encountered two kind of issues:

    1) Most of  times, in Chrome, I was alerted of a non valid file, or FireFox it's not able to save pdf file.
    2) Some times the file is outputted also on mobile and it's perfectly readble, but on save and on open by Acrobat App I found the content empty with the notice of the $_SESSION['nameofindex'] undefined.

    N.B. Same results also calling directly mPdf after RockPdf and setting it's proper methods.
    No problems with a "static" html code passed to the write() method, but I'm getting crazy figuring why it works fine on desktop and not on mobile (or it's ok also on mobile, but can't save a correct file) with $_SESSION.

    Does anyone encontered same kinds of these strange behaviours?

    Any suggestion about that?


    Many thanks in advance.


  11. On 4/10/2021 at 4:03 AM, Robin S said:

    Another possible way ... use Hanna Code Dialog

    Or maybe ... use a Page Reference ...

    On 4/10/2021 at 10:30 AM, bernhard said:

    I think https://github.com/BitPoet/ProcessCKInlineComplete could also be a great option...


    Thanks for pointing me out those solutions: really rocks!

    For CKEditor field they are the first solution we'll considering in future.

    At the point of our production code, also page reference didn't suits well (we would maintain simple textarea and HC). Surely we will change templates and code to use these powerful tools for the next uses.

    Currently I think the first idea is really flexible (even if less powerful) to adopt it in a lot of ways, for lot of ready-made sites, and with different solutions without efforts.

    E.g. for food related sites we could use it as the List of Allergens, for many others could be used like a docs repo or a shortcut to a help-desk, tuts o more...

    • Like 1
  12. 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

    1. After installed, it creates the page /admin/page/allergens/ and the module is to be setted up.
    2. 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.
    3. 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).
    4. 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.



    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.




    • Like 5
  13. Hello.
    I confirm you that I was able to implement the panel view.
    Thank you so much. I owe you a truck of beers! 😉

    I dare, for those who may then use the same snippet you posted, that the url of the link must be between the quotes (and in my case I also had to remove #pw-masthead, not having a specific id).

    $(document).ready(function() {

    I also thank @Soma for publishing this tutorial, otherwise I would sail in the deepest dark ...;)

    All you are my hero! 🙂

    P.S. My next target is to hook my restaurant menu repeater to create a button with the same link, (so editors could obtain the list in place, without scrolling to top).  If all will go right, I will share the code of the hook, the button and the List of Allergens (Hanna Code). Of course I will use your suggestion for the button... 😉

  • Create New...