app/Plugin/CustomerRank42/Event/ShoppingEvent.php line 40

Open in your IDE?
  1. <?php
  2. /*
  3. * Plugin Name : CustomerRank
  4. *
  5. * Copyright (C) BraTech Co., Ltd. All Rights Reserved.
  6. * http://www.bratech.co.jp/
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Plugin\CustomerRank42\Event;
  12. use Eccube\Event\EccubeEvents;
  13. use Eccube\Event\EventArgs;
  14. use Plugin\CustomerRank42\Service\CustomerRankService;
  15. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  16. class ShoppingEvent implements EventSubscriberInterface
  17. {
  18.     private $customerRankService;
  19.     public function __construct(
  20.             CustomerRankService $customerRankService
  21.             )
  22.     {
  23.         $this->customerRankService $customerRankService;
  24.     }
  25.     /**
  26.      * @return array
  27.      */
  28.     public static function getSubscribedEvents()
  29.     {
  30.         return [
  31.             EccubeEvents::FRONT_SHOPPING_COMPLETE_INITIALIZE => 'hookFrontShoppingCompleteInitialize',
  32.         ];
  33.     }
  34.     public function hookFrontShoppingCompleteInitialize(EventArgs $event)
  35.     {
  36.         $Order $event->getArgument('Order');
  37.         $Customer $Order->getCustomer();
  38.         if(!is_null($Customer))$this->customerRankService->checkRank($Customer);
  39.     }
  40. }