Drupal Views display newest content per taxonomy limit to one node - drupal-6

I want to create a view where all 5 of my taxonomy terms are displayed and it then displays the latest node published but this is limited by 1. For Example:
Tax Term 1
Latest node published
Tax Term 2
Latest node published
etc etc
Currently I'm grouping by taxonomy term so it's displaying all nodes published then sorted by published date desc. I can't quite figure out how to limit the nodes to only show one item per taxonomy term.
Any help would be greatly appreciated.

This is possible with Views 3. I've tested this on D7, but should work on D6 also.
Add a new view of type - Taxonomy terms
Add relationship - Taxonomy term: Representative node
Other - Use aggregation: Yes
Add field - Content: Title. Change Aggregation settings to Group results together

It's not great if you have a lot of nodes, but I've done this in other cases by using a filter for "Promoted to front page" - then you simple make sure you only promote one node at a time.

I'd suggest to use a combination of panels ans views.
First, create a (or use the default) view for nodes which takes a taxonomy term as argument. Second, create a panels page containing five regions. Each region is to be filled with a view (in fact it's going to be the same view from step one, but with different arguments). Within panels ui you can restrict the number of shown entries of each view, set this value to one to have only one article be shown per term.
Panels: http://drupal.org/project/panels
Views: http://drupal.org/project/views

I'd recommend checking out the Views Group By module.
http://drupal.org/node/389230
The tutorial listed above actually describes almost exactly what you are trying to do.

Related

Orchard 1.9.1 Container Layout

I set up the following Content Definition in an Orchard 1.9.1 site:
Manufacturer
- Logo (Media Library Picker Field)
- Container (single supported type - Product)
Product
- Containable
- [Generic Fields]
I added a few sample Product items to the site, and as part of that it had me select the Member Of option, which was a list of Manufacturer items I had already added.
The issue I have is, when I try to build a query to use with a projection widget, I can't seem to find a way to get either a Manufacturer's children, or a Product's parent container since I need to display all content on a single view. There are only going to be ~20 line items here, so performance is a non-issue. If I do multiple queries (one for each type), everything shows up individually but the Shape Tracing tool, when showing me the various Model items on the view, can't seem to show me either of these options.
My end goal is building a custom view to display this information, but I can't figure out how to traverse either up the Product to what its' parent container is, or traverse down from a Manufacturer to the child Product items below it.
How do I build a query that lets me see all of this so I can build a projection widget off of that?
Edit
I played with this some more and came across the ability to take a query and attach a layout to it. That is definitely getting me closer, however the grouping option says No properties are currently available in order to group this view, however I would think being part of a container/containable would define grouping automatically. As it stands, this lets me show everything, but unfortunately the parent/child show, and then the children repeat again, independent of the parent. It's so close, but I can't quite get it right.

Drupal views: limit results shown based on CCK field setting

I have a view that pulls in feed items (from various "Owner feeds" to use the feeds module lingo), then sorts them by date (very important). The owner feed has a CCK field for the type of feed (Twitter, Blog, etc.) and a CCK field theoretically to limit the number of feed items displayed in the view. (The reason for the limit is that Twitter dominates, but we want some blogs, etc., so I don't want to have to show 100 tweets before displaying my first blog.)
I'm guessing some sort of Views hook code is in order, but I'm not sure which one. Perhaps the hook that allows direct modification of the query...
Note that the Owner feed nid is being pulled into the view via a Relationship.
Thanks in advance!
Using the Arguments field in the view, you could first select the node type, then node post date.
In this way you could give priority to the blog type, before sorting by date.
You could also consider building two Views, for instance the top 5 blog items and the top 20 Twitter feeds...

How do I modify the Magento Search to check child skus?

Currently, the site search will search all of the skus of the items marked as being visible in search. This is all well and good.
The problem arises when the customer knows a sku of the individual child item. So, let's say a product comes in both a 20 foot and 25 foot variation. We would put those into a configurable product and have a single product page where a customer could then choose which of those two lengths.
What happens is, a customer invariably knows that the sku of the 20 ft variation is RDB-20, while the other is RDB-25. A search for RDB-25 then, comes back with no results since the simple product is not visible in search - it doesn't realize there is a match.
How do I get the search to search an item with visibility "Not Visible Individually", when it's parent is visible in search?
The desired effect is that, if a child SKU is searched for, the parent should show up in the results.
There really is no good way of doing it without extending the default search, but at that point you might as well look for other options.
Here's a workaround that might be doable depending on how you manage your products and it worked for me until I moved on from the default search.
Rather than altering the search, try adding an attribute to all products and make it hidden concatenating all the skus into this field. The search should find the text attribute and show the configurable.
Its a bit of a workaround but works for me.
This is untested, but I did a bit of perusing in our attributes and I think I found something that might help.
Currently since our child products don't show up in our search, we have the parent populate with the children product's attributes.
However, things like brand, taxable amount, description, populate for every child product while our SKU does not.
The only difference I can see between the two attributes is under manage attributes -> click on attribute -> and then under properties go to frontend properties and select
Use In Search Results Layered Navigation: YES
Used in Product Listing: YES
Use In Layered Navigation: Filterable (with results)
I'm not sure which of these do what, but in the population of the fulltext search data table, somewhere it is being told to populate for the children and I believe that the admin panel is where.
I hope this helps!

Drupal6 - product comparison

Hi
I have not using any shopping cart module, just created a content type (product) and defining several field(attribute) for each product feature.
I want to ask is there any module in Drupal for product comparison or field comparison?
Thanks
No, but there is a way to do it with the Flag module and Views. It will take more work than just turning on a module, but the outcome is the standard product comparison you're looking for. See this article.
The article is no longer online: here the content of the original post.
Ubercart Product Comparison
For me, using Ubercart in Drupal as an e-commerce solution for your website is the way to go. I have been using Ubercart for years now for a number of web design and development projects, and there are a massive amount of contribute modules to beef it up. One feature that I have been keen to work on is a Product Comparison feature, which would allow users to select products and have them display on a page, providing them with a nice and easy layout to easily compare their selected products.
After searching around the web, I found a few articles and posts from people looking for this feature, asking how it could work or if anyone had done it, but couldn’t find anything that said “here it is, this is how it can be done”. So, after a little bit or research and a bit of a play, I have come up with a solution which is not that difficult to achieve and only requires some already existing Drupal modules with just a few tweaks.
Note: This tutorial assumes that you already have a working ecommerce site with Ubercart installed. Best to also try this on a test environment and not a live website.
Step 1. Download Required Modules
Download, install and enable the following modules.
Views (I used 6.x-2.11, I haven’t tested it with any other releases)
Flag (I used 6.x-2.0-beta3, I haven’t tested it with any other releases)
Step 2. Flags configuration – Setting up your “compare”
Once you have enabled the Flags module, go to the flags administration page at /admin/build/flags.
Click the Add link, enter the name of your flag (something like “compare”), and leave the flag type as “node”, and submit.
On the next screen you will need to configure your new flag. Complete the following fields (changing the values if you like). I setup my configuration so only registered users of the website could compare products.
Title – Compare Products
Flag link text – Add to compare
Flagged message - [title] has been added to your compare
Unflag link text – Remove from compare
Unflagged message – [title] has been removed from your compare
Flaggable content – Product
Check “Display login link for anonymous users.” and for anonymous link text add “[login] to add to your compare”
For flag access, check flag and unflag for authenticated users
Under Display options select “Display link on node page” and “JavaScript toggle” as link type
Click submit to save your flag.
With the settings we used, the “flag link text” should now display on your product nodes. Clicking it should make the “flagged message” appear and the link changed to your “unflag link text” using JavaScript.
So what we are doing here is just flagging nodes – it’s actually pretty simple. We are flagging/unflagging them as “compare product”, so you should now be able to (by clicking on the link provided on your products) add and remove products to compare on your website.
Now we have done this, we need to create a page to display our “flagged” products, in which this case is the products we want to compare.
Step 3. Creating out Compare Products Page
Go to the Views Administration page, enabling the Flag module creates a default flag view. You can use this as a reference, or even change this view to what you need, it’s totally up to you. All we need is a view with (at least) the settings explained below.
DEFAULTS
Basic Settings – Use at least the following settings
Title: Product Comparison
Style: Table
Items per page: Unlimited
Access: Authenticated user
Empty text: Full HTML
- You have not yet added any products to compare. Click the “Add to compare” link when viewing a product to add it to this page.
Relationships
Add the following relationship:
Flags: Node flag
- label: compare
- check “Include only flagged content”
- flag: select the flag you created in step 2
- by: current user
Fields – You can put whatever fields here you would like to show up against each product. You must include the Node Title, and ideally you would want to show a thumbnail of the product, its price and description and the unflag link to allow users to remove it from this page. I have the following fields for my compare:
Content Image using an imagecache, linking to product
Node: Title linking to product
Flags: Flag link
- Relationship: select the one you added
Product: Sell Price
Node: Teaser
Filters
Node: Published Yes
AND SAVE
Now add a new page display view and give it a URL, then save. Navigate to your new compare page using the URL you entered. If you haven’t “flagged” any products yet, go do so and once done you should see those products displayed on your Compare Products page!!!
But, there is one slight issue. Because we needed to use Style: Table to get the layout to better suit a compare list, it still doesn’t display it the way we need it too. We want to display each of the products horizontally, with each field label shown on the far left so it is easy to compare our products. To do this we need to retheme the table style for our view.
Step 4. Theme the table output of the view
Under Theme: Information for our view, it displays a list of all the possible templates for the display plugin and for the style plugins. Look for the list titled Style output. This is what we want. It lists the possible templates we can use to change the theming of the style output. The first one it displays is the generic template for the table style output but we don’t want to use this one, because if we do we could effect any other table style view that may be on the site. So best to use the next one across, mine was called views-view-table–flag-compare.tpl.php.
Create a new php file and name the file to the template name you want to use. In my case my file is named views-view-table–flag-compare.tpl.php.
Paste the Drupal 6 code from here http://drupal.org/node/174578 into your template file.
Then place the file in your themes directory – and presto! Your comparison table should be laid out more like a comparison style grid. Below is a screenshot of what my Comparison page looks like after a little bit of extra styling.
Try this module: https://drupal.org/project/comparison
Allows the comparison of the attributes of two or more nodes by generating a table. A checkbox is added to nodes to allow them to be included in the comparison. If two or more nodes are selected a link is added to a page with a comparison table.

Create a list of pages in Orchard

Lets say for example, I have a list of products that each have it's own page... in what way can I create a single page that will list each product as it's contents as a list (with hyperlinks)? Not really sure how to do this directly in Orchard - or will I need to create a custom page / widget? Thanks for any help... new to Orchard and not sure how to tackle this.
You have a couple options. I believe the Orchard gallery at orchardproject.net has a module called Simple Commerce that may solve your problem. (it's simple so it might not)
(In the following section, I've tried to boldface the terminology words that are 1) are crucial to understanding how to use Orchard and 2) helpful in finding your way around the dashboard)
Another option may be first creating a Content Type--probably one named Product with some Fields describing an individual product. Price, SKU and description come to mind, but you'll be better able to describe your own products. Each Content Type in Orchard can be associated with any combination of Parts. You may have to research which ones you actually want for an individual product, but I'd recommend:
Body (this could replace the Description I suggested above) You could include any amount of HTML/script in this section to make your individual product pages look fancy!
Common (this has to be added when Containable is used)
Containable (this will allow the items to be listed)
Route (so you can link to a specific product)
This gives each product its own slug (URL)
Tags (to allow products to be categorized)
Now, you need to create a new List from the dashboard so you can display the products together (and inherit other features like pagination, etc). Be sure to select the Product Content Type in the Contains drop down list.
Then, you can start creating your Content (your Products) one by one. In the dashboard, click the new Product item and describe each new piece of Content.
Finally, you can link directly to this new List using the Products List's *slug*. You could (and might want to) add the Products List to your main navigation menu. Clicking the Products List and checking the "Show on main menu" box will automagically add a navigation button directly to this page. You could, of course, link to this List from anywhere using the slug (also found on the list's edit page)
This page, from the Orchard documentation pages describes more things you can do with a list of content like modifying the layout of the list, placing content fields in different places and even converting your products to widgets which you could use to display some promotional product offering in a special spot on your site.
I highly recommend reading through at least the documentation provided on the Orchard site to get a good grasp of what this CMS can do out of the box and what you would need to write custom code to accomplish (which you could do in this case, but Orchard can handle it out of the box)
Hope this helps!
Two ways to do this:
http://orchardproject.net/docs/Creating-lists.ashx and http://orchardproject.net/gallery/List/Modules/Orchard.Module.Contrib.Taxonomies

Resources