0

I need to page redirect after the VBO operation.

The page redirects is inside a rule component that I have created for a new operation in VBO. This is the my new operation in my VBO: enter image description here

I have marked force redirect. And it doesn't work too. I tested installing rules debug, to see if rules was executed, and it shows as executed, but it doesn't redirect to cart. What could I check on this issue?

The debug is showing, skipping page redirect during the batching process, see it please.

enter image description here

How could I add a rule for page redirect, just after the batch process of my VBO operation? This could works.

Note: Not very relevant but

Here is the export of the rule:

{ "rules_vbo_add_to_cart" :

"LABEL" : "A\u00f1adir las fotos seleccionadas al carrito",
"PLUGIN" : "action set",
"OWNER" : "rules",
"REQUIRES" : [ "commerce_cart", "rules" ],
"ACCESS_EXPOSED" : "1",
"USES VARIABLES" : { "commerce_product" : { "label" : "Commerce product", "type" : "commerce_product" } },
"ACTION SET" : [
  { "commerce_cart_product_add_by_sku" : {
      "USING" : {
        "user" : [ "site:current-user" ],
        "sku" : [ "commerce-product:sku" ],
        "quantity" : "1",
        "combine" : "1"
      },
      "PROVIDE" : { "product_add_line_item" : { "product_add_line_item" : "Added product line item" } }
    }
  },
  { "redirect" : { "url" : "\/cart" } }
]

}

}

  • pasting an export of your rule would help. – No Sssweat Apr 21 '16 at 3:27
  • Please check recent log messages. – Nikhil Banait Apr 21 '16 at 6:07
  • exported the rule, and edited the question to clarify! – bunset Apr 23 '16 at 5:21
0

I have found a solution on how to do a custom page redirect, after an VBO Operation.

Here there is a patch to add a custom redirect field in the options https://www.drupal.org/node/2307381

I have applied the patch #6

in ./profiles/commerce_kickstart/modules/contrib/views_bulk_operations

using the command

patch < 2307381_6.patch

It asked me for file to patch, and I had to indicate:

file to patch: ./views/views_bulk_operations_handler_field_operations.inc

then patch done!.

Results is awesome and redirect specified is working perfectly!! so I am happy!

enter image description here

Thanks for all your help!!

0

There could be a possibility that some other redirect rule is overriding you page redirect to cart Rule. So please check if in case any other rule is getting triggered or not. If yes, then set priority of page redirect to cart rule's high.

  1. For checking if any other rule is overriding the "Page redirect to Cart" rule we can actually use watchdog('Backtrack message','<pre>'.print_r(debug_backtrack(),true).'</pre>'); It will give show everything what all code running at the time the rule triggers.

  2. You are absolutely correct sir, just need to set the weight of Page Redirect to Cart rule lower than other rule. It will set the priority higher.

  • Thank you Gaurav, 1. How could I check if any other rule is overriding my page redirect?. 2. Set priority of page redirect rule high means less the weight of rule? – bunset Apr 22 '16 at 0:37
  • Thank you Gaurav, where do I execute your watchdog line?. I tried to run it in devel -> run php code, and it gives me error Fatal error: Call to undefined function debug_backtrack() in /home1/bunset/public_html/tienda/sites/all/modules/devel/devel.module(1415) : eval()'d code on line 1 – bunset Apr 22 '16 at 19:37

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.