Login | Sign up | Toll-Free: 1-800-752-0455
 
 

Forum

 

8 posts by 2 authors in: Forums > CMS Builder
Last Post: July 14, 2016

By rez - July 11, 2016 - edited: July 11, 2016

I have a list of proteins in CMSB (salad franchise). Around 50 of them in a table / section editor.

When clicking modify to edit the protein info, I have 8 restaurant locations load as a checkbox list form another editor. 8 checkboxes. 2 admins check location boxes to show which proteins are available at which locations. If a protein is checked for "Springfield" and "Jonestown", it will show in a protein list for that restaurant on that restaurant's location page.

This seemed to be the fastest way to have a couple of admins manage all the proteins for 8 locations. Having to click modify for each protein is time consuming for them but I dont see another way. 

That would get be me by. However, now the client is asking that they have the ability to schedule 3 or 4 weeks in advance. Daily proteins for each location... for 3 weeks? I'm stumped. I know there are schedule options in CMSB but how to schedule a list of proteins for each location for 3 weeks... ?

Any direction on this would be appreciated. I'm not opposed to starting over to make this work. The current setup was easy and now they hit me with this 2 days from launch. ugh!

By rez - July 11, 2016 - edited: July 11, 2016

I was baffled but I think the answer is simply a third editor.

Editor 1 = all proteins

Editor 2 = 8 locations

Editor 3 = all proteins from editor 1 as checkboxes, all locations as checkboxes, scheduling.

So the admin goes into editor 3, presses create and checks all the proteins and which locations has them. This is "scheduling lists" to display on each location page. The nice thing will be that multiple locations are identical a lot with the same proteins. 

What's the best way to show Todays Proteins on in a viewer for a location though?

Do I loop through each protein seeing if a location is selected( or through each location to find proteins?)

What would that location's page viewer code look like for 1 list of proteins for a location, since I'm checkboxing proteins and locations from 2 other editors? "Show me all of todays date proteins selected for location 8" I am going to give it a try but wanted to ask for an example. I'm not using categories which is the only way I am experienced with in the past.

Hi rez,

If I understand your setup and question correctly, to get "Today's Proteins" from Editor 3 for a location viewer page with location record num 1, use mysql_select() function with the following where clause:

For example:

$locationNum = '1';
$editor3Records = mysql_select("editor_3_tablename", "location LIKE '%\t".mysql_escape($locationNum)."\t%'");

The code above will return all the Editor 3 records where location num 1 is checked.
And in those records, the checked "proteins" are included.

You might need to expand the code above, ie. add scheduling to where clause, to match your needs.

Please let me know any further questions.

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com

By rez - July 13, 2016 - edited: July 13, 2016

Actually, i have another question I can't find in a search.

In the editor, "Schedule", I pull in a multi list of checkboxes from the "Proteins" table. using the advanced option with num as value and label as name. 3 of these proteins, they have every day. Can an admin load these 3 already checked by default when creating a new schedule record (there are around 50 protein checkboxes / items)? 

Hi rez,

> Something to do with explode and loop them into a list? 

That's right, explode it with ", " as separator then loop through each.

> Can an admin load these 3 already checked by default when creating a new schedule record (there are around 50 protein checkboxes / items)? 

Yes, one way to do that is by creating a custom plugin that is hooked to 'adminUI_args' filter where the plugin function will insert additional get parameter to the "Create" button's redirect onClick URL.
ie:

[onclick] => window.location='?menu=sample_multi_record&action=add&proteins[]=1,2,3

where 'proteins' is you multi-checkbox field name and "1, 2, and 3" are the record num of proteins that you'd like to be checked by default.

You can check an example of how to use the plugin filter on this post:
http://www.interactivetools.com/forum/forum-posts.php?postNum=2239157#post2239157

Cheers,

Daryl Maximo
PHP Programmer - interactivetools.com

By rez - July 13, 2016 - edited: July 13, 2016

This seems powerful. Is there documentation to understand more? I only sort of get it. "action"? What are possible actions? That's CMSB plugin stuff?

The only thing I can think of is to get some custom work with heavy commenting to point me where to learn more. It probably isn't a big job to get this done. 

Or where can I learn more possibilities for filters and the plugin system and how to utilize this besides the link you gave?

hmm. Can jquery be used in a plugin or this filter situation when pressing the create button (to fill checkboxes for instance)?

Yes, it's powerful as it lets you customize the CMS admin. And as far as I know, we don't have available documentation for the plugin hooks. 
But we do have free plugins that use some of it, ie: Save & Copy, Modify Header Links, that you can check and see how it works.
Additionally, you can find the list of this hooks at YOURSITE/cmsb/admin.php?menu=admin&action=pluginHooks

Can jquery be used in a plugin or this filter situation when pressing the create button (to fill checkboxes for instance)?
- I don't think so because the click event of the create button will not get register on the next page (add new record page)

Note: Always make a backup when you're trying out a hook as it might break your CMS admin.

Daryl Maximo
PHP Programmer - interactivetools.com