Is there any way to compare nodes of different types but with the same fields?

  • I have 2 content types: Flats to rent and Flats wanted

  • Both types have the sames fields: rooms and city

  • In a view I have a list of the Flats wanted and each one has a button: find flats

  • When you click the find flats button I need to show all the flats to rent that have the same values for: rooms and city than the clicked flat wanted

I already get it working by creating a View using $_GET variables in the url and arguments. But I need to use clean urls, then$_GET must go out.

Is there any way to do this in a cleaner way? I need to do it using View because I need to be able to apply bulk operations in the resulting list.

Maybe a module could do this??


  • Please elaborate on $_GET and Clean URLs. Clean URLs does not affect what is available via $_GET. Clean URLs only affects how URLs generated by Drupal look like. The translation of a "clean" URL to a canonical one is done by the webserver and Drupal hardly ever notices that the user actually entered a "clean" URL. – Oswald Aug 23 '11 at 11:00
  • by clean url I meant: passing just the id of the 'flat wanted' type node. Then after the View should look for coincidences in 'flats to rent' type nodes and list them. – chefnelone Aug 23 '11 at 11:14
  • I guess you'll be better off with panels. – Capi Etheriel Aug 23 '11 at 12:20
  • @barraponto how would you do it? – chefnelone Aug 23 '11 at 20:07

I would create a custom field handler. This gives you full PHP power about how the link of the "find flats" button will look like.

Writing your own handlers for views maybe looks difficult at the beginning. Once you understand it you will use it a lot. Here I found a how to about how to do that (it's for views 2). You'll find a lot of real world examples in all modules that do support views. Look for code like MYMODULE_views_handlers .

| improve this answer | |

Just because you enabled clean_urls does not mean you cannot amend additional arguments. On the contrary, Drupal will intelligently pass your additional arguments directly to the View or to whatever module.

For example, these paths:


will both take you to the same place.

If your view is at the path 'flats' you could simply append arguments to the url:


and Views can handle them just fine.

I wouldn't recommend panels.

| improve this answer | |
  • I see your point but the two content types I need to compare have more than 50 field. Adding 50 arguments in a path will produce a ugly url. I´m now working in creating a module to compare nodes sharing the same fields. Why do you recommend me to use Panels? – chefnelone Nov 1 '11 at 12:41

Try Node Compare. At the moment it is the most elegant and easy solution to compare nodes in Drupal.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.