<?php
namespace Customize\Service;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
class CartHelper extends \Eccube\Service\CartService
{
const SaveCartType = 'Session_SaveCartType';
/**
* 2022/06/16 tkgoya
*
* @return int|void
*/
public function GetCartType($Flg = false)
{
$Carts = $this->getCarts();
if (count($Carts) < 1) {
if ($Flg) {
return $this->session->get(self::SaveCartType) ?? 0;
} else {
return 0;
}
}
foreach ($Carts as $Cart) {
$this->session->set(self::SaveCartType, $Cart->getCartType());
return $Cart->getCartType();
}
}
public function UnsetCartType()
{
$this->session->Set(self::SaveCartType, null);
}
}