本文整理汇总了PHP中Thelia\Model\ConfigQuery::getStoreEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigQuery::getStoreEmail方法的具体用法?PHP ConfigQuery::getStoreEmail怎么用?PHP ConfigQuery::getStoreEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Model\ConfigQuery
的用法示例。
在下文中一共展示了ConfigQuery::getStoreEmail方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateStatus
public function updateStatus(OrderEvent $event)
{
$order = $event->getOrder();
$colissimo = new Colissimo();
if ($order->isSent() && $order->getDeliveryModuleId() == $colissimo->getModuleModel()->getId()) {
$contact_email = ConfigQuery::getStoreEmail();
if ($contact_email) {
$message = MessageQuery::create()->filterByName('mail_colissimo')->findOne();
if (false === $message) {
throw new \Exception("Failed to load message 'order_confirmation'.");
}
$order = $event->getOrder();
$customer = $order->getCustomer();
$this->parser->assign('customer_id', $customer->getId());
$this->parser->assign('order_ref', $order->getRef());
$this->parser->assign('order_date', $order->getCreatedAt());
$this->parser->assign('update_date', $order->getUpdatedAt());
$this->parser->assign('package', $order->getDeliveryRef());
$message->setLocale($order->getLang()->getLocale());
$instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::getStoreName());
// Build subject and body
$message->buildMessage($this->parser, $instance);
$this->mailer->send($instance);
Tlog::getInstance()->debug("Colissimo shipping message sent to customer " . $customer->getEmail());
} else {
$customer = $order->getCustomer();
Tlog::getInstance()->debug("Colissimo shipping message no contact email customer_id", $customer->getId());
}
}
}
示例2: createPassword
public function createPassword(AdministratorEvent $event)
{
$admin = $event->getAdministrator();
$email = $admin->getEmail();
if (!empty($email)) {
$renewToken = $this->tokenProvider->getToken();
$admin->setPasswordRenewToken($renewToken)->save();
$this->mailer->sendEmailMessage('new_admin_password', [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], [$email => $admin->getFirstname() . ' ' . $admin->getLastname()], ['token' => $renewToken, 'admin' => $admin]);
}
}
示例3: update_status
public function update_status(OrderEvent $event)
{
if ($event->getOrder()->getDeliveryModuleId() === FreeShipping::getModuleId()) {
if ($event->getOrder()->isSent()) {
$contact_email = ConfigQuery::getStoreEmail();
if ($contact_email) {
$order = $event->getOrder();
$customer = $order->getCustomer();
$this->mailer->sendEmailToCustomer(FreeShipping::MESSAGE_SEND_CONFIRMATION, $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef(), 'customer_id' => $customer->getId(), 'order_date' => $order->getCreatedAt(), 'update_date' => $order->getUpdatedAt(), 'package' => $order->getDeliveryRef()]);
}
}
}
}
示例4: updateStatus
public function updateStatus(OrderEvent $event)
{
$order = $event->getOrder();
$colissimo = new Colissimo();
if ($order->isSent() && $order->getDeliveryModuleId() == $colissimo->getModuleModel()->getId()) {
$contact_email = ConfigQuery::getStoreEmail();
if ($contact_email) {
$order = $event->getOrder();
$customer = $order->getCustomer();
$this->mailer->sendEmailToCustomer('mail_colissimo', $customer, ['customer_id' => $customer->getId(), 'order_ref' => $order->getRef(), 'order_date' => $order->getCreatedAt(), 'update_date' => $order->getUpdatedAt(), 'package' => $order->getDeliveryRef()]);
Tlog::getInstance()->debug("Colissimo shipping message sent to customer " . $customer->getEmail());
} else {
$customer = $order->getCustomer();
Tlog::getInstance()->debug("Colissimo shipping message no contact email customer_id", $customer->getId());
}
}
}
示例5: sendAction
/**
* send contact message
*/
public function sendAction()
{
$contactForm = new ContactForm($this->getRequest());
try {
$form = $this->validateForm($contactForm);
$message = \Swift_Message::newInstance($form->get('subject')->getData())->addFrom(ConfigQuery::getStoreEmail(), $form->get('name')->getData())->addReplyTo($form->get('email')->getData(), $form->get('name')->getData())->addTo(ConfigQuery::getStoreEmail(), ConfigQuery::getStoreName())->setBody($form->get('message')->getData());
$this->getMailer()->send($message);
if (null !== ($successUrl = $this->retrieveSuccessUrl($contactForm))) {
return $this->generateRedirect($successUrl);
}
return $this->generateRedirectFromRoute('contact.success');
} catch (FormValidationException $e) {
$error_message = $e->getMessage();
}
Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message));
$contactForm->setErrorMessage($error_message);
$this->getParserContext()->addForm($contactForm)->setGeneralError($error_message);
}
示例6: sendAction
/**
* send contact message
*/
public function sendAction()
{
$contactForm = $this->createForm(FrontForm::CONTACT);
try {
$form = $this->validateForm($contactForm);
$this->getMailer()->sendSimpleEmailMessage([ConfigQuery::getStoreEmail() => $form->get('name')->getData()], [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], $form->get('subject')->getData(), '', $form->get('message')->getData(), [], [], [$form->get('email')->getData() => $form->get('name')->getData()]);
if ($contactForm->hasSuccessUrl()) {
return $this->generateSuccessRedirect($contactForm);
}
return $this->generateRedirectFromRoute('contact.success');
} catch (FormValidationException $e) {
$error_message = $e->getMessage();
}
Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message));
$contactForm->setErrorMessage($error_message);
$this->getParserContext()->addForm($contactForm)->setGeneralError($error_message);
// Redirect to error URL if defined
if ($contactForm->hasErrorUrl()) {
return $this->generateErrorRedirect($contactForm);
}
}
示例7: sendEmailMessage
/**
* Send a message to the customer.
*
* @param string $messageCode
* @param array $from From addresses. An array of (email-address => name)
* @param array $to To addresses. An array of (email-address => name)
* @param array $messageParameters an array of (name => value) parameters that will be available in the message.
* @param string $locale. If null, the default store locale is used.
*/
public function sendEmailMessage($messageCode, $from, $to, $messageParameters = [], $locale = null)
{
$store_email = ConfigQuery::getStoreEmail();
if (!empty($store_email)) {
if (!empty($to)) {
$instance = $this->createEmailMessage($messageCode, $from, $to, $messageParameters, $locale);
$sentCount = $this->send($instance, $failedRecipients);
if ($sentCount == 0) {
Tlog::getInstance()->addError(Translator::getInstance()->trans("Failed to send message %code. Failed recipients: %failed_addresses", ['%code' => $messageCode, '%failed_addresses' => is_array($failedRecipients) ? implode(',', $failedRecipients) : 'none']));
}
} else {
Tlog::getInstance()->addWarning("Message {$messageCode} not sent: recipient list is empty.");
}
} else {
Tlog::getInstance()->addError("Can't send email message {$messageCode}: store email address is not defined.");
}
}
示例8: buildForm
protected function buildForm()
{
$tr = Translator::getInstance();
$this->formBuilder->add('store_name', 'text', ['data' => ConfigQuery::getStoreName(), 'constraints' => [new Constraints\NotBlank()], 'label' => $tr->trans('Store name'), 'attr' => ['placeholder' => $tr->trans('Used in your store front')]])->add('store_description', 'text', ['data' => ConfigQuery::getStoreDescription(), 'required' => false, 'label' => $tr->trans('Store description'), 'attr' => ['placeholder' => $tr->trans('Used in your store front')]])->add('store_email', 'text', ['data' => ConfigQuery::getStoreEmail(), 'constraints' => [new Constraints\NotBlank(), new Constraints\Email()], 'label' => $tr->trans('Store email address'), 'attr' => ['placeholder' => $tr->trans('Contact and sender email address')], 'label_attr' => ['help' => $tr->trans('This is the contact email address, and the sender email of all e-mails sent by your store.')]])->add('store_notification_emails', 'text', ['data' => ConfigQuery::read('store_notification_emails'), 'constraints' => [new Constraints\NotBlank(), new Constraints\Callback(['methods' => [[$this, 'checkEmailList']]])], 'label' => $tr->trans('Email addresses of notification recipients'), 'attr' => ['placeholder' => $tr->trans('A comma separated list of email addresses')], 'label_attr' => ['help' => $tr->trans('This is a comma separated list of email addresses where store notifications (such as order placed) are sent.')]])->add('store_business_id', 'text', ['data' => ConfigQuery::read('store_business_id'), 'label' => $tr->trans('Business ID'), 'required' => false, 'attr' => ['placeholder' => $tr->trans('Store Business Identification Number (SIRET, etc).')]])->add('store_phone', 'text', ['data' => ConfigQuery::read('store_phone'), 'label' => $tr->trans('Phone'), 'required' => false, 'attr' => ['placeholder' => $tr->trans('The store phone number.')]])->add('store_fax', 'text', ['data' => ConfigQuery::read('store_fax'), 'label' => $tr->trans('Fax'), 'required' => false, 'attr' => ['placeholder' => $tr->trans('The store fax number.')]])->add('store_address1', 'text', ['data' => ConfigQuery::read('store_address1'), 'constraints' => [new Constraints\NotBlank()], 'label' => $tr->trans('Street Address'), 'attr' => ['placeholder' => $tr->trans('Address.')]])->add('store_address2', 'text', ['data' => ConfigQuery::read('store_address2'), 'required' => false, 'attr' => ['placeholder' => $tr->trans('Additional address information')]])->add('store_address3', 'text', ['data' => ConfigQuery::read('store_address3'), 'required' => false, 'attr' => ['placeholder' => $tr->trans('Additional address information')]])->add('store_zipcode', 'text', ['data' => ConfigQuery::read('store_zipcode'), 'constraints' => [new Constraints\NotBlank()], 'label' => $tr->trans('Zip code'), 'attr' => ['placeholder' => $tr->trans('Zip code')]])->add('store_city', 'text', ['data' => ConfigQuery::read('store_city'), 'constraints' => [new Constraints\NotBlank()], 'label' => $tr->trans('City'), 'attr' => ['placeholder' => $tr->trans('City')]])->add('store_country', 'integer', ['data' => ConfigQuery::read('store_country'), 'constraints' => [new Constraints\NotBlank()], 'label' => $tr->trans('Country'), 'attr' => ['placeholder' => $tr->trans('Country')]]);
}
示例9: confirmSubscription
/**
* @since 2.3.0-alpha2
*/
public function confirmSubscription(NewsletterEvent $event)
{
$this->mailer->sendEmailMessage('newsletter_subscription_confirmation', [ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName()], [$event->getEmail() => $event->getFirstname() . " " . $event->getLastname()], ['email' => $event->getEmail(), 'firstname' => $event->getFirstname(), 'lastname' => $event->getLastname()], $event->getLocale());
}
示例10: sendCommentRequestCustomerMail
protected function sendCommentRequestCustomerMail($customerId, array $productIds)
{
$contact_email = ConfigQuery::getStoreEmail();
if ($contact_email) {
$message = MessageQuery::create()->filterByName('comment_request_customer')->findOne();
if (null === $message) {
throw new \Exception("Failed to load message 'comment_request_customer'.");
}
$customer = CustomerQuery::create()->findPk($customerId);
if (null === $customer) {
throw new \Exception(sprintf("Failed to load customer '%s'.", $customerId));
}
$parser = $this->parser;
$locale = $customer->getCustomerLang()->getLocale();
$parser->assign('customer_id', $customer->getId());
$parser->assign('product_ids', $productIds);
$parser->assign('lang_id', $customer->getCustomerLang()->getId());
$message->setLocale($locale);
$instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::getStoreName());
// Build subject and body
$message->buildMessage($parser, $instance);
$this->mailer->send($instance);
Tlog::getInstance()->debug("Message sent to customer " . $customer->getEmail() . " to ask for comments");
}
}