updateStockAndSales example

if ($event->getContext()->getVersionId() !== Defaults::LIVE_VERSION) {
            return;
        }

        if ($event->getEntityName() !== 'order') {
            return;
        }

        if ($event->getToPlace()->getTechnicalName() === OrderStates::STATE_COMPLETED) {
            $products = $this->getProductsOfOrder($event->getEntityId()$event->getContext());

            $this->updateStockAndSales($products, -1);

            return;
        }

        if ($event->getFromPlace()->getTechnicalName() === OrderStates::STATE_COMPLETED) {
            $products = $this->getProductsOfOrder($event->getEntityId()$event->getContext());

            $this->updateStockAndSales($products, +1);

            return;
        }

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