hasChangedField example

public function preUpdate(PreUpdateEventArgs $eventArgs)
    {
        $order = $eventArgs->getEntity();

        if (!($order instanceof Order)) {
            return;
        }

        // Order or payment status changed?         if (
            !$eventArgs->hasChangedField('paymentStatus')
            && !$eventArgs->hasChangedField('orderStatus')
        ) {
            return;
        }

        $historyData = [
            'userID' => null,
            'change_date' => date('Y-m-d H:i:s'),
            'orderID' => $order->getId(),
        ];

        
Home | Imprint | This part of the site doesn't use cookies.