Jump to content

Dynamic Selects (Commercial Module)


kongondo

Recommended Posts

1 hour ago, hezmann said:

But for some strange reason I can't filter it with Lister...

DS in Lister is currently not fully supported. I'll be working on this in the next version (or maybe the one after that).

1 hour ago, hezmann said:

Oh - except that doesn't let me select multiples which I definitely need.

Only one value can be selected at a time in DS. Are you trying to use it as a page field? E.g. like an AsmSelect?

1 hour ago, hezmann said:

I tried putting it in a repeater.  It get's the Continents but then just has the spinning wheel for the other drop downs and doesn't get any values.

Repeater support is in the works (please see this post). 

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 years later...

Hi guys, 

Does anyone know how to add sorting tot the child selects? The first select can get sorting in the dynamic selects settings, for example sort=name and it works nice, but for some reason it doesn't work for the second and third selects.

I have tried to manually drag and drop the items in the admin for the alphabetical order, I also tried to set all parents sort settings to sort=name but that doesn't move it either. In your example @kongondo you also see this behaviour (frontend dynamic selects example)

Let's say I have Continent, Country, City selects. Under my country select I have USA, Mexico, Argentina. The country pages were added in this order, so 1 USA, 2 Mexico and 3 Argentina. Argentina is always as the last item in the dropdown select (on frontend). If I add Zimbabwe under Country parent, the Zimbabwe will be last in the dropdown select. So it seems that the child drop down selects are always being sorted by creation date? Can this be setup to work in alphabetical order?

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...

I'm working on a project to grow my programming skills a bit by making a Yelp-style directory that could be used for any dataset of things like parks in the state of Maine. I've created 3 templates so the page tree is the source of the categories for a drilldown like:  Outdoor Lifestyle (cat1) -> Parks (cat2) -> Dog Parks (cat3)

Added dynamic selects and created a field called categorytree and set up the three so in the backend choosing top level, level 2 and level 3 categories is a dream. and having no problem displaying a basic breadcrumb... so when you get to the data dump for a location you get the breadcrumb: Outdoor life / Parks / Dog Park.

$ds = $page->categorytree;
echo "<ul class='uk-breadcrumb'>
     <li>$ds->cat1</li>
     <li>$ds->cat2</li>
     <li>$ds->cat3</li> 
</ul>";

 

Been going through the comments and I'm not sure this is possible, but wanted to make these live breadcrumbs...since all the data sources are pages... sort of like this, but obviously not this... Not sure in reading the previous entries whether this is possible? 

<li><a href='$ds->cat1->url '>$ds->cat1</a></li>

 

 

Screen Shot 2020-08-22 at 5.25.21 PM.png

Screen Shot 2020-08-22 at 5.27.21 PM.png

Screen Shot 2020-08-22 at 5.30.03 PM.png

Link to comment
Share on other sites

Hi @hollyvalero

13 hours ago, hollyvalero said:

Added dynamic selects

Thanks for the purchase.

13 hours ago, hollyvalero said:

Been going through the comments and I'm not sure this is possible, but wanted to make these live breadcrumbs...since all the data sources are pages... sort of like this, but obviously not this... Not sure in reading the previous entries whether this is possible? 

<li><a href='$ds->cat1->url '>$ds->cat1</a></li>

Currently this is not possible. $ds->cat1, etc only return simple values like texts and integers. However, I should be able to add this as an extra property for $ds columns that refer to pages, i.e. add the URL. Have you seen the documentation here?

https://dynamicselects.kongondo.com/documentation/using-fieldtype-and-inputfielddynamicselects-backend/fieldtypedynamicselects-api/

This would fall under 'Other Properties'. So, something like $ds->cat1URL ($ds->nameofcolumnURL format).

Let me have a think and I'll get back to you.

Thanks.

Link to comment
Share on other sites

4 hours ago, kongondo said:

 

* Yes! That's why I figured it wasn't available, but maybe could be...It's not a deal breaker because the pages would be filed under  City -> Location (like the dog park) and the breadcrumb nav is most likely to be to back up to the city level... but to "see all dog parks" I'd need to find a way to dynamically link that page URL data source.

On the city  page I could...

pages->find
template=location (used by all)
$page=city (locations are filed under cities)
sort=title or sort by $ds->cat1 

 

To link to a category since each is unique, maybe

pages->find
$ds->cat1=title
 

but if it was a data source property

echo $ds->cat1URL

then you could avoid the find->step and it would be an elegant way to create a rich breadcrumb if using DS for page navigation elements.

BTW -> I love this module. I had page reference fields originally and thought, good lord... what if there are 600 categories/subs/etc. It would be a nightmare to have to start at the top level each time. So this is really brilliant. 

 

 

 

 

 

Link to comment
Share on other sites

55 minutes ago, hollyvalero said:

but if it was a data source property

echo $ds->cat1URL

OK. I'll rustle up something and PM it to you (as I don't have time atm to do commits and other testing, e.g. multilingual). It should work just fine though ?

56 minutes ago, hollyvalero said:

BTW -> I love this module. I had page reference fields originally and thought, good lord... what if there are 600 categories/subs/etc. It would be a nightmare to have to start at the top level each time. So this is really brilliant. 

Glad you find it useful.

Link to comment
Share on other sites

  • 5 weeks later...

Dynamic Selects version 007  (released (23/09/2020))

Glad to announce that the latest release of Dynamic Selects is now available for Download/Purchase.

Changelog

  1. Multilingual column labels (see screenshots/demos below).
  2. Repeaters and Repeater Matrix support (not tested Repeater Matrix though!).
  3. Selected Page/File/Image URLs (only supported in FieldtypeDynamicSelects for now). Thanks to @hollyvalero for request and testing ?.
  4. Various bug fixes.

Screenshots/Demos

Multilingual Column Labels

ds_007_edit_multilingual_labels_demo.thumb.gif.72eca584106b2b856573098f1485aa62.gif

 

ds_007_multilingual_labels_demo.thumb.gif.e997690c9f419e6866277e6546c6d471.gif

 

Selected Image (in dynamic selects column) URL

ds_007_image_url_demo_field_001.thumb.png.1c9f6d5e6dbc5807b7d1225cf5a1afa2.png

ds_007_image_url_demo_002.thumb.png.f1e59f8a756f7e5b1f28f9c977c1675a.png

 

Selected Pages (in dynamic selects column) URL

ds_007_image_003_page_links_field.thumb.png.d0a7422d2519f0560fd5518514710154.png

 

ds_007_page_links_demo.thumb.gif.e61e5ef40b8f53145d4cac98ae084b10.gif

Thanks

Edited by kongondo
clarification
  • Like 1
Link to comment
Share on other sites

5 hours ago, hollyvalero said:

This is such a great addition to ProcessWire and SO useful, that I think it should be part of the core!!!

While I agree 100%, my question is that was it by accident that you cloned Kongondo's complete post? Either way, please fix it as it makes this thread confusing.

Edited by szabesz
fixed sentence
  • Haha 1
Link to comment
Share on other sites

  • 5 months later...

 

Hi @maddmac

On 3/8/2021 at 5:45 AM, maddmac said:

just updated this. I would like to use with a formbuilder form if possible

I haven't tried but I don't think so. Dynamic Selects works with Fieldtypes and I don't know if Formbuilder is a Fieldtype.

Link to comment
Share on other sites

  • 5 months later...

Hello

I've just purchased the module it works great so far and it is going to be useful in the future ? But I was wondering if it could be used to categorize posts/articles with the module. I mean that it would publish and place the article into coresponding category in the tree based on a selected categories or templates.

expl.:

HOME
- Category 1
--Subcategory 1
--- SubSubCategory 1
---- POST 1 (automaticaly placed when creating a new post)
---- POST 2(automaticaly placed when creating a new post)
- Category 2
-- Subcategory 2
--- POST 1(automaticaly placed when creating a new post)
--- POST 2(automaticaly placed when creating a new post)

I hope u understand what I mean ?

Thank you
R

Link to comment
Share on other sites

4 hours ago, Roych said:

I've just purchased the module it works great so far and it is going to be useful in the future ? 

Thanks for the purchase! ?.

4 hours ago, Roych said:

But I was wondering if it could be used to categorize posts/articles with the module.

I don't fully understand this use case...Are you trying to build a menu? When I get a minute, I'll respond to your other post in MenuBuilder ?.

4 hours ago, Roych said:

---- POST 1 (automaticaly placed when creating a new post)

Yes, this should work since Dynamic Selects will return the current value of a given field (any supported field as per its documentation). I may have misunderstood your use case/question though, so please clarify if this is the case.

Edited by kongondo
clarification
Link to comment
Share on other sites

19 hours ago, kongondo said:

I may have misunderstood your use case/question though, so please clarify if this is the case.

Sorry for not being clear enough I will try to explain in more details ?

I'm not building a menu but page tree hierarchy in admin. So, I would like to create multi-categorized site. It would have categories, subcategories and subsub categories etc. and and every blog-post should be placed under it's own sub/category that is selectable when creating a new blog-post. 

I was thinking that I would place the dynamic select field in blog-detail.php template add categories columns (previosly created in admin tree with category.php template) to it.

And when creating a new blog-post you could select all the categorys and all the subcategories of where this new post shoud be placed under. And after save, the post would be saved under that sub/category.

The tree should look like this. every post placed under it's own category.

  • Subjects (CATEGORY)
    • Domestic violence (SUBCATEGORY)
      • Domestic violence · Violence between parents  (SUBCATEGORY)
        • BLOG POST HERE (placed here with dynamic select field)
        • BLOG POST HERE (placed here with dynamic select field)
      • I need help immediately!  (SUBCATEGORY)
        • BLOG POST HERE (placed here with dynamic select field)
        • BLOG POST HERE (placed here with dynamic select field)
      • Helpful addresses  (SUBCATEGORY)
        • BLOG POST HERE
        • BLOG POST HERE
      • I use violence in my relationship (SUBCATEGORY)
        • BLOG POST HERE (placed here with dynamic select field)
        • BLOG POST HERE (placed here with dynamic select field)
      • I know about violence in a relationship
    • Mental stress
      • Mental stress
        • BLOG POST HERE (placed here with dynamic select field)
        • BLOG POST HERE (placed here with dynamic select field)
      • Is my child psychologically stressed?
        • BLOG POST HERE  (placed here with dynamic select field
        • BLOG POST HERE  (placed here with dynamic select field
      • My child has mental health problems
      • NEW Subcategories with posts
    • Tobacco

I don't want to have all blog posts together like below and then selectable with page fields:

Posts
 - BLOG POST
 - BLOG POST
 - BLOG POST
 - BLOG POST
 - ...
Categories
- Category 1
- Category 2
- Category 3
- ...
 

Not sure if I can explain it better ? I hope you'll understand something from this mess ?

Thank you very much
R

 

Link to comment
Share on other sites

On 8/20/2021 at 8:41 AM, Roych said:

I will try to explain in more details ?

Thanks, this is clearer. One thing still remains unclear.

On 8/20/2021 at 8:41 AM, Roych said:

I'm not building a menu but page tree hierarchy in admin.

I don't understand what you mean by tree hierarchy in admin. Are you referring to the ProcessWire admin pages tree? If yes, then, no, dynamic selects cannot change your admin tree structure. I have a feeling this is not what you meant. If not, what tree are you referring to and how and where are you building it? Or, do you mean creating a dynamic selects in the backend/admin that will subsequently be used in a frontend template to display a 'tree' in a page in the frontend? Meaning, is the 'Subjects' tree as show in your example an illustration of how it should look like in the frontend (as opposed to the ProcessWire admin tree)? Hope my question is clear :-).

Link to comment
Share on other sites

Hello, sorry for my late post. 

I'll try to explain a litle different this time I hope it will be more clear. ? Everything is done and created in backend!

Im posting some gif on what do I want to achieve.

So I have previously made categories (left image). I add them to dynamic select field (right image). And when I create new post I select all the categories I want, and after saving the new post should be placed under that category. So in example below the new post should be placed/published under (My post 2). that is all I want to achieve. Selecting the category and place new post under that category.

spacer.png

I hope this makes more sense. ?

Thank you

R

Link to comment
Share on other sites

43 minutes ago, Roych said:

I hope this makes more sense. ?

Erm, sorry, no. I am even more confused now. But maybe it's just me ?.

45 minutes ago, Roych said:

So in example below the new post should be placed/published under (My post 2).

I don't really understand what you mean by 'placed/published'. It seems to me that you want the editing actions on the right image (editing of a page with a dynamic field in it) to affect the ProcessWire tree in the left image. Is this correct? If this is your goal, then I think you have somehow misunderstood how this module works. It does not affect your publishing or ProcessWire tree. Am I missing something here? In your right image, I see you are already publishing the new post (My new post) and the parent (category) you want, i.e. 'Math'. I don't understand what you need dynamic selects to do in this case.

My understanding was that you wanted one of the below:

  • Select a POST in a dynamic select and it will show you all of that post's CATEGORIES. E.g. Selecting My Post 1 will show you Math. This is possible using the group relationship.
  • Select a CATEGORY in a dynamic select and it will show you all of that category's POSTS. E.g. Selecting Math will show you My Post 1 and My Post 2. This you already do as shown in the left image, when you select Math.

Am I on track with these assumptions? Sorry if I am taking you round in circles!

 

Link to comment
Share on other sites

4 minutes ago, kongondo said:

It seems to me that you want the editing actions on the right image (editing of a page with a dynamic field in it) to affect the ProcessWire tree in the left image. Is this correct? If this is your goal, then I think you have somehow misunderstood how this module works. It does not affect your publishing or ProcessWire tree.

Yes this was exactly what I meant. I just though if it was maybe possible. It would make article publishing and categorizing them in the tree much easyer, than always go to tree, select the right category, subcategory, subsubcategory and create new article there. Maybe there is some other way to do that, maybe page fields or ...? Never done that this way. I always had categories in one place and posts in another, then in "post-detail" I'd use page fields for checking under which category the article belongs. But the admin tree looked like this:

HOME
 - Articles (post-list.php)
  -- Article 1 (post-detail.php)
  -- Article 2 (post-detail.php)
  -- Article 3
  -- etc. ...

Categories (categorys-list.php)
  -- Category 1 (category.php)
  -- Category 2 (category.php) 
  -- etc. ...

The dynamic select is more for listings, but it was just a thought that it might work this way for publishing and categorizing new posts also.

Thank you for your time and help, and sorry for my confusing questions.

R

Link to comment
Share on other sites

1 hour ago, Roych said:

I always had categories in one place and posts in another, then in "post-detail" I'd use page fields for checking under which category the article belongs. But the admin tree looked like this:

Is there a reason why you cannot follow this same pattern in the present project?

1 hour ago, Roych said:

It would make article publishing and categorizing them in the tree much easyer, than always go to tree, select the right category, subcategory, subsubcategory and create new article there.

I can see how this will be painful in the long run. It is also prone to mistakes; posts being added in the wrong sub-sub-category.

1 hour ago, Roych said:

Maybe there is some other way to do that,

What comes to mind is a custom module. Could be a process module or a runtime inputfield coupled with a Pages Save Hook. You probably won't even need to save they dynamic field as it is only there to help you drill down to the final parent of the post you are creating. An inputfield may not help with the challenge of going via the tree. It may even confuse authors as they will click on a parent page in the tree to 'Add' a post but the post will then be re-parented. So, maybe a process module is more friendly in this regard. At the top, you would have a dynamic select like field to drill down to sub-sub-category you want. It would then reveal a post add form. On create page, post author is redirected to the edit page of that post. The challenge here is that you will be working away from the usual page edit form. You will need to embed ProcessPageEdit::execute() output in your form. It is not difficult to do. There are posts in the forum that show you how. 

Just some preliminary thoughts...

Link to comment
Share on other sites

20 minutes ago, kongondo said:

Is there a reason why you cannot follow this same pattern in the present project?

Unfortunately yes, it was specificaly requested that the page tree should be like that. ? It would be much easyer for me to do it like always.

24 minutes ago, kongondo said:

I can see how this will be painful in the long run. It is also prone to mistakes; posts being added in the wrong sub-sub-category.

Yes it's true, and one article could not be in more than one category and I'm sure it will probably be demanded in the future.

 

27 minutes ago, kongondo said:

Maybe there is some other way to do that,

Ok, I got some idea, maybe even with Formbuilder and "Submit to page" option selected and could even be done from frontend for client or editor. hmmm ... I've already done something similar. I'll dig into it ?

Thank you very much for helping, Im still learning PW and because Im not a coder I probably always will ? so maybe sometimes I ask to many questions to find the best solution that works for my knowledge. 

R

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...