Jump to content

doolak

Members
  • Posts

    319
  • Joined

  • Last visited

Everything posted by doolak

  1. I still could not solve that problem - does anybody have an idea how I could work this out?
  2. So for the moment I have solved this again with jQuery - almost solved... Here the module file: <?php class PopulateTitle extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Populate Title', 'version' => 101, 'summary' => 'Populate the title field dynamically', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('ProcessPageAdd::execute', $this, 'addScript'); $this->addHookAfter('save', $this, 'addScript2'); } public function addScript(HookEvent $event) { $this->config->scripts->add($this->config->urls->PopulateTitle . "populate_title.js"); } public function addScript2(HookEvent $event) { $this->page = $this->pages->get($this->input->get->id); if ($this->page->template == produkt) { $this->config->scripts->add($this->config->urls->PopulateTitle . "populate_title2.js"); } } } And here the two scripts: populate_title.js: jQuery(document).ready(function() { if($("#notices div.container:contains('produkt')").length) { $('input[name=title]').val(new Date().getTime()); $('input[name=_pw_page_name]').val(new Date().getTime()); $('#wrap_Inputfield_title').hide(); $('#wrap_Inputfield_name').hide(); $('#submit_save').trigger('click'); } }); populate_title2.js: jQuery(document).ready(function() { if($('input[name=produkt_marke]').val() == '') { $('#title').empty(); $('#title').append('Neues Produkt'); } else { $unfiltered = $('input[name=produkt_marke]').val() + " " + $('input[name=produkt_art]').val() + " " + $('input[name=produkt_typ]').val(); $('#title').empty(); $('#title').append($unfiltered); $filtered = $unfiltered.toLowerCase().replace(/[\*\^\'\!\,]/g, '').replace(/[\.]/g, '-').split(' ').join('-'); $('input[name=title]').val($unfiltered); $('input[name=_pw_page_name]').val($filtered); $('#Inputfield_name_path').find('strong').text($filtered); } }); Almost everything works fine, just one problem resists: After changing one of the fields "produkt_marke", "produkt_art" or "produkt"typ" and saving the page, the path of the page is not changed (the page is saved under the old path) and even if the page title is changed it is displayed under the page tree with the old name. Any idea how to solve this? If I save the page manually again - everything is fine. So it has to be saved two times after editing. This would be a quick solution (of course not the nicest) too - but I don't know how to have it saved once again after saving it manually one time...
  3. Hi again, in the examples above I have used jQuery to check the template of the page which should be added. Actually I didn't check the template, I checked the parent id... Now I really need to check the template which will be added and I would like to to this in the module and I tried this: <?php class PopulateTitle extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Populate Title', 'version' => 101, 'summary' => 'Populate the title field dynamically', 'singular' => true, 'autoload' => true, ); } public function init() { $this->page = $this->pages->get($this->input->get->id); if ($this->page->template == produkt) { $this->addHookAfter('ProcessPageAdd::execute', $this, 'addScript'); } } public function addScript(HookEvent $event) { $this->config->scripts->add($this->config->urls->PopulateTitle . "populate_title.js"); } } Of course this does not work, because it (probably) checks the template of the actual page, not of the page which should be added. I could find just one part in the source of the admin page which references the template which will be added: <ul id='notices' class='ui-widget'> <li class='ui-state-highlight NoticeMessage'><div class='container'><p><span class='ui-icon ui-icon-info'></span>You are adding a page using the 'produkt' template</p></div></li> </ul><!--/notices--> So it would be possible to check the content of the ul "notices" for the string "produkt" - but I would prefer to check this directly in the modul file by changing the part below: public function init() { $this->page = $this->pages->get($this->input->get->id); if ($this->page->template == produkt) { $this->addHookAfter('ProcessPageAdd::execute', $this, 'addScript'); } } Already tried different things with $this->getAllowedTemplates() - but unfortunately I have no idea how to get it work and would appreciate your help...
  4. Once again: Absolute fantastico - thanks a lot, nik!
  5. Now I found something, seems to be not so easy: http://processwire.com/talk/topic/4123-decimal-point-changed-to-in-base-of-setlocale/?hl=%2Bfloat+%2Bfield
  6. I have set the "Number of decimal digits to round to" to 7 - this should be correct to make prices possible up to 99999.99 - but it always rounds the zeros away, so I would need a method to display the integer in a different format. Just couldn't find any information about this in the API or in the forum.
  7. For the moment the costumer just would like to copy paste the table into the editor - this works great but I suggested him that it would be better to find a possibility to import the tables in a different way. But then I would have to find a possibility to make this so easy like it's now with drag and drop... ;-) I guess It will be necessary to write a module for this or maybe rewrite the "Import CSV to pages"... So I will leave it like it is for the moment and maybe come back later to this point - if the costumer is happy with the table as it is - why not? ;-) Thanks a lot for your help!!!
  8. This works fine - just have to find out how I can display the prices than always with all decimals. At the moment prices will be dispayed like this: 33 69.5 599 I would like to have: 33.00 69.50 599.00 Or best would be with "," instead of the point Or would there be another possibility to sort prices like described above?
  9. What kind of field do I have to use if I want to sort by price? If I use a textfield, I can use commas, but it will not sort correctly. If I use an integer field, I somehow cannot use a comma... Is there somewhere an option to have the possibility to use commas in the integer field and avoid the behaviour that the value is truncated to a vaklue without comma? Or is there another possibility to sort by price like follow, without having to enter "Euro" and "Cent" seperately: 569,00 799,00 799,50 850,00 900,00
  10. Yes, I guess this should work fine - just it will not be possible to have all "parameters" as seperate field, because the already existing tables are using the first column of the table as "Label" so with "Import pages from CSV" I will have to import the data as follows: - product page - subpage with title "Name", second field empty and third field the name of the product - subpage with title "height", second field "cm" and third field "38" - etc. The tables are always structured like that, so I could have predefined fields like "weight", "height" etc. - so one would have just to choose if it's column 1, column 2, column 3 etc. during the import with "Import pages from CSV". Will this just "read" and display the Excel data or add all the data to the database? This sounds as it could do exactly what I need, but I have to dig into that stuff first and it will be maybe not easy to code this... There are a lot of different "fields" - what do you mean with "copy and paste"? Where should it been pasted?
  11. Thanks for your answer, diogo! This would be a possibility to have the tables displayed properly - but it will be a lot of data sets which has to be imtegrated, maybe 50.000 to 100.000 products, so this will too much work to include them. And I would prefer to import the data into fields, not just embed the table into the website. So it would be possible then to use that data later for other purposes. One idea which I have now in my mind is the following: 1. convert the Excel table to CSV and import with "Import pages from CSV files" each row of the table as page, which will be a subpage of the corresponding product page then 2. run a script which verifies if the product page has such subpages, and then adds the data of the subpages as fields to the product page This maybe could work, one just would have to run the script after importing the CSV - but that would be just ok I guess. What do you think about this possibility? Or do you have a better idea?
  12. Hi all, I need to display an Excel table in a page - of course it would generally be possible just to copy and paste this (seems to work fine in the actual IE) but as the behaviour how it will be imported in the Textfield (TinyMCE) will always be dependend on the behaviour of the browser etc. I would prefer to have the single datas of the table imported in seperate fields. I used "Import csv to Pages" several times for similar purposes - but in this case it would be necessary to import the data not in seperate pages but in seperate fields on one page. And, another problem is, that the excel tables are sorted like this: Does anybody have an idea how one could import such data into a page?
  13. So for repeaters dependencies could just be used via the API, not in the field settings, right?
  14. How would the syntax for verifying such a field in a repeater could look like in general? E.g. if the repeater "contentblock" has a field "contentblock_headline" I tried the following, which doesn't work: $contentblock->contentblock_headline!='' Has anybody successfully verified a field within a repeater and could tell me how to do that?
  15. The problem is as follows: There are lots of galleries, on every page there are just 12 displayed (with pagination). If someone was visiting e.g. page 4 of the paginated gallery pages and chooses one gallery to view - he should have the option to go back to the gallery overview, but to page 4 of this, not to the first page. E.g.: The visitor was on http://www.xyz.de/galerie/page3 and watched one of the shown galleries When klicking "back to the overview" he should get back to http://www.xyz.de/galerie/page3 - not to http://www.xyz.de/galerie/
  16. Hi there, I am using pagination for several templates of a site (e.g. a gallery, news). The mentioned contents are displayed in the main content area of the website - and there is a sidebar where several content boxes are shown. One of this boxes shows a limited number of pages of a specific template: $positionen = $pages->find("template=tabelle_position, limit=10"); Now I just discovered that somehow this content-box will use pagination too when displayed of one of the paginated templates mentioned above. But that box should have no pagination, but show allways the first 10 pages... Is there a possibility to deactivate pagination for such a content box?
  17. No, it is something different than numChildren. pageNum displays the current page number if you are using pagination.
  18. Hi there, as the title says I am trying to check the pageNum of a parent page - something like: $page->parent->pageNum (wich does not work) Any idea if and how one could do this? Cheers, Christian
  19. Ok, got it - and I have to say once again: "Thanks, Soma!" Here the thread and the post with the solution: http://processwire.com/talk/topic/1272-new-page-nav-in-admin/?p=11276 The important part is the setting of the moduls permisson: public static function getModuleInfo() { return array( 'title' => 'Import Tabelle als CSV', 'version' => 103, 'summary' => 'Import CSV files to create ProcessWire pages.', 'singular' => true, 'autoload' => false, 'permission' => 'page-edit' ); In this way the modul is editable by a non-superuser and can be accessed through the top navigation.
  20. Yes, you have to change the children settings for that template once to move the page, then set it back to the standard settings. And I tried a second possibility: I copied the admin template and gave that other permissions. But somehow I couldn't manage it to make the page viewable in the top navigation for a non-superuser...
  21. Yes, I know it is accessible through the "Setup" - but this part of the navigation is not allowed for a normal editor, just for a superuser. I would like to make it available for a non-superuser in the top navigation ;-)
  22. Is there a possibility to make the module available for an editor? If I move it out of the "admin" tree - it is available, but he has to click "view" to see the module. Would it be possible to leave it in the admin tree and make it visible in the top navigation for him?
  23. Hi slkwrm, yes - recognized that mistake - just found the description of the module: "Provices a page search engine for admin use." ... Searching repeater fields through the API seems to work fine here the way you described it, thanks a lot! $matches = $pages->find('myrepeater.myrepeaterfield*=$q');
×
×
  • Create New...