OLSA

Members
  • Content count

    71
  • Joined

  • Last visited

Community Reputation

40 Excellent

About OLSA

  • Rank
    Full Member

Profile Information

  • Gender
    Male

Recent Profile Visitors

2,105 profile views
  1. Hello, Try to add at the top of your included form1.php this: namespace ProcessWire; Regards.
  2. Bravo diogo! There is no option to give you 10+. Please don't be like others communities where is restricted to tell the true. Processwire is developer oriented platform and need to write code if you want to do custom things. Not like in Joomla or Wordress where you can install template and do things without coding, but also many of us here were there ( for years) but stay with Processwire. Regards.
  3. No, no in this product had very large place for clean categorisation. It is very easy to separate tools and showers or tiles or parquet or painting colors... Except, had that problem on category level, but for that use "tags". As example, in category "Tools" are about 100 products, but also inside that category had tags "for painting", "cleaning"... Also know what are you talking here, as example in some rental site some house can go to rent and sell at the same time (that was my client request in one project). Solved that without problem using "tags". Low level item is property, but same property can have various status... Also property can be house, flat, ship...whatever...
  4. This is off-topic, but In the previous message i promise something, as example here is drag and drop JSON tree page module - totally unpolished. Also, please that this topic go in same direction as it started. This is only short of-topic. What this module do: 1: clone page tree and build JSON string (it's good if you have few thousands of pages), and in rendering you don't have in runtime to build main menu 2: if you have some speciall cases where need to do some correction for main menu, you can do it very fast and easy (do not need to "move" DB large page tree, you "moves" inside small JSON) 3: you can save ("export") somewhere current tree, and experimenting with menu 4: you can create page tree Menu, and child "Top menu", "Sidebars", "Fotter menu" etc... I build this for this project, and main target was to leave real PW page tree, but add options to manipulate with that if needed. Also one of target was to get faster page rendering, done testing (in this project with >2000 pages, get faster pages rendering about 25% and more). How use it: 1) download attached zipp (at the bottom of this message) and install like any other PW module 2) create field "JSON tree" and place it on some template ("menu", or if you like place it on "home", or...) 3) you can add pages one by one (first tab), or if you have large page tree, in second tab set your "max deep level", set what parent you want to skip their children, and press "Create list" 4) press Save 5) now you can drag and drop and create custom tree (and after changes press save) How to edit: Press on some list item button "edit", in bottom you will get that page selected, change that to some another page... And press Save. How to create "Label" item, in next version that would be different, but now it's can be done: 1) Create template "label" (only title field), create some pages ("labels"), and after select that pages inside JSON tree and append children to it (drag and drop). 2) In rendering process check if template=='label'... How to render: As example, call: // field is on some page // fieldname is "tree" $menu = $pages->get(3600); // var_dump($menu->tree); echo mainMenu( json_decode( $menu->tree)); // mainMenu is method in function.php, there you go through tree and create UL,LI... IMPORTANT NOTES: 1) What is inside "mainMenu" function (you can do var_dump...)? Main part is to call JSON object element attributes, main is "pwid" to get real page object. Also, if you don't build multilanguage websites, you don't have to call PW page (there is also attribute "slug"). // function.php // you need to create function inside function.php // this is only example function mainMenu($items){ $out = ''; foreach( $items as $item ){ // please note main attribute "pwid" it's store PW page id $i = wire('pages')->getById($item->pwid)->first();// in my example need this because multilanguage project . . . . } } NOTE: this module is totally unpolished (version: 0.0.0)! Here are some screenshots. - First image shows process when module clone PW page tree where you can add desired pages to list. - Second image shows option where you can add pages one by one, or select multiple and add. - Third image shows what happened after you press button "Add to list" or "Create list". Regards. FieldtypeJSONtree.zip
  5. Thank you Zeka, Can't use this concept because, as example, they have category "faucets", and there are "faucets" for kitchen and for bathroom. Also they have "colors" for wall paintings, "floors" (wall tiles for kitchen or bathrooms can be the same product), and there are other examples where can't use that principle (divide products by area)... Also, grouping categories really helps to get cleaner administration, but also get me in another "problem" where I get unbalanced page tree (levels), as example: 1) products: - faucets ---- faucet-product-1 ---- faucet-produc-2 . . - floors ---- parquet -------- parquet-product-1 ---- laminate -------- laminate-product-1 I use PW few years, and build many custom things (not polished yet to put it here, but will do it for this great/the best community), but never use PW concept with URL segments. Read about that, sounds to me very interesting, but never had time to investigate, how and when... Yes thinking about that, but that not decided to use that concept because in administration would be chaos (initial content is ~2000 products, but client has plan to place 10 to 20 000 products, build importers..). Also for ajax, filters.. in backend is "easier"... "where parent category is my parent"... In all I agree with you, but sorry because in first topic, I didn't write other details about this website. Thanks.
  6. Hello for all, these days finishing project what is combination of e-commerce and portal website. Problem is "Products" page-tree because content need to be divided inside 48 categories. Also the client gave me content divided in 68 categories, but at the end they accepted my proposal about reducing that number. But problem is that and with 48 categories in backend, "Products" page tree is very large, long list, and very hard for administration. On front-end mega-menu with labels (menu group headings) solved that problem for vistors. And, at the end, I decided to test variant with additional categories to group categories, and result is good (now it's easy for adminsitration to find what they want very easy). Problem: now urls are longer, and in some parts (categories) not sure how that's can affect on SEO (eg. before: "products/showers/some-product", now: "products/showers-and-bathtubs/showers/some-product"). There are few more examples like that. And another thing is that urls are now longer (more characters, and deeper). For better administration I added new level of categorisation - I think - that is not a way to go. What is your opinion or suggestion about that? Maybe different, custom admin template, with custom navigation, or some folders? or ...? Thanks.
  7. Thank you Robin S! "status=published" solved my problem. I was sure that eg. outlet=0 or outlet='' will work and didn't think that there might be some new selectors (need to read this). No everything need to be simple as possible. If in edit procedure product doesn't have visible group - it's not in a group. Group is "virtual" product item (can change...), not like "TV" or "sofa", and because of that administration can do with group what they like (eg. update: change image and append new product to group). Probably, after they sell "group item", they will delete group page. Here is more important to delete real products (if no products, no group) . Ok, very interesting, will try it. Thanks Robin S.
  8. Hello for all, sorry for this topic title but let me try to explain. Website has product items, where sometimes products go to "Outlet" (actions/discounts). Main part here is that in "action" status: a) product can have new price and go alone to discount OR b) product is in group with other products ("collection", and new price is only valid in case when customer buy full collection). First problem was how to get this : Product items: A on action B on action in group with "D" C on action D on action in group with "B" --------------------------------------------------- Outlet list page need to show 3 items: 1. item (A) 2. item (B, D) (eg. item image is "TV+sofa") 3. item (C) First what I done, was that I created Outlet "category" with children, where children page has fields: title, group image and page select field (to select products from another page tree). But that was wrong and dirty (few foreach, pagination..., etc. that was bad concept). Than I decided to place page select field on product item, and from product item select it's group (single select field). And that was ok, and I like it also because administration in any variant need to go to product to set new price. Right now, administration first create group page with some title and with some image. After that, go to product item, check field "action", write new price, and - if - product is part of group - add - it to group. There is part of code on "Outlet" list page: // outlet-list.php // $items: single items // outlet: page field, it's parent is "Outlet" list page $items = $pages->find('template=product-item, action=1, outlet.count=0'); // outlet=0 or outlet=''... $group_items = $pages->find('template=product-item, action=1, outlet.count>0'); // group items ("merge") foreach( $page->children() as $group ){ // go through Outlet children ("group id pages") if($group_items->has("outlet=$group->id")){ // if in array are items with that group id $group->singles = $group_items->find("outlet=$group->id"); // append to page "group" new attribute and fill it $items->add($group); // now go back and append to "items" new type of "item" } } // pagination $pagination = $items->renderPager(); After it in rendering process I get basic product items, and "group" items together inside list page. Here is the problem: When I go and set some of Group page as "unpublished", I expect, after it, to get that group subitems shows as alone (singles) inside Outlet. But not. They doesn't shows!? In that case outlet.count return null, but real "singles" return false. I try more options with selector (and different page select field types) but can't get what expect to be. // selector to return singles 'template=product-item, action=1, outlet.count=0' // tried options outlet=0, outlet='', outlet=0|"", outlet.count<1 etc... Sorry for this long, long topic. If someone has some idea what and where... I would be grateful Best regards! p.s. if all this is confused, last sleeping was... can't remember
  9. Hello for all, don't know If I understand You well, but if you are using PW inputfields (modules/API) to build form, than to remove label from some field need to do that in two small steps. First set field label as blank (""), and after it set option "skiplabel" to "true". Example: $myfield->label = ''; $myfield->skipLabel = true; Regards.
  10. Hello for all, also had problem with this warning, and read this and this and find why that's added in PW. My problem was that I don't have CPanel permissions (only to login to website admin/backend). Website is multilanguage (3 languages, Montenegro, English and Russian) and try few options for all languages, but always after logout/login get warning message. There is little confused note: "Default is 'C'. Specify '0' to skip the setlocale() call (and carry on system default)." I try with "0" to all, but that don't solve problem. Also not sure about "C", maybe need to change note to this: "Specify 'C.UTF-8', or '0' to skip the setlocale() call (and carry on system default)." Because webiste is hosted on one of the popular european hosting providers, I assumed that there is probably set_locale supported/installed for languages like English, and Russian, but not sure about Montenegro, and try this: Montenegro: C.UTF-8 English: en_US.UTF-8 Russian: ru_RU.UTF-8 And that fix problem. Regards.
  11. Hello for all, I created "admin" role and what I want for that rolle is just restriction to see "Admin" and "system/tools" page tree, but also option to delete pages from list tree. +1 for delete permission
  12. Hello, today I need this and try adrian and Soma solutions but with partial success (PW 3.0.42). Finally solved with this: wire()->addHookBefore('Pages::saveReady', function(HookEvent $event) { $page = $event->arguments('page'); if($page->template != "your_specific_template_name") return; if($page->isChanged('your_target_field_name')){ // your code $this->message('Your message about changes...'); } }); Main difference is "changes" argument, or $page->isChanged('some_field_name') Regards.
  13. Hello Brian. Just saw only two files and here are small suggestions for better practice ( pages->find inside foreach and count inside for loops). insider-home.php // line 2. foreach ($pages->find("articleInsider=1") as $article){ ... } better is this: $articles = $pages->find("articleInsider=1"); foreach ($articles as $article){ ... } or article.php // 46. line for ($i=0; $i < count($titleArr); $i++) { ... } to this $c = count($titleArr); for ($i=0; $i < $c; $i++) { .... } It's not problem if do this inside if statement eg. if( count($pages->find...) > 1 ). Regards.
  14. Hello Vikestart, for that you can use "tags". To create "tags" there are many options and here is one: 1) create template "tags" 2) create template "tag" with only deafult field "title" 3) create field "tags", type page ( my suggestion is to use Lostkobrakai module Chosen Select ), and add it to "movie" template *** note: for page field "tags" set as parent page "Tags" (example below) As example here is some page tree: - Home - About Us - Movies --- Horror ------ Some Horror Movie (eg. template "movie" with your custom fields - and one is field "tags" (3.) ) --- Thriller ------ Some Thriller Movie ( -//- -//- -//- ) - Contact - Tags ( template: "tags", page/settings: hidden ) --- Horror (template: "tag") --- Thriller (-//-) --- Scifi --- etc After that inside movies set "tags" for every movie (one or multiple tags per movie). 1) Here is example how to get Some Horror-Thriller inside your category Thriller's: // on page "Thriller" $search_term = $sanitizer->text($page->title); // thriller $items = $pages->find("tags.title%=$search_term, sort=-sort"); // here you can add more precious filters... 2) You have some "Tags Cloud" widget (eg. in some sidebar) <?php // tags cloud $tags = $pages->find("template=tag, include=all");// include=all because of hidden parent ?> <div class="widget tags-cloud"> <?php foreach($tags as $tag): ?> <a href="<?php echo $tag->url;?>"><?php echo $tag->title;?></a> <?php endforeach; ?> </div> Maybe links inside "tags-cloud" are little confused, eg. "my-website.com/tags/horror" but that's part will be more clear if you watch main part inside tag.php and tags.php templates (below): // tag.php $search_term = $sanitizer->text($page->title); $items = $pages->find("tags.title%=$search_term, sort=-sort"); // tags.php $tags = $pages->find("template=tag"); $items = $pages->find("tags=$tags, sort=tags.title"); regards p.s. this principle is used here on some of my testing website (at sidebar column is tags-cloud widget)
  15. Hello, my problem was that I get blank page after manual upgrade from 2.8.0/2.8.35 to 3.x. on localhost (Windows). Also there is no errors inside log files (php, apache... site/logs). Problem solved after addition in top of config file (site/config.php): namespace ProcessWire; One of the first thing what I done (after upgrade and blank page) was that I added this in site/config.php : // no need to add this!!! // disable module compilation $config->moduleCompile = false; // disable template file compilation $config->templateCompile = false; but did not pay attention on config file, and "configure" itself . Regards. p.s. maybe this should be noted in this page