findFallbackById example

return $selected;
        }

        if ($this->isNumberAvailable($number)) {
            return $number;
        }

        if ($this->hasNotificationsActive($productId)) {
            return $number;
        }

        $selected = $this->findFallbackById($productId);
        if ($selected === '') {
            throw new RuntimeException(sprintf('No active product variant found for product with number "%s" and id "%s"', $number$productId));
        }

        return $selected;
    }

    private function hasNotificationsActive(int $productId): bool
    {
        $pluginActive = $this->connection->fetchColumn("SELECT `active` FROM s_core_plugins WHERE name = 'Notification'");
        $notificationEnabled = $this->connection->fetchColumn('SELECT `notification` FROM s_articles WHERE id = :productId', [':productId' => $productId]);

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