Jump to content

PWaddict

Members
  • Posts

    926
  • Joined

  • Last visited

  • Days Won

    1

PWaddict last won the day on December 7 2018

PWaddict had the most liked content!

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

4,972 profile views

PWaddict's Achievements

Hero Member

Hero Member (6/6)

439

Reputation

  1. Hi there. I'm using ProcessWire on Litespeed servers for 10+ years. There are NO compatibility issues. Everything you do with regular Apache you can do on Litespeed too. Google "Litespeed vs Apache" and you can easily find out why you should stay with Litespeed 🙂
  2. Hello, I'm outputing repeater content in ProcessWire way like this instead of the classic foreach. <?= preg_replace('/(.*),/','$1 &', $page->datetimes->implode(", ", "{day} {time_start}-{time_end}")) // Monday 19:00-21:00, Tuesday 19:00-21:00 & Wednesday 19:00-21:00 ?> Is there a ProcessWire way to output the content like below where if the time_start and time_end have the same values on all days then display them only once at the end of the string: Monday, Tuesday & Wednesday 19:00-21:00
  3. Yep, Stripe is easier because it has way much better documentation than PayPal. @bernhard You will probably get more help by checking out my PayPal module than looking at the PayPal documentation.
  4. That's great. Stripe Seamless Integration Stripe Payment Element PayPal Seamless Integration PayPal Standard Checkout PayPal Advanced Checkout
  5. @bernhard Mollie is supported ONLY on 32 countries and half of them are required to have a minimum sales volume. You will instantly exclude potential customers from many countries including USA. More info here. Stripe is supported on 50 countries and PayPal on more than 200. I think it will be better if you create a system with external payment modules where the RockCommerce clients will be able to use your ready-made payment modules for Mollie, Stripe, PayPal or they can create their own for any other payment provider. I don't know if Mollie supports it but PayPal and Stripe supports seamless integration too. The user completes the payment without leaving the client's website which is by far the best solution. I'm still a Padloper 1 user and created my own modules to do that for PayPal and Stripe (I haven't released it yet).
  6. Unfortunately that way if a site editor edit the custom page and the superuser never edited it before, the default field value from construct method will not get saved. Feel free to check my process module code here.
  7. Hello! How can I set access to superuser only to a field that is created programmatically and doesn't belong to any template? Here is the code of the field that is part of a process module where that field is accessed by a custom page under setup: $field = $modules->get('InputfieldText'); $field->attr('name', 'myfield'); $field->label = $this->_('My Field'); $field->attr('value', $this->myfield); $form->add($field);
  8. Thanks @poljpocket I've edited the code on my post above.
  9. Thank you for the replies. @poljpocket yep I misunderstood it indeed but I figured it out. I had to make the Process module as ConfigurableModule even with no config fields so I can save the values from my programmatically fields of buildForm() to module's database field "data" by using getConfig() and saveConfig(). Here is a full code sample: <?php namespace ProcessWire; class ProcessModuleTest extends Process implements ConfigModule { public static function getModuleInfo() { return array( 'title' => 'My Process Module', 'summary' => 'Setup My Process Module', 'version' => 100, 'icon' => 'cog' ); } public function __construct() { parent::__construct(); $this->set('my_text_field_1', ''); $this->set('my_text_field_2', ''); } public function ___execute() { $form = $this->buildForm(); if($this->input->post('submit_save')) { $this->processForm($form); $this->session->redirect('./'); } return $form->render(); } protected function ___processForm(InputfieldForm $form) { $input = $this->wire('input'); $data = $this->wire('modules')->getConfig($this); $form->processInput($input->post); $data['my_text_field_1'] = $form->getChildByName('my_text_field_1')->val(); $data['my_text_field_2'] = $form->getChildByName('my_text_field_2')->val(); if(count($form->getErrors())) return; $this->wire('modules')->saveConfig($this, $data); $this->message($this->_('Saved My Process Module Settings')); } protected function ___buildForm() { $modules = $this->wire()->modules; $form = $modules->get('InputfieldForm'); $form->attr('id', 'ProcessModuleTest'); $form->attr('method', 'post'); $form->attr('action', './'); $field = $modules->get('InputfieldText'); $field->attr('name', 'my_text_field_1'); $field->label = $this->_('My Text Field 1'); $field->attr('value', $this->my_text_field_1); $form->add($field); $field = $modules->get('InputfieldText'); $field->attr('name', 'my_text_field_2'); $field->label = $this->_('My Text Field 2'); $field->attr('value', $this->my_text_field_2); $form->add($field); $submit = $modules->get('InputfieldSubmit'); $submit->attr('value', $this->_('Submit')); $submit->attr('id+name', 'submit_save'); $form->add($submit); return $form; } protected function getInstalledPage() { $admin = $this->pages->get($this->config->adminRootPageID); $parent = $admin->child("name=setup"); if(!$parent->id) $parent = $admin; $name = 'my-process-module'; $page = $parent->child("name=$name"); if(!$page->id) { $info = ProcessModuleTest::getModuleInfo(); $page = new Page(); $page->parent = $parent; $page->template = 'admin'; $page->name = $name; $page->title = $info['title']; $page->icon = $info['icon']; $page->process = $this; $page->sort = $parent->numChildren; $page->save(); } return $page; } public function ___install() { parent::___install(); // Process modules must call parent method $page = $this->getInstalledPage(); $this->message(sprintf($this->_('Installed to %s'), $page->path)); } public function ___uninstall() { parent::___uninstall(); // Process modules must call parent method $page = $this->getInstalledPage(); if(!$page->id) return; $this->message(sprintf($this->_('Removed %s'), $page->path)); $this->pages->delete($page); } } Then on the frontend I can get a field value like that: echo $modules->getConfig('ProcessModuleTest', 'my_text_field_1');
  10. Hello! I'm trying to create a Process module where the fields need to be on the custom Process page (under Setup) instead of the module screen. Here is my code so far and the problem is that the value on the field doesn't getting saved. Any help? <?php namespace ProcessWire; class ProcessModuleTest extends Process { public static function getModuleInfo() { return array( 'title' => 'My Process Module', 'summary' => 'Setup My Process Module', 'version' => 100, 'page' => array( 'name' => 'my-process-module', 'title' => 'My Process Module', 'parent' => 'setup', ) ); } public function ___execute() { $form = $this->buildForm(); if($this->input->post('submit_save')) { $this->processForm($form); $this->session->redirect('./'); } return $form->render(); } protected function ___processForm(InputfieldForm $form) { $input = $this->wire('input'); $form->processInput($input->post); $this->message($this->_('Saved!')); } protected function ___buildForm() { $modules = $this->wire()->modules; $form = $modules->get('InputfieldForm'); $form->attr('id', 'ProcessModuleTest'); $form->attr('method', 'post'); $form->attr('action', './'); $field = $modules->get('InputfieldText'); $field->attr('name', 'my_text_field'); $field->label = $this->_('My Text Field'); $form->add($field); $submit = $modules->get('InputfieldSubmit'); $submit->attr('value', $this->_('Submit')); $submit->attr('id+name', 'submit_save'); $form->add($submit); return $form; } }
  11. FontAwesome Upgrade ProcessWire's backend with the latest Font Awesome free icons (solid + brands). Install Link: https://github.com/PWaddict/FontAwesome Copy all files included in this module into new directory /site/modules/FontAwesome/. In the ProcessWire admin, go to Modules > Refresh. Click install for the Font Awesome module. IMPORTANT: The module has a duplicated folder of the core's InputfieldIcon module where only 2 files (icons.inc, InputfieldIcon.js) have been modified so you must select the InputfieldIcon version from Font Awesome module to load. To do that go to InputfieldIcon module screen by using search or refreshing modules (you will get the duplicated notification) and on the section "Module file to use" select the proper version and click on Submit button.
  12. Thank you guys for the suggestions. Since I don't have the ProDevTools module yet I will try @bernhard's idea soon.
  13. Hello! Let's say an admin is editing a product page that contains a quantity field with the value "10". During that time a user is completing an order with the product that currently the admin is editing and the quantity field value is changed programatically to "9". All good so far. Here is the problem: If the admin finished editing the page and press Save, the quantity field value will be changed back to "10" even though he didn't touched that value as that was the value when he opened the page to edit. How can I prevent this? How do you solve this issue?
  14. Nevermind, I just saw the following note on PadCart.module (Padloper 1) so I guess you can easily have multiple carts on both Padloper versions by duplicating PadCart.module and renaming it's Class and $dbname value ? 'singular' => false, // You can have multiple carts available EDIT: Probably, I will also have to duplicate more files like PadLoper.module, PadOrderProcess.php, PadOnePageCheckout.module and change their $this->cart values.
×
×
  • Create New...