public function sendEmail(RestockingAlert $subscriber) { $contactEmail = ConfigQuery::read('store_email'); if ($contactEmail) { $message = MessageQuery::create()->filterByName('stockalert_customer')->findOne(); if (null === $message) { throw new \Exception("Failed to load message 'stockalert_customer'."); } $pse = ProductSaleElementsQuery::create()->findPk($subscriber->getProductSaleElementsId()); $this->parser->assign('locale', $subscriber->getLocale()); $this->parser->assign('pse_id', $pse->getId()); $this->parser->assign('product_id', $pse->getProductId()); $message->setLocale($subscriber->getLocale()); $instance = \Swift_Message::newInstance()->addTo($subscriber->getEmail(), ConfigQuery::read('store_name'))->addFrom($contactEmail, ConfigQuery::read('store_name')); // Build subject and body $message->buildMessage($this->parser, $instance); $this->mailer->send($instance); Tlog::getInstance()->debug("Restocking Alert sent to customer " . $subscriber->getEmail()); } else { Tlog::getInstance()->debug("Restocking Alert message no contact email Restocking Alert id", $subscriber->getId()); } }
/** * Exclude object from result * * @param ChildRestockingAlert $restockingAlert Object to remove from the list of results * * @return ChildRestockingAlertQuery The current query, for fluid interface */ public function prune($restockingAlert = null) { if ($restockingAlert) { $this->addUsingAlias(RestockingAlertTableMap::ID, $restockingAlert->getId(), Criteria::NOT_EQUAL); } return $this; }