This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Webshop: How do I trigger a function...

Webshop: How do I trigger a function when changing status?

Webshop: How do I trigger a function when changing status?

Tuesday 13 September 2005 12:24:47 pm - 8 replies


I have finally got so far that the shop I've working on for the last weeks actually works. One of the final stages, it to give administrator a way to process the orders in such a way that an email is sent to the customer with the purcased items (files).

Okey; I think the best way to do this is to trigger a workflow or a pure mail-function when the administrator chooses "delivered" from the dropdown at the order list screen, but how can I do this?

Modified on Tuesday 13 September 2005 1:39:03 pm by Kjell Inge Sandvik

Tuesday 13 September 2005 3:17:13 pm


Wednesday 14 September 2005 11:42:50 am

Guess I have to explain this a bit clearer happy.gif Emoticon

What I try do do, is to get the admin-system to send the customer an email containing of urls to the bought items (pictures, documents and other files). This should happen in the same moment that admin changes the order's status from Pending to Delivered.

I try to modify shop/orderlist.tpl in the admin-directory. The problem is that the $product_list seem non-existent in this template; How can I get the products that the customer have bought inside this template, and how do I send the email?

Tuesday 22 November 2005 2:08:06 pm

I have the same problem. Updated from 3.6.1 to 3.6.2 no email was sent any more for shoporders.

I do a new clean installation, put in [InformationCollectionSettings]

still nothing. I found no eventtype for email sending. No idea for a solution.


happy.gif Emoticon

Tuesday 22 November 2005 7:08:24 pm

everythings is fine after update to 3.6.4

Wednesday 13 December 2006 2:23:15 pm

You have solved the problem?

Please, if it's thus, you communicate me since you have resolved it.

My mail is

Monday 02 July 2007 11:14:01 pm

did anyone come up with a solution for this?

Wednesday 27 August 2014 4:27:07 pm

quick & dirty blunk.gif Emoticon

ezp4.7 // Community 2012.08


if ( $http->hasPostVariable( 'SaveOrderStatusButton' ) )
    if ( $http->hasPostVariable( 'StatusList' ) )
        foreach ( $http->postVariable( 'StatusList' ) as $orderID => $statusID )
            $order = eZOrder::fetch( $orderID );
            $access = $order->canModifyStatus( $statusID );
            if ( $access and $order->attribute( 'status_id' ) != $statusID )
                $order->modifyStatus( $statusID );
$email = $order->attribute( 'account_email' );
$tpl->setVariable( 'order', $order );
$templateResult = $tpl->fetch( 'design:shop/statusemail.tpl' ); // create a template
$subject = $tpl->variable( 'subject' );
$mail = new ezcMailComposer();
$emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
if ( !$emailSender )
$emailSender = $ini->variable( "MailSettings", "ShopAdminEmail" );
$mail->charset = 'utf-8';
$mail->addTo( new ezcMailAddress( $email ) );
$mail->from = new ezcMailAddress( $emailSender );
$mail->subject = $subject;
$mail->htmlText = $templateResult ;
$transport = new ezcMailMtaTransport();
$transport->send( $mail );

Thursday 28 August 2014 2:08:55 am

Hello Dirk,

Thank you for sharing your solution.

I posted a gist on GitHub containing a cleaned up version of your solution for others to use.

I hope this helps others!



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from