1

In my drupal commerce installation are two roles and one of them havn`t the permission for the admin/commerce/products path. They get an "access denied". Thats not so nice. How can i overwrite the path from the submit button in the product form to another site (maybe to a views page)?

I`m little bit confused, is it not possible to show only the products from the current logged in user on the admin/commerce/products path? I be really convinced that i give all the right permission.

Thx! Bruno

2

As with most listings in the commerce module suite, the admin/commerce/products listing is already a view. It is a default view provided by the module.

If you go to the listing of views on your site, you can override the "Products" (commerce_products) view and make any changes you want.

For example, you can change the permission required to view the page, then you can change the view to only show products created by the current user.

You could then also create a second view that shows all products if you still needed that.

Really you can do anything to it that views will allow.

  • Damn! Ok, i didn`t realized it is a view. 3 klicks and it works for me. Thanks! – Bruno Oct 4 '13 at 8:11
3

Easy to do with Rules, no coding required.

You can import this rule export, but will need to adjust the role ID and redirect path to match

Redirect on product save using Rules

{ "rules_redirect_on_product_save" : {
    "LABEL" : "Redirect on product save",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "entity" ],
    "ON" : [ "commerce_product_update" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "3" : "3" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "somepath" } } ]
  }
}

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.