<?php declare(strict_types=1);
namespace GlobusSW6\Core\Checkout\Cart;
use GlobusSW6\Service\StoreLocator\Struct\PickupStoreStruct;
use Shopware\Core\Checkout\Cart\Cart;
use Shopware\Core\Checkout\Cart\CartBehavior;
use Shopware\Core\Checkout\Cart\CartDataCollectorInterface;
use Shopware\Core\Checkout\Cart\LineItem\CartDataCollection;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
class IaneoCartCollector implements CartDataCollectorInterface
{
/** @var SessionInterface */
private $session;
public function __construct(SessionInterface $session)
{
$this->session = $session;
}
public function collect(CartDataCollection $data, Cart $original, SalesChannelContext $context, CartBehavior $behavior): void
{
//TODO SMN Ist das sicher?
$storeId = $this->session->get('ianeoCurrentStore');
$original->addExtension(
"ianeo_pickup_data",new PickupStoreStruct($storeId,'pickup')
);
}
}