예제 #1
0
 public function onOrderPreUpdateEvent(ResourceEvent $event)
 {
     $order = $event->getResource();
     if ($order instanceof OrderInterface) {
         $this->removeTotals($order);
         $this->recalculateShippingTotal($order);
         $this->traverseOrder($order);
     }
 }
예제 #2
0
 public function onClientPostCreate(ResourceEvent $event)
 {
     $client = $event->getResource();
     if ($client instanceof ClientInterface) {
         $email = $client->getContactDetails()->getEmail();
         $title = $this->getTranslatorHelper()->trans('client.email.heading.register');
         $body = $this->getEmailBody($client);
         $shop = $client->getShop();
         $this->getMailerHelper()->sendEmail($email, $title, $body, $shop->getMailerConfiguration());
     }
 }
예제 #3
0
 public function onUserPreCreate(ResourceEvent $resourceEvent)
 {
     $password = $this->getSecurityHelper()->generateRandomPassword();
     $role = $this->get('role.repository')->findOneByName('admin');
     $user = $resourceEvent->getResource();
     if ($user instanceof UserInterface) {
         $user->addRole($role);
         $user->setPassword($password);
         $email = $user->getEmail();
         $title = $this->getTranslatorHelper()->trans('user.email.title.register');
         $body = $this->getEmailBody($user, $password);
         $shop = $this->get('shop.context.admin')->getCurrentShop();
         $this->getMailerHelper()->sendEmail($email, $title, $body, $shop->getMailerConfiguration());
     }
 }
예제 #4
0
 /**
  * Sets resource settings fetched from fieldset corresponding to selected box type
  *
  * @param ResourceEvent $event
  */
 public function onLayoutBoxResourceSave(ResourceEvent $event)
 {
     $settings = $this->getBoxSettingsFromRequest($event->getRequest());
     $resource = $event->getResource();
     $resource->setSettings($settings);
 }
예제 #5
0
 public function onCartChangedEvent(ResourceEvent $event)
 {
     $this->cartVisitorTraverser->traverse($event->getResource());
 }
예제 #6
0
 public function onOrderPostPreparedEvent(ResourceEvent $event)
 {
     $this->orderVisitorTraverser->traverse($event->getResource());
 }