3 replies [Last post]
Insurrectus's picture
Offline
Spreading the word - Ubercart for president.
Joined: 08/22/2007
Juice: 364
Was this information Helpful?

Hell
I'm trying to configure Workflow-NG to send an order update email only for order status = "payment_received".

The built in admin notification sends an email with status "in_checkout", which won't work in my situation. Our fulfillment house prefers to receive email notification of orders. But we only want to send this notification when order status = "payment_received".

I'm using this code as a custom PHP execution when an order status gets updated, the script works fine expect for the sku and quantity, and I haven't been able to find order tokens for this:

<?php
$to
= "clint.eagar@gmail.com";
$subject = "Order Notification Test";
$body = "
Order Number:
[order:order-id]

Date Ordered:
[order:order-date-created]

Status:
[updated_order:order-status]

Name:
[order:order-first-name] [order:order-last-name]

Shipping Name & Address:
[order:order-shipping-address]

Email address:
[order:order-email]

Item:
if (is_array($order->products)) {
    foreach ($order->products as $product) {
        echo $product->qty; x
        if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
            foreach ($product->data['attributes'] as $key => $value) {
                echo $value;
            }
        }
        echo $product->model;
    }
}
Comments:
[order:order-comments]
"

;

if (

mail($to, $subject, $body)) {
  echo(
"<p>Message successfully sent!</p>");
} else {
  echo(
"<p>Message delivery failed...</p>");
}
?>

Any ideas?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Using Workflow NG to Send Order Notification on "Payment Rec

I intend to add an action to the D6 branch to send an order e-mail out that would allow for order tokens in the e-mail to address, subject, and body. When this happens, I'll try to back port it to get it into UC 1.6.

Sansui's picture
Offline
Joined: 06/05/2008
Juice: 154
Re: Re: Using Workflow NG to Send Order Notification on "Payment

It looks kinda like I'm trying to do the same thing here with a custom order notification - notify another user once order has been set to completed, and that user needs to see the product information + attributes.

I'm trying to get the product details in there using a custom php code action in Workflow-ng, but in the email all I get is this for the product area. It looks like its not actually executing the code, and the variables just show up blank? What am I doing wrong?

                         if (is_array(Array)) {
                           foreach (Array as ) {
                               echo ;
                               echo  .' - '. uc_currency_format( * );
                               if ( > 1) {
                                   echo t('(!price each)', array('!price' => uc_currency_format()));
                               }
                               echo t('Model: ') . ; ?>
                               if (is_array(['attributes']) && count(['attributes']) > 0) {
                                   foreach (['attributes'] as  => ) {
                                       echo '<li>'.  .': '.  .'</li>';
                                 }
                           }

                           }
                         }

And here's the code just copied over from the customer order template:

                          if (is_array($order->products)) {
                            foreach ($order->products as $product) {
                            echo $product->qty;
                            echo $product->title .' - '. uc_currency_format($product->price * $product->qty);
                            if ($product->qty > 1) {
                                echo t('(!price each)', array('!price' => uc_currency_format($product->price)));
                            }
                            echo t('Model: ') . $product->model; ?>
                            if (is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
                                foreach ($product->data['attributes'] as $key => $value) {
                                echo '<li>'. $key .': '. $value .'</li>';
                              }
                            }

                            }
                          }

Sansui's picture
Offline
Joined: 06/05/2008
Juice: 154
Re: Re: Re: Using Workflow NG to Send Order Notification on "Pay

I'm gonna chalk this one up to not being awake + general newbishness. Problem solved