app/Customize/Service/CartHelper.php line 27

Open in your IDE?
  1. <?php
  2. namespace Customize\Service;
  3. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  4. class CartHelper extends \Eccube\Service\CartService
  5. {
  6.     const SaveCartType 'Session_SaveCartType';
  7.     /**
  8.      * 2022/06/16 tkgoya
  9.      *
  10.      * @return int|void
  11.      */
  12.     public function GetCartType($Flg false)
  13.     {
  14.         $Carts $this->getCarts();
  15.         if (count($Carts) < 1) {
  16.             if ($Flg) {
  17.                 return $this->session->get(self::SaveCartType) ?? 0;
  18.             } else {
  19.                 return 0;
  20.             }
  21.         }
  22.         foreach ($Carts as $Cart) {
  23.             $this->session->set(self::SaveCartType$Cart->getCartType());
  24.             return $Cart->getCartType();
  25.         }
  26.     }
  27.     public function UnsetCartType()
  28.     {
  29.         $this->session->Set(self::SaveCartTypenull);
  30.     }
  31. }