We could use a few pointers on how to use parameters with Rules Link.

For example for building an 'add product to cart' link like example.com/add-to-cart/%

On blog pages we like to be able to refer to links of something like example.com/add-to-cart/% and execute a Rule.
In our case the % would be the SKU of a product and it would add them to the cart.

I've managed to do it with rules_linkevent module (http://drupal.org/node/1327396#comment-6955218) and it looks like it is possible with rules_url_argument module, but as rules_link module seems to be the solution moving forward it would be nice to have a parameter usecase example.

Pointers are appreciated.

Comments

apmsooner’s picture

Issue summary: View changes

For your example, add the product sku field to your view and pass the token for that in the views rules link field settings under: Additional parameters for the rules link

Edit the rules link component, click the configure rules tab, under settings, add the additional parameter. I assume it could be string, integer or whatever that matches your sku. The view is going to pass that parameter as a variable to use in the rules link component rules so you can do whatever you want with it from there.

apmsooner’s picture

Status: Active » Closed (works as designed)
tory-w’s picture

Hey! I know I'm a "little late to the party", but I wanted to clarify and help with what I think silkogelman is asking. In Views, in the "Additional parameters for the rules link" field for a Rules Link field, if you enter, for example, a destination parameter, you might be inclined to simply type ?destination=node/123. Can't do that. For some reason Views does not like symbols in some spots. So, for this you have to use HTML for symbols.

Example: ?destination=node/123

If you do not know the symbols, Google something like, "Question Mark HTML" or "Equal sign HTML".

I hope this helps someone else!