protected function actionListOrder()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $deleted = $updated = 0;
        $failed_notifications = array();

        foreach ($selected as $id) {

            if ($action === 'status' && $this->access('order_edit')) {

                $updated = (bool) $this->order->update($id, array('status' => $value));

                if ($updated && $this->setNotificationUpdateOrder($id) == static::NOTIFICATION_ERROR) {
                    $failed_notifications[] = $this->text('<a href="@url">@text</a>', array(
                        '@url' => $this->url("admin/sale/order/$id"), '@text' => $id));
                }

                $updated++;
            }

            if ($action === 'delete' && $this->access('order_delete')) {
                $deleted += (int) $this->order->delete($id);
            }
        }

        if ($updated > 0) {
            $message = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($message, 'success');
        }

        if (!empty($failed_notifications)) {
            $vars = array('!list' => implode(', ', $failed_notifications));
            $message = $this->text('Failed to notify customers in orders: !list', $vars);
            $this->setMessage($message, 'warning');
        }

        if ($deleted > 0) {
            $message = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($message, 'success');
        }
    }
protected function actionListOrder()
    {
        list($selected, $action, $value) = $this->getPostedAction();

        $deleted = $updated = 0;
        $failed_notifications = array();

        foreach ($selected as $id) {

            if ($action === 'status' && $this->access('order_edit')) {

                $updated = (bool) $this->order->update($id, array('status' => $value));

                if ($updated && $this->setNotificationUpdateOrder($id) == static::NOTIFICATION_ERROR) {
                    $failed_notifications[] = $this->text('<a href="@url">@text</a>', array(
                        '@url' => $this->url("admin/sale/order/$id"), '@text' => $id));
                }

                $updated++;
            }

            if ($action === 'delete' && $this->access('order_delete')) {
                $deleted += (int) $this->order->delete($id);
            }
        }

        if ($updated > 0) {
            $message = $this->text('Updated %num item(s)', array('%num' => $updated));
            $this->setMessage($message, 'success');
        }

        if (!empty($failed_notifications)) {
            $vars = array('!list' => implode(', ', $failed_notifications));
            $message = $this->text('Failed to notify customers in orders: !list', $vars);
            $this->setMessage($message, 'warning');
        }

        if ($deleted > 0) {
            $message = $this->text('Deleted %num item(s)', array('%num' => $deleted));
            $this->setMessage($message, 'success');
        }
    }
protected function actionListOrder ( ) { list ( $ selected , $ action , $ value ) = $ this -> getPostedAction ( ) ; $ deleted = $ updated = 0 ; $ failed_notifications = array ( ) ; foreach ( $ selected as $ id ) { if ( $ action === 'status' && $ this -> access ( 'order_edit' ) ) { $ updated = ( bool ) $ this -> order -> update ( $ id , array ( 'status' => $ value ) ) ; if ( $ updated && $ this -> setNotificationUpdateOrder ( $ id ) == static :: NOTIFICATION_ERROR ) { $ failed_notifications [ ] = $ this -> text ( '<a href="@url">@text</a>' , array ( '@url' => $ this -> url ( "admin/sale/order/$id" ) , '@text' => $ id ) ) ; } $ updated ++ ; } if ( $ action === 'delete' && $ this -> access ( 'order_delete' ) ) { $ deleted += ( int ) $ this -> order -> delete ( $ id ) ; } } if ( $ updated > 0 ) { $ message = $ this -> text ( 'Updated %num item(s)' , array ( '%num' => $ updated ) ) ; $ this -> setMessage ( $ message , 'success' ) ; } if ( ! empty ( $ failed_notifications ) ) { $ vars = array ( '!list' => implode ( ', ' , $ failed_notifications ) ) ; $ message = $ this -> text ( 'Failed to notify customers in orders: !list' , $ vars ) ; $ this -> setMessage ( $ message , 'warning' ) ; } if ( $ deleted > 0 ) { $ message = $ this -> text ( 'Deleted %num item(s)' , array ( '%num' => $ deleted ) ) ; $ this -> setMessage ( $ message , 'success' ) ; } }
Applies an action to the selected orders
Applies an action to the selected orders