Jump to content

Alpine418

Members
  • Posts

    97
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Alpine418

  1. On 11/27/2024 at 11:57 PM, wbmnfktr said:

    Database dumps are a thing of its own. Managed projects are backed up quite often, long time projects with not that many updates will be backed up once every 3 months. From un-Managed projects I keep only the latest version I worked on - most of the time the release day or when something was updated.

    How do you back up your database dumps? For regular backups of your dev environment?

    I was thinking of something like a git hock and mysql command to dump the DB first into the root dir of the webproject and then make a commit aka push request.

  2. I found the issue.

    When a textarea is initial created with TinyMCE and you will switch afterwards to CKEditor, the menubar settings of TinyMCE keeps staying and won't get replaced by the default CKEditor menubar settings. That's the reason I could see the editor but no menubar buttons of CKEditor on my issue.

  3. On 4/16/2024 at 4:47 PM, bernhard said:

    Hi @HarryWilliam and welcome to the forum!

    E-Commerce is a huge topic and there are many ways how to do it - unfortunately or luckily ...

    Option 1: Payment Buttons or Links

    Very simple solutions are payment buttons that Platforms like Paypal offer. You can see an example here: https://www.boukal.at/work/catalogues/catalogue-do-you-also-have-pretty-motifs/

    Another option would be payment links that payment providers like stripe or mollie offer: https://www.mollie.com/gb/products/payment-links

    Pro: Very easy to implement

    Con: You have to manage different buttons/links for different products on your own, place them in your markup (for example with a textformatter), keep them up do date and you have very limited possibilities for customisations (like different options etc).

    Option 2: SaaS Shop integration

    The next option would be to add one of the SaaS solutions to your PW site. One option would be to use Snipcart, which is very simple to add to your site, at least in theory: https://snipcart.com/blog/processwire-ecommerce-tutorial

    Pro: Easy setup, working shop out of the box, they maintain and develop the product continuously and long term (hopefully)

    Con: You usually pay for it per purchase and/or you have a monthly fee. Snipcart for example costs at least 20$ per month if your sales are < 1000$. That's 240$ each year. https://snipcart.com/pricing

    Con: You need to add products to your SaaS shop. That means you can either not manage products directly from within your ProcessWire backend or you need to develop a bridge that keeps products in sync.

    Con: Using a SaaS Shop means you are locked to the features that this shop provides.

    In PW we have this module, but I'm not sure whether it's still maintained or will see any updates in the near future.

    Option 3: A custom PW shop

    This is maybe the most advanced solution.

    The benefits are that you get a fully integrated solution. You can manage all your products, all your users, all your orders etc. directly from within your PW backend. You can add hooks wherever you want and you can customise everything to make it work 100% the way you or your client wants. Imagination and your skills are the limit.

    The con is that it will likely be a more complex setup, as you need to understand the basic workflows of E-Commerce and you need to setup everything the way you want.

    As far as I know we only have Padloper 2 by @kongondo at the moment. I don't know the price, though, because the shop is down at the moment.

    I'm developing RockCommerce at the moment and it will hopefully be released during this year. The basic version is already done and you can see it in action on my website baumrock.com where I use it to sell my commercial modules, for example RockForms.

    As you can see on my website it can already be used to sell single products. It comes with a checkout (live example) but it has no cart functionality at the moment. But it already has a nice Dashboard with filters and charts, at least ? 

    TAwpdTw.png

    Also, it can already create fully automated and 100% customisable invoices directly from within PW/PHP (using RockPdf) - which is something that not all shopping carts do for you, keep that in mind when evaluating those products!

    cAvz8Il.png

    Thanks to the integration into the PW system it can send 100% custom emails to your customers, where you can make sure that you comply to your local legislation (for example in Austria we need to attach terms of service to that email):

    oSl3Xcf.png

    In this example it's a nice looking mail because I use RockMails, which is another module in the pipeline ? But as it is 100% ProcessWire you can simply send an email with some lines of code as well:

    $m = new WireMail();
    $m->from('office@your-company.com');
    $m->to('your@client.at');
    $m->subject('Thank you for your oder!');
    $m->body('Congrats, you are now a ProcessWire hero!');
    $m->send();

    So while it is not yet 100% it can already be already a great option!

    If you want to get notified about the release you can subscribe to my monthly developer newsletter: https://www.baumrock.com/en/rock-monthly/

    I'm quite sure there are 100 more options, but I tried to give an overview ? 

     

    Any chance to get trial access to the RockCommerce module?

  4. Good evening,

    I've installed InputfieldCKEditor a few minutes ago and switched my textarea from TinyMCE to CKEditor. Unfortunately the menu of CKEditor does not get loaded and looks like this when I'm editing a page:
    image.png.635a450e8502dfeb2c4a5cd8ec7d0ee2.png

    Any hints what the issue could be?

    Thanks.

  5. I solved it myself by the following code.

    1. Create a custom RepeaterPage class for my tracks and add a specific method to create a session-based URL for streaming.

    <?php namespace ProcessWire;
    
    /**
     * @property Pagefile $audio
     */
    class TracksRepeaterPage extends RepeaterPage
    {
        /**
         * @param string $streamUrl Default stream URL when audio file does not exist
         *
         * @return string
         */
        public function getStreamUrl(string $streamUrl = ''): string
        {
            // Check whether audio file exists and if it does create a session-based stream URL
            if ($this->audio) {
    
                // Create the file hash and add it to the session as key for the audio file path
                $audioPath = $this->audio->filename();
                $fileHash = hash('sha1', $audioPath . session_id());
                session()->setFor('stream', $fileHash, $audioPath);
    
                // Create the stream URL with the file hash
                $streamUrl =  '/stream/' . $fileHash . '.mp3';
            }
            return $streamUrl;
        }
    }

    2. Create a custom hook to watch for the stream URL in the ready.php:

    <?php namespace ProcessWire;
    
    if (!defined("PROCESSWIRE")) {
        die();
    }
    
    wire()->addHook('/stream/([\w\d]+).mp3', function ($event) {
        // Get the audio file path by file hash
        $fileHash = $event->arguments(1);
        $audioPath = session()->getFor('stream', $fileHash);
    
        // Check whether audio file exists and stream it when it does or throw 404
        if (file_exists($audioPath)) {
            wireSendFile($audioPath, [], [
                'content-transfer-encoding' => 'chunked',
                'accept-ranges' => 'bytes',
                'cache-control' => 'no-cache'
            ]);
        }
        throw new Wire404Exception();
    });

    Ta da! 🙂 When the session expires, the session-based file hashes are destroyed and the stream URL no longer work. So every time the session is renewed with a new session ID, a new unique session-based stream URL is generated for each tracks.

    Have I missed anything or are there any security issues?

    • Like 6
    • Thanks 1
  6. Hi guys,

    I want to publish some mp3 files on my website. But I want to prevent users from linking directly to the mp3 file. Instead of using some .htaccess request hacks I want to handle it with proper session based links. Something like https://foo.bar/site/assets /[session id]/[page id]/my-fancy-song.mp3

    Once the session expires, the link to the mp3 file won't work. Does ProcessWire already provide such a solution or do I have to create it myself? Does anyone have any experience with this?

    Thank you for your support!

  7. Hi guys.

    I love FieldtypeFieldset and use it in all of my templates. Especially to add meta informations for each page.

    But I miss one simple feature: It would be cool if FieldtypeFieldsetPage would also offer a solution to make it accessible as tab instead of only a fieldset. Because FieldtypeFieldsetTabOpen has no page reference.

    Best way would be to make another module called FieldtypeFieldsetPageTab or even better, make FieldtypeFieldsetPage configurable to set the access as tab or fieldset.

    What you guys think? Any chance for an version 0.0.2 of FieldtypeFieldset with a feature upgrade?

    Best regards.

  8. Hi.

    Can anybody explain why I can add the system field "admin_theme" to a new custom template? And for example why not the system field "pass"? Is there a setting to define what system fields are addable to new custom templates?

    image.png.c06e1153549ec2855a1cf125cb160be8.png

    Thanks.

  9. Hi.

    I've stopped using PW end of last year and shut off all my websites. Until then I could add a custom composer.json in the root dir of my PW installations. But now I'm building a new website with PW and just saw in the root dir of the latest blank installation a composer.json of @ryan.

    How should I handle my custom composer settings like PSR-4 autoloading? Can I just customize and add my custom setting in the already existing composer.json like this (check the few latest lines in code below) or are there better practises?

    {
      "name": "processwire/processwire",
      "type": "library",
      "description": "ProcessWire CMS/CMF",
      "keywords": [ "processwire", "cms","cmf", "content management system" ],
      "license": "MPL-2.0",
      "homepage": "https://processwire.com",
      "authors": [
        {
          "name": "Ryan Cramer",
          "email": "ryan@processwire.com",
          "homepage": "https://processwire.com",
          "role": "Developer"
        }
      ],
      "require": {
        "php": ">=5.5",
        "ext-gd": "*"
      },
      "autoload": {
        "files": [ 
    		"wire/core/ProcessWire.php" 
    		"site/my-custom-functions.php"
    	],
    	"psr-4": {
    		"My\\Custom\\": "site/classes"
    	},
      }
    }

    Thanks for your support!

  10. Hello.

    2 years later I retested the case and still: The table of a field in the database does not get deleted.
    Why? And is there a clean up function?

    I've created a text field called "test", executed a few manipulations (added to template, saved text, etc.) and then I deleted it later on. But the table "field_test" ist still in the database.

    Thanks.

  11. Hi. Again me with a question.

    How does the migration of modules work with RockMigration? There is a watcher, but it only watches files and no database changes.

    Example: I've installed a new module installed with a few custom configurations on my dev environment (e.g. the Duplicator module). Now I want to have the module installed on prod environment too. Does RockMigrations with watcher really catch the module installation and configuration or what is the best way to do handle a new module installation and configuration?

    Thanks for your support, and no... I don't really need a first class VIP support video from @bernhard again. But you are free born of course?

  12. Yes, but $input->post helps only when the data got send as FormData. But you can post data also as json in the body of request (fewer code in JavaScript).

    Native PHP example for reading them:

    // Takes raw data from the request
    $json = file_get_contents('php://input');
    
    // Converts it into a PHP object
    $data = json_decode($json);

    Looks like PW has no functions. So I will use the native solutions from PHP. No problem ?

    • Like 2
  13. Hi,

    I've a few ajax calls from the frontend, which I handle in the _init.php file in the template folder.  The response is always json. The code works, but is there a "better" place for such code than in the _init.php?

    The functionality on my enviroment is some kind of signature/login validation which should be called on every page, idenified by a query param (e.g. /example/path?foo=1).

    Dummy example:

    if (input()->get('foo')) {
        
    	// do foo and response json 
    
    	$foo = [
    		'foo' => 'bar'
    	];
    
        header('Content-Type: application/json; charset=utf-8');
        echo json_encode($foo);
        exit;
    
    }
    
    if (input()->get('bar')) {
    
       	// do bar and response json 
    
    	$bar = [
    		'foo' => 'bar'
    	];
    
        header('Content-Type: application/json; charset=utf-8');
        echo json_encode($bar);
        exit;
    
    }

    Thanks.

  14. Hi,

    I've a simple echo output on the top of a template file. But ProcessWire outputs the echo 2 times. Does this mean the template file gets loaded 2 times? Or is there a misconfiguration on my side? I use markup regions as output strategy as you can seen with pw-id="content".

    Thanks for your support!

    image.png.524e02a0a906b97e7331a9f7dac51b9b.png

     

    image.png.7def845fe2b920ad46ee87d6a1b83928.png

    image.png

×
×
  • Create New...