- <?php
- /*
- * Plugin Name : CustomerRank
- *
- * Copyright (C) BraTech Co., Ltd. All Rights Reserved.
- * http://www.bratech.co.jp/
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Plugin\CustomerRank42\Event;
- use Eccube\Event\EccubeEvents;
- use Eccube\Event\EventArgs;
- use Plugin\CustomerRank42\Service\CustomerRankService;
- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
- class ShoppingEvent implements EventSubscriberInterface
- {
-     private $customerRankService;
-     public function __construct(
-             CustomerRankService $customerRankService
-             )
-     {
-         $this->customerRankService = $customerRankService;
-     }
-     /**
-      * @return array
-      */
-     public static function getSubscribedEvents()
-     {
-         return [
-             EccubeEvents::FRONT_SHOPPING_COMPLETE_INITIALIZE => 'hookFrontShoppingCompleteInitialize',
-         ];
-     }
-     public function hookFrontShoppingCompleteInitialize(EventArgs $event)
-     {
-         $Order = $event->getArgument('Order');
-         $Customer = $Order->getCustomer();
-         if(!is_null($Customer))$this->customerRankService->checkRank($Customer);
-     }
- }