Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added send an email to the admin when an affiliate registers. #727

Merged
merged 1 commit into from
Jun 19, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions upload/catalog/controller/feed/google_sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function index() {

foreach ($products as $product) {
$output .= '<url>';
$output .= '<loc>' . $this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']) . '</loc>';
$output .= '<loc>' . $this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&amp;product_id=' . $product['product_id']) . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';
Expand Down Expand Up @@ -92,7 +92,7 @@ protected function getCategories($parent_id, $current_path = '') {

foreach ($products as $product) {
$output .= '<url>';
$output .= '<loc>' . $this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']) . '</loc>';
$output .= '<loc>' . $this->url->link('product/product', 'path=' . $new_path . '&amp;product_id=' . $product['product_id']) . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';
Expand All @@ -104,4 +104,4 @@ protected function getCategories($parent_id, $current_path = '') {
return $output;
}
}
?>
?>
2 changes: 1 addition & 1 deletion upload/catalog/controller/product/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function index() {
if (isset($this->request->get['search'])) {
$this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->request->get['search']);
} elseif (isset($this->request->get['tag'])) {
$this->document->setTitle($this->language->get('heading_title') . ' - ' . ' tag - ' . $this->request->get['tag']);
$this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->language->get('heading_tag') . $this->request->get['tag']);
} else {
$this->document->setTitle($this->language->get('heading_title'));
}
Expand Down
20 changes: 15 additions & 5 deletions upload/catalog/language/english/mail/affiliate.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<?php
// Text
$_['text_subject'] = '%s - Affiliate Program';
$_['text_welcome'] = 'Thank you for joining the %s Affiliate Program!';
$_['text_approval'] = 'Your account must be approved before you can login. Once approved you can log in by using your email address and password by visiting our website or at the following URL:';
$_['text_services'] = 'Upon logging in, you will be able to generate tracking codes, track commission payments and edit your account information.';
$_['text_thanks'] = 'Thanks,';
$_['text_subject'] = '%s - Affiliate Program';
$_['text_welcome'] = 'Thank you for joining the %s Affiliate Program!';
$_['text_approval'] = 'Your account must be approved before you can login. Once approved you can log in by using your email address and password by visiting our website or at the following URL:';
$_['text_services'] = 'Upon logging in, you will be able to generate tracking codes, track commission payments and edit your account information.';
$_['text_thanks'] = 'Thanks,';

$_['text_new_affiliate'] = 'New Affiliate';
$_['text_signup'] = 'A new affiliate has signed up:';
$_['text_store'] = 'Store:';
$_['text_firstname'] = 'Firstname:';
$_['text_lastname'] = 'Lastname:';
$_['text_company'] = 'Company:';
$_['text_email'] = 'E-Mail:';
$_['text_telephone'] = 'Telephone:';
$_['text_website'] = 'Web Site:';
?>
1 change: 1 addition & 0 deletions upload/catalog/language/english/product/search.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
// Heading
$_['heading_title'] = 'Search';
$_['heading_tag'] = 'Tag - ';

// Text
$_['text_search'] = 'Products meeting the search criteria';
Expand Down
34 changes: 34 additions & 0 deletions upload/catalog/model/affiliate/affiliate.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,40 @@ public function addAffiliate($data) {
$mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();

// Send to main admin email if new affiliate email is enabled
if ($this->config->get('config_account_mail')) {
$message = $this->language->get('text_signup') . "\n\n";
$message .= $this->language->get('text_store') . ' ' . $this->config->get('config_name') . "\n";
$message .= $this->language->get('text_firstname') . ' ' . $data['firstname'] . "\n";
$message .= $this->language->get('text_lastname') . ' ' . $data['lastname'] . "\n";

if ($data['website']) {
$message .= $this->language->get('text_website') . ' ' . $data['website'] . "\n";
}

if ($data['company']) {
$message .= $this->language->get('text_company') . ' ' . $data['company'] . "\n";
}

$message .= $this->language->get('text_email') . ' ' . $data['email'] . "\n";
$message .= $this->language->get('text_telephone') . ' ' . $data['telephone'] . "\n";

$mail->setTo($this->config->get('config_email'));
$mail->setSubject(html_entity_decode($this->language->get('text_new_affiliate'), ENT_QUOTES, 'UTF-8'));
$mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
$mail->send();

// Send to additional alert emails if new affiliate email is enabled
$emails = explode(',', $this->config->get('config_alert_emails'));

foreach ($emails as $email) {
if (strlen($email) > 0 && preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $email)) {
$mail->setTo($email);
$mail->send();
}
}
}
}

public function editAffiliate($data) {
Expand Down