In a website for comparing products you typically want to show a general list of products that can be sorted. You also want the user to be able to select the most interesting rows for a more detailed comparison. VBO now includes an action that lets you do this - Argument Selector (added in the 6.x-1.8 version).

Argument Selector can be used for any kind of objects that VBO supports, but this example uses nodes. The arguments can be passed to any kind of page. In this example we pass them to another view.

Step 1: Create the target view

Create a new view for the detailed comparison. This should be an ordinary view without VBO. Add "Node: nid" as Argument. In the configuration for this argument, set Validator to Node, set Types to the node type you want to use, set Argument type to "Node IDs separated by , or +" and check "Allow multiple terms per argument".

Add a page display to the view and set an appropriate path for it, for instance "products/detailed". Click Save.

Step 2: Create the action

Go to admin/settings/actions. In the list of advanced actions you select "Pass objects as arguments to a page..." and click the Create button.

There are two fields to configure for the action.

Description: This text will be displayed on the button (or drop-down list) of the source view.
URL: This is the target URL you choose in step 1 above.

Step 3: Create the source view

Create a new view with style set to Bulk Operations. Select "Each action as a separate button", "Skip confirmation step" and the action that you created in step 2 (Note! You should not use the Batch API). Then click "Update default display.

Add a page display to the view and set an appropriate path for it, for instance "products". Click Save.

Comments

TommyGuns’s picture

Hi thanks for this. I cant seem to find "Pass objects as arguments to a page..." selection in my list of advanced actions.

Also stepping backwards; "Node IDs separated by , or +" I cant find where this would go, I can only assume that I should check 'provide default argument' then check 'Fixed entry' and enter the argument in by hand (i.e its not a selection)?

Cheers

nadam’s picture

For the first problem, make sure you are using the development snapshot 6.x-1.x-dev version of VBO (until it is included in the official release).

I also had problem finding the Argument type due to a bug somewhere in Views (I think). I have the OG module installed and that causes "Group nodes" to appear in the Validator drop-down. The solution was this:

1. Change validator to "Group nodes"
2. Select "Node IDs separated by , or +" as Argument type
3. Change validator back to "Node"

Depending on what modules you have installed, you may need to do something similar.

Cheers,
Adam

TommyGuns’s picture

Hi Adam, first of all thanks alot for your response, and your personal/email (as I would of probably forgotten all about it, trying to learn alot quickly here, so seem to jumping around the place!

The info you gave was spot on, I also have OG installed and it was fixed/found by selecting from within "group nodes", then changing back to standard "node".

& Likewise once I upped the Dev version the option was there.

So generally all good, thanks for your help.

Although now im having alittle trouble getting the bulk action to pass the user to the detailed view/page. Just seems to refresh that page at the mo. Although im sure after a few hours of flicking switches ill get there.

Cheers

Phil

thaipeace’s picture

Thanks for all, I can track in almost steps to create the node comparison. But when I come to setting/actions I can't see "Pass objects as arguments to a page..." by anyway. May i have to use OG modules ? I have got views, cck, VBO , is it enough ? How can I got this task ?

nadam’s picture

Just make sure it's the dev version of VBO.

hailander’s picture

thanks for this great tuto
my problem is that i have created action "pass argument..." and put the url where arguments will be passed

but it still ask me the url (where argument will be passed) every time i make a comparison .
i don't figure out the problem
___________________________
i resolved the problem (there was confusion because i didn't changed the original action description name )

jpcwebb’s picture

The limitation with this approach is that you can only pass objects selected from the primary tables that you choose to create your view from. If you want to pass a specific field value however, this doesn't work. Any suggestions on how to do that?

tun@sun’s picture

Hi,

I want to pass objects(NIDs) to a node creation page like 'node/add/example' where I will get passed NIDs.
And then I will create a new content including referenced to passed NIDs.
Currently, I don't see any arguments at url although the target url is reached.
And suggestion, please.

vkr11’s picture

Subscribe

efreedom’s picture

I'm getting an error that says: "warning: implode() [function.implode]: Bad arguments. in /var/www/drupal_base/contrib/modules/views_bulk_operations/argument_selector.action.inc on line 31."

Any thoughts on what might cause that. I've doublechecked the settings you have and except for the end step, it seems to behave the way I expect.

I set up two views. testbulk for the VBO. testprintlist for the view I am passing the arguments to.

When I set the path for testprintlist, is it "testprintlist" or "testprintlist/%". (I tried both. Without the argument it prints the whole list and with the argument it says the page is not found.

The actual view does work. http://www.webhost2u.net/qigong/classes/print/list/162,147 where I actually pass the list of nodes. Just hooking the two together seems to be the problem.

So, apparently the node ID isn't being passed correctly. How do I find out what is in fact being passed? And once I know, will that help? :-)

ShaneOnABike’s picture

This is a really great feature and extremely helpful for some customisation of CiviMail we are doing.

Step 1: Create the target view

Create a new view for the detailed comparison. This should be an ordinary view without VBO. Add "Node: nid" as Argument. In the configuration for this argument, set Validator to Node, set Types to the node type you want to use, set Argument type to "Node IDs separated by , or +" and check "Allow multiple terms per argument".

Add a page display to the view and set an appropriate path for it, for instance "products/detailed". Click Save.

I actually found that using the 'Basic' validation to be more effective. For some reason passing all the objects to the Node validation seemed to continually fail for me. I then setup my VBO view to limit the content types based on a selection that I made.

Hope that helps other along the way.

Summit’s picture

Hi, Will this also work for D7?
Greetings, Martijn