how to limit view to just show each type one time? - drupal

I have a content type what is news, the news has a field type that is List (text) to keep different types of news. for example I have Health, Sport, Economic and etc.
So now I am going to create a block and have each of these type in that as a hyperlink.
I can do it and I created a new view block but each news_type may showing more than one time according to published content.
How to set the view (for block) to just show news_types and show them just one time?

You can achieve this by following the steps given below:
Enable aggregation under Advanced Accordion of the view
Add Nid field & set aggregation type as Count Distinct
Exclude Nid field from display
Add news type field & set Aggregation type as Group results together, in Group Column select Value option from dropdown
Remove Publishing Date from sort criteria
Please check attached screenshot for reference
You can check this question for more information, and maybe help you.

Related

calling of one taxonomy from another taxonomy, so both of them have used in the same content type

Can we call one taxonomy term from another as a parent and child relation for example I need to click on product category and that show me product series page and when I click on product each series that will lead me to actual product detail means node, so I have two taxonomies category and series I am about to click on category to carry me to series page and then to click on series page to carry me to product detail page on the concern series”
no codebase problem
i am expecting that these two taxonomies may be used as i have mentioned in the question summary but, i can't do it so i hope some help in resolving this issue
Let's look at this answer, I hope it will help you.
Taxonomy terms from the same vocabulary filtered and referenced on multiple content types
To do this you’ll need to have the Entity Reference module installed. So get that out of the way quickly with drush dl entity reference -y and drush en entityreference -y if you haven't already.
First up, we need the taxonomy set up.
Let's demonstrate with the help of an image.
You’ll notice that these terms could be more or less grouped into two categories: Transport and Sleeping. One term (couchette) kinda fits both criteria and is there to exemplify the reason for not using 2 different vocabularies to handle the issue. Now we need to technically make the distinction between these terms as well and since they are entities, we can use a field for that.
So we can now go ahead and add a new field to this vocabulary of the type List (text) with whatever widget you’d like (and let’s call the field Type). You should make the allowed number of values unlimited and put the following in the allowed values list:
Edit each term and select the appropriate type. As expected, for the term couchette, you should select both options.
Now that we have our taxonomy squared away, it’s time to create a View that will handle the filtering of these terms. Because if we now add the Tags taxonomy term reference field to our content types in the normal fashion (as it is already present in the Article content type) we’ll be able to select all the terms in the vocabulary for all the content types. And that's not what we want now.
So create a drupal 7/8 View that shows taxonomy terms of the Tags vocabulary - let’s call it Tags Filter. Add 2 displays of the type Entity Reference and a filter of the field we added to our terms earlier. So for instance the first display can show the terms which have Sleeping selected and the other one can show terms which have Transport. Save the View and you can close it.
Now finally we can edit our content types and add to each a new field of the type Entity Reference with a select list widget. For the target type select Taxonomy term and under Entity Selection choose the following: for Mode, go with Views: filter by entity reference view and then select the View in question - one of the two displays which we created earlier. In the picture below, I named one of the displays

Showing count of content based on the select list values Drupal 7

I have a requirement in which I need to show some content along with its count based on values in a select list. I wanted to display the allocated,released and resigned resources of a particular department in a selected date range. Using views, date range and department fields are created as exposed filters.
Created a content type for creating resources. The Resources content type is having action as a select list with values allocated,released,resigned. Department is another select list and date field is also added.
Please help me with an answer if views module is not enough. Provide some other solutions also. I'm using Drupal 7.
I figured out how to show node count in views. In my view I’ve some exposed filters and passed my select list cck field as contextual filter. If no result available I made the view to display summary as row count. In the template file, I’m planning to do some calculations for showing the resources count in and out of the project. Please correct me if there is anything wrong in this approach.

Drupal Commerce Products for printing company

I'm new to Commerce I hope some kind fellow could give me some directions here.
I am creating an ecommerce website for a printing company. I will give an example of what I require
For instance they will offer A6 flyers but these come in different specifications each with differing prices
Here is an example:
http://4frontdesigns.co.uk/Untitled-1.jpg
So down the left column are quantities of flyers and along thw top different speciifications of those flyers with the prices shown in the middle.
Any help much appreciated
Can I just add each variation of these one by one as it is not possible to just say that a certain additional attribute to the product will add so much $$ to the base price.
Would I just add each variation one by one then some how pull these all into one display?
You could use the commerce price table module like Flo suggested or look at the Price attributes Module https://www.drupal.org/project/commerce_pricing_attributes
It uses option sets and then add to (or subtract from) the price based on the selected attribute.
The answer for me was to create each product variation as its own product. So every variation gets added as a separate product.
If you are wondering how to add different variations to product such as paper size or colour, you would do this with taxonomy. Simply create a taxonomy term called colour and then add all the colours into this term that you would require.
Then when you create your product type in commerce, you would add this as an option to choose from when adding products by doing the following. Go to manange fields for the product type you want to add it for and add a new field, type of data = term reference. You will then select the desired taxonomy term and also there will be an option to 'Enable this field to function as an attribute field on Add to Cart forms.' - You want to select this!
Then what you do is create a product display and pull all these in to a single page, which then gives you drop down options to change, and the price changes accordingly in real time.
You can create a product display by creating a new content type first, call it product display... Then add a field to this content type which is a 'product reference'.
Now add new content, pick to create a product display (what we have just created) and choose the products that you want to appear on that page.
Then automatically Drupal Commerce will take care of the rest. Hope this helps someone!

How do I get Group ID as context in Views Drupal 7 without Panels

I have been banging my head all day with this. I have seen other posts, but they all seem to say "Use Panels" and I dont want to make a panel page for every view.
I am using Drupal 7.x, Organic Groups with Group Context, and Views.
I created a content type as a Group, and several content types as Group content types.
In my view, I added the relationships Group Membership:Node group membership, Group: Node, and Content:Author. I have tried various Contextual filters, but none seem to be working.
The view is display type page, with a path of node/%/content/documents (documents is the content type where I want to show all uploaded documents for a particular group).
What is see is whenever I add a contextual filter, the query contains a line similar to WHERE ((og_node.gid = 'xx')) and the value there is the value of the group node entity ID, and not the GID. I have set the default value on the contextual filter to "current OG Group from context" and I have set the validation criteria to validate on the Content ->group content type, and Node ID. I can get the Page Display title to use the %1 placeholder to accurately grab the Group Node title successfully, but I cant get context to be passed in so the WHERE clause contains the GID and not the entity id.
Any help?
I just tried this and the following two settings worked for me:
Relationship of Group membership: Node group membership
Contextual filter of (group membership) OG membership: Group gid
In the preview window, when I enter in the gid for the contextual filter, I get back exactly the nodes belonging to that group that I expect.
Have you tried that one yet?
You can try the og_context module (part of og)

Node position in list

how to get the current node position in the list?
Is there any access like $node->position?
I'm using Drupal 7. Thanks
It would help if you offered more information on what you are doing. You could add a select field called weight to the content type that would contain a range of numbers like -100 to 100 and then create a view that pulls in content of that type and then add a sort criteria based on the select field "weight". But we would need more information on what you are doing in order to give you a more accurate response.

Resources