PHP code example of deployecommerce / module-order-status-audit-log

1. Go to this page and download the library: Download deployecommerce/module-order-status-audit-log library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

deployecommerce / module-order-status-audit-log example snippets


use DeployEcommerce\OrderStatusAudit\Api\TransitionSinkInterface;
use DeployEcommerce\OrderStatusTransition\Api\Data\ActorInterface;
use DeployEcommerce\OrderStatusTransition\Api\Data\TransitionInterface;
use Magento\Sales\Model\Order;

class ReturnAlertSink implements TransitionSinkInterface
{
    public function record(Order $order, TransitionInterface $transition, ActorInterface $actor): void
    {
        if ($transition->getTo() !== 'return_to_sender') {
            return;
        }

        $this->notifier->send(sprintf(
            'Order %s came back — %s set it via %s',
            $transition->getIncrementId(),
            $actor->getLabel(),
            $actor->getTrigger()
        ));
    }
}
xml
<type name="DeployEcommerce\OrderStatusAudit\Model\Sink\CompositeSink">
    <arguments>
        <argument name="sinks" xsi:type="array">
            <item name="return_alert" sortOrder="30" xsi:type="object">My\Module\Model\ReturnAlertSink</item>
        </argument>
    </arguments>
</type>