Jump to content

Typografics

Members
  • Posts

    28
  • Joined

  • Last visited

  • Days Won

    1

Typografics last won the day on May 25 2018

Typografics had the most liked content!

Profile Information

  • Gender
    Female

Recent Profile Visitors

1,561 profile views

Typografics's Achievements

Jr. Member

Jr. Member (3/6)

44

Reputation

  1. Unfortunately the HannaCode module was not the solution. However I was able to fix it by looping through the data of all the registration fields before it is being sent to the "sendMail" function. This way I could overwrite the label/value/title of the selected item, the same way you would echo this value in a template and send this back to the sendMail function.
  2. Good morning, A few years ago we created a module so a registered user can be accepted or rejected. When the user fully succeeds the registration, the administrator will receive an email. We can choose the parameters for this email in a CKEditor field. It works perfectly for text fields, but it does not seem to work for a select field. The professional_activity field is a select field and in the email it only shows the index of that value and not the title (screenshot1). Is there a way I can choose to show the title instead of the index? You can see the values in screenshot 2. I already tried {professional_activity->title} and {professional_activity.title} and they both do not work. Does anyone know a solution to this? Kind Regards, Elke
  3. I enabled Tracy Debugger again and I can confirm that the problem re-appeared unfortunately..
  4. Thank you very much for the reply. Yes, we tried all of these options. The problem seems to be fixed for now by turning off Tracy Debugger and our Hosting provider made some changes as well. Because of that I do not really know what actually fixed the problem, but I'm glad it is actually fixed.
  5. Good afternoon, We deployed a Processwire website to our live environment and this goes without any problems. Only when I sign in to the backend of the website, it is not possible anymore to surf to the root URL of the website (https://websitename.com). This results in a 404 page or an infinite loop of the never ending white & empty loading screen. However, it is possible to visit all other pages on the website, only the 'homepage' cannot be visited. We only encounter this problem on our company's hosting, I do not encounter this problem on my personal hosting. We do not run into this problem with other Processwire websites on the same platform.. We asked our hosting provider to look into this, but this without any success, he does not seem to encounter any peculiarities in the website logs. Anyone had this problem before?
  6. Good morning everyone, For years we have been working with Processwire and TWIG template engine. However, now for one client when I try to deploy its website to their live environment, errors keep showing up once we a twig view will be set. We tried changing the server specs, but there does not seem to be a problem. On our local and testing environment everything works perfectly, but as soon as we put the website on the live environment, these errors keep showing up. We think there might be a problem with the writing permissions of the server. We can access the backend without any problems, but the frontend will not show up. I put writing permissions on the assets and modules folders. Is there anything else we can do? I also added a screenshot of the server specs. I hope you can help us figure this out.
  7. Hi @eelkenet, Thanks for your fix! The module still worked on our website, bit in the newest version I used your code. I updated the Github repository. https://github.com/Typografics/PaymentMollie-PW3
  8. Sorry for the delay, we had some busy weeks. But we found the time to put the files on github. https://github.com/Typografics/PaymentMollie-PW3 I also made a topic on the modules forum:
  9. Hi, We build our first PW module, so don't hesitate to share your feedback! https://github.com/Typografics/PaymentMollie-PW3 We developed this payment module for our fundraiser webshop: https://shop.typografics.be/. Here you can read the whole story. Enjoy the weekend!
  10. We check the stock trough an Ajax call each time the user selects an option. If it's not in stock anymore, the button "add to cart" stays not clickable. If it's in stock the user can add it to the cart. We also set an max in the quantity field, that's the same value as the stock is. Javascript clothing = { size: "", sex: "", product_id: "", init: function() { $('input[name="Size"], input[name="Sex"]').on('change', function (e) { clothing.size = $('input[name="Size"]:checked').val(); clothing.sex = $('input[name="Sex"]:checked').val(); clothing.product_id = $('#product_id').val(); if(clothing.sex && clothing.size && clothing.product_id) { clothing.getVariationId(); } }); }, getVariationId: function() { var url = '/api/?id=' + clothing.product_id + '&variation=clothing&size=' + clothing.size + '&sex=' + clothing.sex; $.ajax({ type: 'GET', url: url, success: function(result) { if(result){ var res = JSON.parse(result); if(res.success){ if(res.qty > 0){ $('#qty').prop('disabled', false); $('#qty').parent().removeClass('c-form-group-disabled'); $('#qty').attr("max", res.qty); $('#variation_id').val(res.id); $('#clothing .c-button').prop('disabled', false); $('#clothing .c-button').removeClass('c-button-disabled'); } else { $('#qty').prop('disabled', true); $('#qty').parent().addClass('c-form-group-disabled'); $('#qty').attr("max", 0); $('#qty').val(0); $('#variation_id').val(""); $('#clothing .c-button').prop('disabled', true); $('#clothing .c-button').addClass('c-button-disabled'); } } } }, error: function(jqXHR, textStatus, errorThrown){ } }) }, }; api.php <?php namespace ProcessWire; if(config()->ajax()) { $data = array( 'success' => input()->get('id') ); if(!input()->get('variation')){ return json_encode($data); } else { switch (input()->get('variation')){ case "clothing": if(!input()->get('id') || !input()->get('size') || !input()->get('sex')){ return json_encode($data); } else { $product_id = input()->get('id'); $size = input()->get('size'); $sex = input()->get('sex'); foreach (pages()->get($product_id)->product_variations as $v) { if (($v->size == $size) && ($v->sex == $sex)) { $data = array( 'success' => true, 'id' => $v->id, 'qty' => $v->product_quantity ); return json_encode($data); } } } break; case "default": return json_encode($data); break; } } Indeed we used the demo of @kongondo as a starting point.
  11. Each year we cycle 1000km with our company to fight against cancer. To participate with 4 teams we have to collect 20.000 euros. Our graphic designers made some goodies en we also organise a spaghetti fundraiser. To help the sales we decided to make a webshop with our webteam. And of course we used our favourite CMS for the job! ? https://shop.typografics.be/ At this moment we raised more than 20.000 euros, so all our teams can participate. This is a very special project for us, unfortunately one of our colleagues has been diagnosed with cancer and currently is fighting against this terrible disease. Premium PW modules used in this project: PadLoper FormBuilder ProFields Variations With a few hooks here and there we managed to make it work. To handle the payments we made use of Mollie, we created our own payment module and will opensource this soon. You can read more about this project in our blog (in dutch) Unfortunately we're currently only shipping to Belgium We’re already brainstorming to make a 2.0 version of this webshop, so all your feedback is more than welcome.
  12. Hello, I found & fixed an issue wich gives you an illegal string offset error in the latest PHP version. (7.1). Around line 429 you declare $return = ''; and then fill it up as an array doing $return[$key] = $value; at line 435. All you got to do is declare $return = array(); instead of $return = ''; and it should be fixed. Filling up an empty string as an array caused the errors. Can you fix this and push it to github? Kind regards, Jonathan private function parseCustom($custom) { if(trim($custom) == '') return; $return = array(); $lines = explode(PHP_EOL, $custom); foreach($lines as $line) { list($key, $value) = explode(':=', $line); $key = preg_replace('%[^A-Za-z0-9\-\.\:\_]+%', '', str_replace(' ', '-', trim($key))); $value = trim(wire('sanitizer')->text(html_entity_decode($value))); $return[$key] = $value; } return $return; }
  13. It returns the same empty array. I think it might be something with the permissions. But I'm not seeing what is wrong.
  14. Hello, I've been developing a general settings module for our websites. I'm storing the settings data in the module config data, but I can't seem to get the data working at the front-end of our website. I'm trying to call the data in my template like this: modules()->getConfig('TypoSettings'); Wich returns me an empty array. Am I doing something wrong? Or has it something to do with module permissions? Full module code: <?php namespace ProcessWire; /* * TypoSettings */ class TypoSettings extends Process implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => "TypoSettings", 'version' => "0.0.1", 'summary' => "An awesome module for saving your general site settings.", 'author' => "Jonathan Claeys", 'href' => "", 'icon' => "cog", 'autoload' => false, 'singular' => true, 'requires' => "ProcessWire>=2.5", "permissions" => array( "setting-view" => "View the general sitewide settings.", "setting-edit" => "Edit the general sitewide settings." ), ); } public function init(){ modules()->get('JqueryWireTabs'); parent::init(); } public function ___execute(){ return $this->createForm($this->getDefaultData()); } static public function getDefaultData(){ return array( /* * General */ 'settings_general_tab' => array( 'type' => 'InputfieldTab', 'label' => __('General') ), 'settings_client' => array( 'type' => 'InputfieldText', 'label' => __('Client'), 'value' => 'Typografics', 'required' => 1 ), 'settings_email' => array( 'type' => 'InputfieldEmail', 'label' => __('E-mail'), 'value' => 'info@typografics.be', 'required' => 1 ), 'settings_telephone' => array( 'type' => 'InputfieldText', 'label' => __('Telephone'), 'value' => '', 'required' => 0 ), 'settings_fax' => array( 'type' => 'InputfieldText', 'label' => __('Fax'), 'value' => '', 'required' => 0 ), 'settings_general_tab_end' => array( 'type' => 'InputfieldTabEnd' ), /* * Location */ 'settings_location_tab' => array( 'type' => 'InputfieldTab', 'label' => __('Location') ), 'settings_address' => array( 'type' => 'InputfieldText', 'label' => __('Address'), 'value' => 'Zwaarveld 45', 'required' => 1 ), 'settings_postal_code' => array( 'type' => 'InputfieldText', 'label' => __('Postal code'), 'value' => '9220', 'required' => 1, 'columnWidth' => 33 ), 'settings_city' => array( 'type' => 'InputfieldText', 'label' => __('City'), 'value' => 'Hamme', 'required' => 1, 'columnWidth' => 67 ), 'settings_location_tab_end' => array( 'type' => 'InputfieldTabEnd' ), /* * Social media */ 'settings_social_tab' => array( 'type' => 'InputfieldTab', 'label' => __('Social media') ), 'settings_facebook' => array( 'type' => 'InputfieldText', 'label' => __('Facebook'), 'value' => '', 'required' => 0 ), 'settings_linkedin' => array( 'type' => 'InputfieldText', 'label' => __('LinkedIn'), 'value' => '', 'required' => 0 ), 'settings_google_plus' => array( 'type' => 'InputfieldText', 'label' => __('Google Plus'), 'value' => '', 'required' => 0 ), 'settings_twitter' => array( 'type' => 'InputfieldText', 'label' => __('Twitter'), 'value' => '', 'required' => 0 ), 'settings_pinterest' => array( 'type' => 'InputfieldText', 'label' => __('Pinterest'), 'value' => '', 'required' => 0 ), 'settings_instagram' => array( 'type' => 'InputfieldText', 'label' => __('Instagram'), 'value' => '', 'required' => 0 ), 'settings_social_tab_end' => array( 'type' => 'InputfieldTabEnd' ), ); } public function __construct(){ foreach (self::getDefaultData() as $key => $value) { $this->$key = $value; } } static public function getModuleConfigInputfields(array $data) { $defaults = self::getDefaultData(); $data = array_merge($defaults, $data); $fields = new InputfieldWrapper(); foreach($data as $key => $inputfield){ if (!isset($inputfield['type'])) { continue; } switch ($inputfield['type']){ case 'InputfieldTab': break; case 'InputfieldTabEnd': break; default: $field = modules()->get($inputfield['type']); $field->attr('id+name', $key); $field->label = $inputfield['label']; $field->required = $inputfield['required']; $field->value = $data[$key]['value']; $fields->append($field); } } return $fields; } public function createForm($inputfields){ /* * Create form */ $form = $this->modules->get('InputfieldForm'); $form->action = './'; $form->method = 'post'; $form->attr('id+name', 'TypoSettings'); /* * Add inputfields */ $data = modules()->getConfig('TypoSettings'); foreach($inputfields as $key => $inputfield){ switch ($inputfield['type']){ case 'InputfieldTab': $tab = new InputfieldWrapper(); $tab->attr("title", $inputfield['label']); break; case 'InputfieldTabEnd': $form->append($tab); unset($tab); break; default: $field = modules()->get($inputfield['type']); $field->attr('id+name', $key); $field->label = $inputfield['label']; $field->required = $inputfield['required']; if(isset($inputfield['columnWidth'])){ $field->columnWidth = $inputfield['columnWidth']; } $field->value = (isset($data[$key]) ? $data[$key] : $inputfield['value']); $tab->append($field); } } /* * Add submit */ $submit = modules()->get("InputfieldSubmit"); $submit->attr("value", __("Save")); $submit->attr("id+name","submit"); $form->append($submit); /* * Process form */ if(input()->post->submit){ $data = modules()->getConfig('TypoSettings'); foreach($this->getDefaultData() as $key => $inputfield){ if($inputfield['type'] != 'InputfieldTab' && $inputfield['type'] != 'InputfieldTabEnd'){ if($inputfield['required'] && empty(input()->post->{$key})){ page()->error(sprintf(__('%1$s is a required field. (%2$s field was not updated)'), $inputfield['label'], $inputfield['label'])); }else{ $data[$key] = input()->post->{$key}; } } } modules()->saveConfig('TypoSettings', $data); page()->message($this->_('Saved Settings')); session()->redirect(page()->url); }else{ $out = $form->render(); } return $out; } const modulePage = 'settings'; const permissionView = 'setting-view'; const permissionEdit = 'setting-edit'; public function ___install(){ $page = $this->pages->get('template=admin,name='.self::modulePage); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'Settings'; $page->name = self::modulePage; $page->process = $this; $page->save(); } $permissionView = $this->permissions->get(self::permissionView); if (!$permissionView->id){ $permissionView = new Permission(); $permissionView->name = self::permissionView; $permissionView->title = $this->_('View the general sitewide settings.'); $permissionView->save(); } $permissionEdit = $this->permissions->get(self::permissionEdit); if (!$permissionEdit->id){ $permissionEdit = new Permission(); $permissionEdit->name = self::permissionEdit; $permissionEdit->title = $this->_('Edit the general sitewide settings.'); $permissionEdit->save(); } } public function ___uninstall() { $page = $this->pages->get('template=admin, name='.self::modulePage); if ($page->id) { $page->delete(); } $permissionView = $this->permissions->get(self::permissionView); if ($permissionView->id){ $permissionView->delete(); } $permissionEdit = $this->permissions->get(self::permissionEdit); if ($permissionEdit->id){ $permissionEdit->delete(); } } }
  15. Thanks for your reply, Have now access to the vip forum of padloper, now I can download the 3.0 version
×
×
  • Create New...