I have a plone site and I have added a content type called game. There are now several games that have been added and that can be viewed. I would like to use the eea.facetednavigation module, which you can read about here: http://plone.org/products/eea.facetednavigation.
The idea behind faceted navigation is that one can quickly filter all the objects, which is like doing a search. For instance, I place all my games in one of about twelve categories according to genre. I have options like "adventure" "action" "puzzle" "roleplaying" and so on.
I would like to have an area on the side where the user can click "puzzle" and then have the page display only puzzle games. I would also like to duplicate this behavior elsewhere so the user can filter by price. Of course if the user filters on both, then that should work as well.
I'm imaginging about four or five different facets that the user can filter on. Now, I have placed eea.facetednavigation in my buildout.cfg file and when I log in as "admin" I see the option under my Games tab (where I have added some games) to enable faceted navigation. However, when I do this I get a useless screen that I can't understand and that does not allow me to set up the kind of filtering criteria that I have in mind. I have attached a screen shot.
As you can see on the screen shot, faceted navigation is giving me options for "video link", "video file", "page", "news item" and so forth. None of these are the fields associated with my games. If I cllick "more" on that portal type, I see an option called "games" -- because I have created that content type -- but selecting it doesn't give me the behavior I want.
It is hard to see in the screen shot, but the "Games" tab is highlighted at the top. That is the folder in which I have enabled faceted navigation, and that is the folder in which I have added several games.
I've tried reading the documentation on faceted navigation -- http://plone.org/products/eea.facetednavigation -- but I've been mulling it over for an hour and I just can't make head nor tail of it.
Assuming that 'price' is an integer-field of your contenttype, you need to enable it as an index in the portal_catalog in order to make it available as a criterion in an eea-searchform.
So, first register the Index in profiles/default/catalog.xml like this:
<?xml version="1.0"?> <object name="portal_catalog" meta_type="Plone Catalog Tool">
<index name="Price" meta_type="FieldIndex"> <indexed_attr value="getPrice"/> </index> </object>
And then in th eea-searchform add a widget hitting one of the plus-icons, choose f.e. the kind 'Range' and as Index choose 'Price'.
Proceed similar with your other fields, choose checkboxes for your category-widget, etc.
If you categorized your games using the standard Plone "Tags" functionality (on the "Categorization" tab if you edit content), then you should be able to simply add a "Select" widget and set it to search the "Tags" index (under "Catalog index to use for search").
I agree that the facetednavigation UI is rather obtuse.
Just add a widget of type "Checkboxes" and choose "Subject" from Catalog Index and choose "Yes" on "Catalog Get unique values from catalog as an alternative for vocabulary". This should gives you a list of checkboxes with the categories. Also add an hidden (you can hide it clicking on the eye icon) widget selected on the "games" type, so results are pre-filtered on that content types so "Subject" widget contains only the games category and not all from the site.
For the prize, follow the Ida answer.
Related
I am having issues using View display in a Panel, on Drupal 7 (using Panopoly), from one of the Pages in our Drupal site. We are having problems passing parameters from Panels into Views.
I would like to allow passing the Taxonomy Name (in lowercase), from a Page (using Panels), to one of the Views on that page.
At the same time, I would like to pass the Taxonomy ID (tid) in the same manner.
Then, with Contextual Filters (which are used in the View), I would like to filter those news articles.
For example, it should allow both:
news/3 and news/latest, showing same results.
Could someone help me or point me in the right direction?
Thank you in advance!
I am not sure, that I am understood you correctly, but if you want to pass the different values for the few views, you may use the "Contextual filters" for each of them. In View "Pane settings" set "Argument input" parameter to "From context" point, and then choose a value, that you need.
This video can explain, how to do it.
http://nodeone.se/en/learn-page-manager-part-5-views-content-panes-basics
Or you can add the exposed filters to your View, and enable "Use exposed widgets form as pane configuration" option in "Allow settings" menu. Then you will be able to configure filter values in your panel pane settings form.
I'm going to try to explain my project.
I have one section to create on my drupal's site called "Press Room" in this section the users access it via menu item called "Shows". The mainly idea is that the second level of this menu will be created with taxonomy vocabulary called shows and the terms of this are for example:
-Shows(Voclabulary)
-Heartland(term)
-Bulloch Family(term)
And now the next step is create for each one of the terms the next structure:
-About
-Press Materials
-Video
-Fotos
To be more specific I've attach two piece of wireframes of these.
What is the best way to do that?
Thanks!!
[The menu show like that][1]
![The content once you click in the menu][2]
http://i.stack.imgur.com/tijAU.png
http://i.stack.imgur.com/1oifQ.png
I can propose a solution although there are too many options here.
1) Heartland(term) -Bulloch Family(term): there is no need to use taxonomy terms, they can be node types (let's call it "Show" content type).
2) About, Press Materials, Video, Photos and Contact will be 5 node types too. But these will have a reference field to the node types above (Shows).
3) The display page of each Show will be a views that will display the node Show and the content that are referencing this node.
4) Menu can be created by hand (if shows are not too many) or by a views that will show a list of node links.
Examples:
http://ericgilbertsen.com/2013/06/create-related-content-blocks-drupal-7-views-entity-reference
http://www.webomelette.com/related-content-block-views-drupal-7
I'm working on a plugin that allows the user to create "page/post types", customize the type style, then tag a page/post with that type. All of this works. My problem is this plugin also needs to allow them to attach widgets to said type.
I have no way of knowing how many "types" there are at any time.
The plugin works like this:
User creates types (cat, dog, mouse)
User specifies things like background colors, link colors, etc. for a type
User specifies widgets for that type
When the page/post is viewed the page detects if it has a type. If it does it pulls in all the relavent data to that type.
Everything works PERFECT.
I know I have to register a sidebar but I can't registe for each type since I have no idea how many there are and the user can create and delete at their whim.
My plan:
Register a sidebar called "custom sidebar"
Create a page that mimics the "Widgets" page
Allow the user to add widgets there on the "custom sidebar"
The plugin stores data for the sidebar based on the "type"'s id
I can't really use another plugin since the sidebar function has to meld right into my plugin. I'm not even sure this will work or even where to start. Any push in the right direction would be great!
I created a single sidebar and added an option for each widget where the user selects the meta option. The page get the needed meta data and compares it to each widget in the special sidebar. If the meta matches it shows that widget.
I am experienced Java/C++ programmer, but totally new to Drupal/PHP.
Short question:
How do I refresh all the blocks in my page, based on the input to a particular block?
Exact Scenario:
I am looking to create a website with display and behaviour similar to http://www.google.com/finance. I have started creating a custom module for this in Drupal 7, So we want to have:
a top input block where users can enter a particular company's name.
a main block which starts with general content (e.g. tables plus latest news about the economy etc). As soon as a company is selected in block 1, this changes to news and tables about the chosen company.
a side graph block displaying some relevant graphs etc. Again, when no company is chosen, this could display the general graphs (e.g. S&P, Dow Jones, NASDAQ), and when a company is chosen, this displays the details for the chosen company.
The way I see it, the website works in a "current context" for the user. So, perhaps I can set a session level variable in Drupal, and refresh all blocks based on the current value of this variable?
However, I am not sure how to achieve this, and what is the best way to do this? (AJAX? Taxonomy?)
Any pointer, hints, suggestions, examples, sample code are most welcome.
This is how I would approach this problem based on how you have described it. The majority of the functionality being handled by the Views module.
I'm assuming you have the following setup:
A Taxonomy vocabulary called "companies" which has company names as
terms.
A Content Type called "News", which has news information about
companies. Most importantly it will need a taxonomy field where you
can select which companies it is related to (lets call this field "company_reference")
A Content Type called "Tables"(?). I'm not sure what information you
want in your "tables", but again it's most important that is has a
taxonomy field to reference companies. (can be the same field "company_reference")
The Majority of the functionality you are looking for can be built using the Views module.
I would create a View (let's call it "Company Data"). the view is going to have three different displays, each of type "block".
Display 1: Input Block
Set the display name to something meaningful, say "user_input_block"
For this block, leave FORMAT settings as they are.
For the FIELDS settings, just have "Content: Title" (does not
really matter for this block).
For the FILTER CRITERIA settings, add a filter and select your
"company_reference" field, set it to auto-complete, expose the filter
to visitors and (under the "more" section) change its Filter Identity
to "company".
For the PAGER settings set it to display a specific number of items and set it to '1'. (this will limit the data this block retrieves)
Under the Advanced section change the "Machine Name" so comething meaningful, say "user_input_block"
Still in the Advanced section click on "Theme: Information". this will display a list of the different custom template files you can have for this view. For "Display Output" write down the last template suggestion in the list, it will be something like "views-view--company-data--user-input-block.tpl.php" ("views-view--{your view name}--{your display name}.tpl.php"). Click on "Display Output" and copy the PHP it lists. (this is the views default PHP for the view).
In a text editor/IDE (whatever you use) paste the copied PHP code and save it in your custom theme with the template name you wrote down. Edit the PHP and either comment out or remove the section that says "<?php if ($rows): ?>...<?php endif; ?>" (this will remove the returned content from the display)
So to review the view display that was just created will (using the custom template) display a block with just a field that as the user is entering a company name it will autocomplete. It will then submit the form and pass it as a GET variable to the current url (www.yoursite.com/yourpage?company=users company").
Display 2: ** Main Block**
Set the display name to something meaningful , say "company_news".
Set the FORMAT settings to which ever you like (or leave as is)
For the FILTER CRITERIA add a "Content:type" filter and select your "News" and "Tables" content types.
In the Advanced section click "add" next to "Contextual Filters". )A contextual filter is passed in the URL, we are going to be grabbing the value that was passed from the Input block.) Select "Content: field_company_reference" as the field and click "Apply"
for the "when the Filter value is Not available" section select "provide default value"
for the "Type" select "PHP code" and the PHP code will be something like this "return isset($_GET['company']) ? $_GET['company']:false;"
for the "When the filter is available of a default is provided", check "Specify validation criteria", set "Validator" to "Taxonomy term", check the "Companies" vocabulary and for "Filter value type select "Term name converted to Term ID"
for "action to take if filter value does not validate" select "display all results"
To review, this view display will display a block that lists "news" and "tables" content. If the GET variable "company" is passed (from the input block) then the content of this block will be filtered to display only content that is associated to that block.
Display 3: ** Graph Block**
I'm not exactly sure what data you want to display in this block (or rather where it would be coming from) but if you set it up like how I described setting up the Main Block it will filter by company (use the same contextual filter and content that has the company taxonomy reference field).
The one difference with this approach is that it requires the page to be reloaded when a user enters a company into the input block. If you want to avoid this then you could make the following changes;
for the main block and graph blocks instead of using a contextual filter use a regular filter for the Company reference field (same settings as were setup in the input block). For both these blocks under the Advanced section, set "Use AJAX" to "Yes", and use custom CSS to hide the exposed filters from view.
with a custom module (or with your custom theme) that adds additional JS to the page. Have the JS triggered by the field in the input block, when a user enters a value into it, the JS copies that value into the exposed (but hidden) field for the other blocks, triggering Drupal to reload them via AJAX with the passed filter.
I haven't tested any of this and it is just theoretical based on my knowledge of Drupal, but it should start you out on the right path.
I have a view that I am using for articles on the front page (View called Frontpage Top).
in one BLOCK display (named: Top Story) it just selects the most recent article.
in the other BLOCK display (named: Top 5 Stories) it selects the 2nd-6th most recent.
I need to make a template for the single top story, and then another to display the other 5.
this template:
views-view--Frontpage-Top.tpl.php works, but it's being used for BOTH blocks.
The only way I know how to do this is with multiple views, but these are so closely related I'd like to keep them in one. Is this even possible, and if so what would the filename look like?
it doesn't seem to be documented in Views2 ( http://drupal.org/node/352970 )
and this ( Drupal: Views, can the displays have different styles for the view? ) is close but not the same.
If the "right" way is to create multiple views I am ok with that, but I cannot find a resource saying that and I'd prefer not to if I don't have to.
Thanks!
Each display can be themed independently from another. In the Views admin, go to the display you want to customize and click on "Theme: Information". This will show you all possible templates and naming options you have. See the image below:
If you see in the image above, you can create a template for specific displays in a view. For example, all of my displays in this view are Page displays. So to style the "Business Cards" display (the 2nd display), I could use "views-view-grid--Vendors--page-2.tpl.php" to change the Style Output. The page-2 specifies that you want the template to handle your 2nd page display in this view.
If you need more information, take a look at Views 2 Theming Documentation