コード例 #1
0
ファイル: SendEMail.php プロジェクト: bcbrr/TransferPayment
 public function update_status(OrderEvent $event)
 {
     if ($event->getOrder()->getPaymentModuleId() === TransferPayment::getModCode()) {
         if ($event->getOrder()->isPaid()) {
             $contact_email = ConfigQuery::read('store_email');
             if ($contact_email) {
                 $message = MessageQuery::create()->filterByName('order_confirmation_transferpayment')->findOne();
                 if (false === $message) {
                     throw new \Exception("Failed to load message 'order_confirmation_transferpayment'.");
                 }
                 $order = $event->getOrder();
                 $customer = $order->getCustomer();
                 $this->parser->assign('order_id', $order->getId());
                 $this->parser->assign('order_ref', $order->getRef());
                 $message->setLocale($order->getLang()->getLocale());
                 $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::read('store_name'));
                 // Build subject and body
                 $message->buildMessage($this->parser, $instance);
                 $this->getMailer()->send($instance);
             }
         }
     }
 }
コード例 #2
0
 /**
  * this method returns a Propel ModelCriteria
  *
  * @return \Propel\Runtime\ActiveQuery\ModelCriteria
  */
 public function buildModelCriteria()
 {
     $order = OrderQuery::create()->findPk($this->getOrderId());
     $search = TransferPaymentConfigQuery::create();
     if ($order === null || $order->getPaymentModuleId() !== TransferPayment::getModCode()) {
         $search->filterByName("");
     }
     $search->orderBy('placement');
     return $search;
 }