I set up a Rule with event "Order state is updated - per order line", and in the action I use uc_order tokens and uc_line_item tokens. This works fine for anonymous checkout if Pathauto is disabled. But if pathauto is enabled, then the uc_order and uc_line_item tokens don't replace at all for anonymous checkouts.
HOW TO REPLICATE
- Install Drupal 6
- Download ubercart, token, uc_rules, rules, pathauto
- Enable Ubercart core required modules, plus token, uc_rules, rules and rules ui
- Create a new Product with any name, sku, and sell price
- Create a new rule with event Order State is updated - per order line, and any action where you can use uc_line_item or uc_order tokens, such as "Adds a comment to the order"
- Test anonymous checkout, token replacement works
- Enable pathauto and test anonymous checkout again, token replacement breaks
- Disable pathauto and test anonymous checkout again, token replacement works again
Comments
Comment #1
ericbroder commentedAt first I thought the data was being lost somehow, but when I run through my php debugger I can see the data is available, it's just not being accessed properly for some reason. I was able to hack token.module to just force the token replacement:
And I don't know if this is related but I also got really weird results in my php debugger, like false readings on variable values, such as arrays that show up with only 30 keys but really have a lot more keys. I was trying to analyze this part of the above function:
Any ideas?
Comment #2
owen barton commentedJust reporting that I was able to reproduce this - haven't figured out a cause yet. I did notice that the issue is resolved (for me) when clean_urls is disabled, so it is appears perhaps broader than pathauto. I have confirmed that the uc_rules_token_values() return value is the same regardless of the clean_url setting.
Comment #3
m.stentaI am also experiencing this. Looking for a fix now...
Comment #4
m.stentaOk, I figured this out. It's actually a duplicate of this issue: #1234052: Token hooks should not be in Rules include file, so I'm marking this as a duplicate.
I posted a patch to that issue that solves the problem for me.