Hi 
I'm trying to create a workflow_ng configuration that triggers on 'Customer completes checkout' -- and checks whether any products in an order have a particular attribute option selected. My goal is to send a different email with instructions to the user based on which of three options they select.
Currently the only way I know how to do this is create a SKU for each attribute combination on the product that contains my desired option - and use workflow_ng to check the SKU. The problem here is there are like 24 pages of combinations just for 3 options (because I have other attributes with many options, if you see what I mean), and while it would only take a few minutes per product to paste the SKUs into all of those attribute combinations, they get reset whenever I change any attribute settings. kind of not an ideal way to do it.
I was hoping to use the 'Execute custom PHP code' condition, and add a snippet which would be able to check the specific attribute option I want to use for the condition - either by the option name or $key (eg, '24').
So this is my support request in a nutshell -- what would a PHP snippet look like to check a particular attribute option? I'm taking a wild guess based on the uc_attribute_options function (but a slightly less wild guess is I'm totally wrong about this):
<?php
// set condition to FALSE by default
$output = FALSE;
// set condition to TRUE if any product in order has selected my desired option
$myoption = '24';
while ($attribute->options as $key => $data) {
if (in_array($key, '24')) {
$output = TRUE;
}
}
// if output is FALSE, my action will not meet the condition - if TRUE it will
return $output;
?>Am I totally way off here? Is there a better way to check this?
Thanks in advance for your advice on this one!
Scott
PS, I noticed there's not much in the workflow snippets page on ubercart... maybe this could go in there once we get a working snippet? 
PPS, For the email, I planned to use the workflow_ng action 'Send a mail to an arbitrary mail address', and add the [order:order-email] token as the Recipient - I haven't been able to test this but I'm assuming this should work?






Joined: 10/08/2007