I don't understand how to use the module!
the only new event in rules after installing the module is "was accessed",
but where I can generate/chose the link?

I want to send a link in an email that when clicked triggers a rule set of actions.

thanks,
Federico

Comments

Coyote’s picture

Yeah. I'm kind of confused about this also.

I created a test rule, set to fire on "was accessed"

I added no conditions (I also tried it with a condition that would automatically validate as true).

I attached an action to display a system message.

Nothing happens, ever.

Coyote’s picture

Okay, I think I figured out where part of the problem is, at least:

There was no way to access the config page. Don't know why, but hook_menu in your module was not allowing it to be created unless there was already a variable in rules_linkevent.

So, I set that to a value, then had to set the config page to an url outside the url structure for rules - nothing would get it to show up with the url you used, even after multiple cache refreshes.

I then set up values per the instructions on the form, recreated the action, and still nothing. Nothing happens either when visiting the url from the action, clicking a link to it, anything.

aidanlis’s picture

Go here, admin/config/workflow/rules/links to create a URL, then go and create a Rule.

federico.parra’s picture

lol, there is no such a menu.

That's the problem!

:(

aidanlis’s picture

Did you forget to install the module?

federico.parra’s picture

haven't you read Coyote's comment #2? the module does not install correctly;
it doesn't display the rules/links menu. Of course I installed it, but it seems it doesn't work :(

deggertsen’s picture

Title: How to use? » How to use? Provide example link and rule.
Component: Code » Documentation
Category: support » feature

The patch in this issue fixes the problem. #1327396: Undefined Offset

However, it still doesn't address the missing documentation. There should, at a minimum, be some documentation that says what is explained in #3. Plus it would be VERY helpful to have an example link and rule created for that link just so end users can see the basics of how it works.

deggertsen’s picture

Here is something that could be used for some basic documentation for drupal commerce users. I have not tested it from a clean install, but it should work just fine once the patch in #1327396: Undefined Offset is committed.

Creating an add to cart link

Before following this tutorial be sure that you have Rules link event and Drupal Commerce installed on your site.

Go to admin/config/workflow/rules/links to create a link. For this example enter the following into the text area:
purchase|cart/add/%|Quick add to cart link
Be sure to click "Save Configuration" and then go to admin/config/workflow/rules/reaction/import to import the following rule:

{ "rules_add_to_cart_link" : {
    "LABEL" : "Add to cart link",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "Cart Links" ],
    "REQUIRES" : [ "rules", "commerce_cart", "rules_linkevent" ],
    "ON" : [ "rules_linkevent_purchase" ],
    "DO" : [
      { "commerce_cart_product_add_by_sku" : {
          "USING" : {
            "user" : [ "site:current-user" ],
            "sku" : "[path:last]",
            "quantity" : "1",
            "combine" : 1
          },
          "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
        }
      }
    ]
  }
}

Click Import and you're all set to create links throughout your site using cart/add/your_sku to create links that add product to the shopping cart. Be sure to replace "your_sku" with the SKU of the product you would like to have added to the cart when the link is clicked.

deggertsen’s picture

Status: Active » Needs review

Marking as needs review as I believe #8 fulfills the requirements of this issue.

mrkrettan’s picture

Does this work for multiple skus? Say I want to add product one and product two to the shoppingcart for whoever visits the url?

deggertsen’s picture

As far as I know this module does not work for multiple skus. I suggest you open a new feature request issue addressing that rather than hijacking this one.

Thanks!

mrkrettan’s picture

Ok, will do some more research and then maybe do that. Thanks!

silkogelman’s picture

Status: Needs review » Reviewed & tested by the community

#8 works perfectly.
Thank you for providing this example deggertsen!

Note: when adding / editing your own Rule Link Events to admin/config/workflow/rules/links: make sure to clear the cache after doing this if your links don't work like they are supposed to.

aidanlis’s picture

@deggertsen do you want to take over maintenance of this module? I'd love you to!

deggertsen’s picture

I've never been a module maintainer before and am frankly not much of a programmer, more of a site builder. I'm happy to help where I can though, but I'm not quite sure where to get started.

aidanlis’s picture

Ah you'd need to be familiar with programming and version control ... let me know when you've skilled up! :)

deggertsen’s picture

@aidanlis I've spent some time studying up on version control and have brushed up quite a bit on my php (though I'm still no expert). If you're still interested I would be willing to do what I can to help maintain the module. This would be a first for me, but I think it's about time for me to jump in.

aidanlis’s picture

Sounds good buddy, I've added you to the list of maintainers, good luck!

akalata’s picture

Added a workaround for multiple skus at #2053297: Workaround for multiple skus so as not to derail this issue. :)

deggertsen’s picture

Status: Reviewed & tested by the community » Fixed

I'm going to mark this as fixed since I have added a documentation link to the project page. Please feel free to contribute your example rules and any other ideas and documentation that may be useful there.

https://drupal.org/node/2056717

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.