@@ -9,1580 +9,1580 @@ |
||
9 | 9 | class Emailtemplate |
10 | 10 | { |
11 | 11 | |
12 | - protected $registry; |
|
12 | + protected $registry; |
|
13 | 13 | |
14 | - public function __construct($registry) |
|
15 | - { |
|
16 | - $this->registry = $registry; |
|
17 | - } |
|
14 | + public function __construct($registry) |
|
15 | + { |
|
16 | + $this->registry = $registry; |
|
17 | + } |
|
18 | 18 | |
19 | - public function __get($key) |
|
20 | - { |
|
21 | - return $this->registry->get($key); |
|
22 | - } |
|
19 | + public function __get($key) |
|
20 | + { |
|
21 | + return $this->registry->get($key); |
|
22 | + } |
|
23 | 23 | |
24 | - public function __set($key, $value) |
|
25 | - { |
|
26 | - $this->registry->set($key, $value); |
|
27 | - } |
|
24 | + public function __set($key, $value) |
|
25 | + { |
|
26 | + $this->registry->set($key, $value); |
|
27 | + } |
|
28 | 28 | |
29 | - // Mail Subject |
|
30 | - public function getSubject($type, $template_id, $data) |
|
31 | - { |
|
32 | - $template = $this->getEmailTemplate($template_id); |
|
29 | + // Mail Subject |
|
30 | + public function getSubject($type, $template_id, $data) |
|
31 | + { |
|
32 | + $template = $this->getEmailTemplate($template_id); |
|
33 | 33 | |
34 | - $findFunctionName = 'get' . ucwords($type) . 'Find'; |
|
35 | - $replaceFunctionName = 'get' . ucwords($type) . 'Replace'; |
|
34 | + $findFunctionName = 'get' . ucwords($type) . 'Find'; |
|
35 | + $replaceFunctionName = 'get' . ucwords($type) . 'Replace'; |
|
36 | 36 | |
37 | - $find = array(); |
|
37 | + $find = array(); |
|
38 | 38 | |
39 | - if (method_exists($this, $findFunctionName)) { |
|
40 | - $find = $this->$findFunctionName(); |
|
41 | - } |
|
39 | + if (method_exists($this, $findFunctionName)) { |
|
40 | + $find = $this->$findFunctionName(); |
|
41 | + } |
|
42 | 42 | |
43 | - $this->trigger->fire('post.emailtemplate.subject.shortcode', array(&$find)); |
|
43 | + $this->trigger->fire('post.emailtemplate.subject.shortcode', array(&$find)); |
|
44 | 44 | |
45 | - $replace = array(); |
|
45 | + $replace = array(); |
|
46 | 46 | |
47 | - if (method_exists($this, $replaceFunctionName)) { |
|
48 | - $replace = $this->$replaceFunctionName($data); |
|
49 | - } |
|
47 | + if (method_exists($this, $replaceFunctionName)) { |
|
48 | + $replace = $this->$replaceFunctionName($data); |
|
49 | + } |
|
50 | 50 | |
51 | - $this->trigger->fire('post.emailtemplate.subject.replace', array(&$replace, &$data)); |
|
51 | + $this->trigger->fire('post.emailtemplate.subject.replace', array(&$replace, &$data)); |
|
52 | 52 | |
53 | - if (!empty($template['name'])) { |
|
54 | - $subject = trim(str_replace($find, $replace, $template['name'])); |
|
55 | - } else { |
|
56 | - $subject = $this->getDefaultSubject($type, $template_id, $data); |
|
57 | - } |
|
53 | + if (!empty($template['name'])) { |
|
54 | + $subject = trim(str_replace($find, $replace, $template['name'])); |
|
55 | + } else { |
|
56 | + $subject = $this->getDefaultSubject($type, $template_id, $data); |
|
57 | + } |
|
58 | 58 | |
59 | - return $subject; |
|
60 | - } |
|
59 | + return $subject; |
|
60 | + } |
|
61 | 61 | |
62 | - // Mail Message |
|
63 | - public function getMessage($type, $template_id, $data) |
|
64 | - { |
|
65 | - $template = $this->getEmailTemplate($template_id); |
|
62 | + // Mail Message |
|
63 | + public function getMessage($type, $template_id, $data) |
|
64 | + { |
|
65 | + $template = $this->getEmailTemplate($template_id); |
|
66 | 66 | |
67 | - $findFunctionName = 'get' . ucwords($type) . 'Find'; |
|
68 | - $replaceFunctionName = 'get' . ucwords($type) . 'Replace'; |
|
69 | - |
|
70 | - $find = array(); |
|
71 | - |
|
72 | - if (method_exists($this, $findFunctionName)) { |
|
73 | - $find = $this->$findFunctionName(); |
|
74 | - } |
|
75 | - |
|
76 | - $this->trigger->fire('post.emailtemplate.message.shortcode', array(&$find)); |
|
77 | - |
|
78 | - $replace = array(); |
|
79 | - |
|
80 | - if (method_exists($this, $replaceFunctionName)) { |
|
81 | - $replace = $this->$replaceFunctionName($data); |
|
82 | - } |
|
83 | - |
|
84 | - $this->trigger->fire('post.emailtemplate.message.replace', array(&$replace, &$data)); |
|
85 | - |
|
86 | - if (!empty($template['description'])) { |
|
87 | - if (ucwords($type) == 'OrderAll') { |
|
88 | - preg_match('/{product:start}(.*){product:stop}/Uis', $template['description'], $template_product); |
|
89 | - if (!empty($template_product[1])) { |
|
90 | - $template['description'] = str_replace($template_product[1], '', $template['description']); |
|
91 | - } |
|
92 | - |
|
93 | - preg_match('/{voucher:start}(.*){voucher:stop}/Uis', $template['description'], $template_voucher); |
|
94 | - if (!empty($template_voucher[1])) { |
|
95 | - $template['description'] = str_replace($template_voucher[1], '', $template['description']); |
|
96 | - } |
|
97 | - |
|
98 | - preg_match('/{comment:start}(.*){comment:stop}/Uis', $template['description'], $template_comment); |
|
99 | - if (!empty($template_comment[1])) { |
|
100 | - $template['description'] = str_replace($template_comment[1], '', $template['description']); |
|
101 | - } |
|
102 | - |
|
103 | - preg_match('/{tax:start}(.*){tax:stop}/Uis', $template['description'], $template_tax); |
|
104 | - if (!empty($template_tax[1])) { |
|
105 | - $template['description'] = str_replace($template_tax[1], '', $template['description']); |
|
106 | - } |
|
107 | - |
|
108 | - preg_match('/{total:start}(.*){total:stop}/Uis', $template['description'], $template_total); |
|
109 | - if (!empty($template_total[1])) { |
|
110 | - $template['description'] = str_replace($template_total[1], '', $template['description']); |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - $message = trim(str_replace($find, $replace, $template['description'])); |
|
115 | - } else { |
|
116 | - $message = $this->getDefaultMessage($type, $template_id, $data); |
|
117 | - } |
|
118 | - |
|
119 | - $this->trigger->fire('post.emailtemplate.message.message', array(&$message)); |
|
120 | - |
|
121 | - $data['title'] = $this->getSubject($type, $template_id, $data); |
|
122 | - $data['message'] = $message; |
|
123 | - $data['site_url'] = ($this->request->server['HTTPS']) ? HTTPS_SERVER : HTTP_SERVER; |
|
124 | - |
|
125 | - if (Client::isCatalog()) { |
|
126 | - if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/default.tpl')) { |
|
127 | - $message = $this->load->view($this->config->get('config_template') . '/template/mail/default.tpl', $data); |
|
128 | - } else { |
|
129 | - $message = $this->load->view('default/template/mail/default.tpl', $data); |
|
130 | - } |
|
131 | - } else { |
|
132 | - $message = $this->load->view('mail/default.tpl', $data); |
|
133 | - } |
|
134 | - |
|
135 | - return $message; |
|
136 | - } |
|
137 | - |
|
138 | - //Mail Text |
|
139 | - public function getText($type, $template_id, $data) |
|
140 | - { |
|
141 | - $findName = 'get' . ucwords($type) . 'Text'; |
|
142 | - |
|
143 | - return $this->$findName($template_id, $data); |
|
144 | - } |
|
145 | - |
|
146 | - // Mail Template |
|
147 | - public function getEmailTemplate($email_template) |
|
148 | - { |
|
149 | - $item = explode("_", $email_template); |
|
150 | - |
|
151 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "email AS e LEFT JOIN " . DB_PREFIX . "email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}' AND ed.language_id = '{$this->config->get('config_language_id')}'"); |
|
152 | - |
|
153 | - if (!$query->num_rows) { |
|
154 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "email AS e LEFT JOIN " . DB_PREFIX . "email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}'"); |
|
155 | - } |
|
156 | - |
|
157 | - foreach ($query->rows as $result) { |
|
158 | - $email_template_data = array( |
|
159 | - 'text' => $result['text'], |
|
160 | - 'text_id' => $result['text_id'], |
|
161 | - 'type' => $result['type'], |
|
162 | - 'context' => $result['context'], |
|
163 | - 'name' => $result['name'], |
|
164 | - 'description' => $result['description'], |
|
165 | - 'status' => $result['status'] |
|
166 | - ); |
|
167 | - } |
|
168 | - |
|
169 | - return $email_template_data; |
|
170 | - } |
|
171 | - |
|
172 | - // Store Logo |
|
173 | - public function storeLogo() |
|
174 | - { |
|
175 | - $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
|
176 | - $store_name = $this->config->get('config_name'); |
|
177 | - $store_logo = HTTPS_IMAGE . $this->config->get('config_logo'); |
|
178 | - |
|
179 | - return '<a href="' . $store_url . '" title="' . $store_name . '"><img src="' . $store_logo . '"></a>'; |
|
180 | - } |
|
181 | - |
|
182 | - // Admin Login |
|
183 | - public function getLoginFind() |
|
184 | - { |
|
185 | - $result = array( '{store_logo}', '{username}', '{store_name}', '{ip_address}' ); |
|
67 | + $findFunctionName = 'get' . ucwords($type) . 'Find'; |
|
68 | + $replaceFunctionName = 'get' . ucwords($type) . 'Replace'; |
|
69 | + |
|
70 | + $find = array(); |
|
71 | + |
|
72 | + if (method_exists($this, $findFunctionName)) { |
|
73 | + $find = $this->$findFunctionName(); |
|
74 | + } |
|
75 | + |
|
76 | + $this->trigger->fire('post.emailtemplate.message.shortcode', array(&$find)); |
|
77 | + |
|
78 | + $replace = array(); |
|
79 | + |
|
80 | + if (method_exists($this, $replaceFunctionName)) { |
|
81 | + $replace = $this->$replaceFunctionName($data); |
|
82 | + } |
|
83 | + |
|
84 | + $this->trigger->fire('post.emailtemplate.message.replace', array(&$replace, &$data)); |
|
85 | + |
|
86 | + if (!empty($template['description'])) { |
|
87 | + if (ucwords($type) == 'OrderAll') { |
|
88 | + preg_match('/{product:start}(.*){product:stop}/Uis', $template['description'], $template_product); |
|
89 | + if (!empty($template_product[1])) { |
|
90 | + $template['description'] = str_replace($template_product[1], '', $template['description']); |
|
91 | + } |
|
92 | + |
|
93 | + preg_match('/{voucher:start}(.*){voucher:stop}/Uis', $template['description'], $template_voucher); |
|
94 | + if (!empty($template_voucher[1])) { |
|
95 | + $template['description'] = str_replace($template_voucher[1], '', $template['description']); |
|
96 | + } |
|
97 | + |
|
98 | + preg_match('/{comment:start}(.*){comment:stop}/Uis', $template['description'], $template_comment); |
|
99 | + if (!empty($template_comment[1])) { |
|
100 | + $template['description'] = str_replace($template_comment[1], '', $template['description']); |
|
101 | + } |
|
102 | + |
|
103 | + preg_match('/{tax:start}(.*){tax:stop}/Uis', $template['description'], $template_tax); |
|
104 | + if (!empty($template_tax[1])) { |
|
105 | + $template['description'] = str_replace($template_tax[1], '', $template['description']); |
|
106 | + } |
|
107 | + |
|
108 | + preg_match('/{total:start}(.*){total:stop}/Uis', $template['description'], $template_total); |
|
109 | + if (!empty($template_total[1])) { |
|
110 | + $template['description'] = str_replace($template_total[1], '', $template['description']); |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + $message = trim(str_replace($find, $replace, $template['description'])); |
|
115 | + } else { |
|
116 | + $message = $this->getDefaultMessage($type, $template_id, $data); |
|
117 | + } |
|
118 | + |
|
119 | + $this->trigger->fire('post.emailtemplate.message.message', array(&$message)); |
|
120 | + |
|
121 | + $data['title'] = $this->getSubject($type, $template_id, $data); |
|
122 | + $data['message'] = $message; |
|
123 | + $data['site_url'] = ($this->request->server['HTTPS']) ? HTTPS_SERVER : HTTP_SERVER; |
|
124 | + |
|
125 | + if (Client::isCatalog()) { |
|
126 | + if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/default.tpl')) { |
|
127 | + $message = $this->load->view($this->config->get('config_template') . '/template/mail/default.tpl', $data); |
|
128 | + } else { |
|
129 | + $message = $this->load->view('default/template/mail/default.tpl', $data); |
|
130 | + } |
|
131 | + } else { |
|
132 | + $message = $this->load->view('mail/default.tpl', $data); |
|
133 | + } |
|
134 | + |
|
135 | + return $message; |
|
136 | + } |
|
137 | + |
|
138 | + //Mail Text |
|
139 | + public function getText($type, $template_id, $data) |
|
140 | + { |
|
141 | + $findName = 'get' . ucwords($type) . 'Text'; |
|
142 | + |
|
143 | + return $this->$findName($template_id, $data); |
|
144 | + } |
|
145 | + |
|
146 | + // Mail Template |
|
147 | + public function getEmailTemplate($email_template) |
|
148 | + { |
|
149 | + $item = explode("_", $email_template); |
|
150 | + |
|
151 | + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "email AS e LEFT JOIN " . DB_PREFIX . "email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}' AND ed.language_id = '{$this->config->get('config_language_id')}'"); |
|
152 | + |
|
153 | + if (!$query->num_rows) { |
|
154 | + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "email AS e LEFT JOIN " . DB_PREFIX . "email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}'"); |
|
155 | + } |
|
156 | + |
|
157 | + foreach ($query->rows as $result) { |
|
158 | + $email_template_data = array( |
|
159 | + 'text' => $result['text'], |
|
160 | + 'text_id' => $result['text_id'], |
|
161 | + 'type' => $result['type'], |
|
162 | + 'context' => $result['context'], |
|
163 | + 'name' => $result['name'], |
|
164 | + 'description' => $result['description'], |
|
165 | + 'status' => $result['status'] |
|
166 | + ); |
|
167 | + } |
|
168 | + |
|
169 | + return $email_template_data; |
|
170 | + } |
|
171 | + |
|
172 | + // Store Logo |
|
173 | + public function storeLogo() |
|
174 | + { |
|
175 | + $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
|
176 | + $store_name = $this->config->get('config_name'); |
|
177 | + $store_logo = HTTPS_IMAGE . $this->config->get('config_logo'); |
|
178 | + |
|
179 | + return '<a href="' . $store_url . '" title="' . $store_name . '"><img src="' . $store_logo . '"></a>'; |
|
180 | + } |
|
181 | + |
|
182 | + // Admin Login |
|
183 | + public function getLoginFind() |
|
184 | + { |
|
185 | + $result = array( '{store_logo}', '{username}', '{store_name}', '{ip_address}' ); |
|
186 | 186 | |
187 | - return $result; |
|
188 | - } |
|
189 | - |
|
190 | - public function getLoginReplace($data) |
|
191 | - { |
|
192 | - $result = array( |
|
193 | - 'store_logo' => $this->storeLogo(), |
|
194 | - 'username' => $data['username'], |
|
195 | - 'store_name' => $data['store_name'], |
|
196 | - 'ip_address' => $data['ip_address'] |
|
197 | - ); |
|
198 | - |
|
199 | - return $result; |
|
200 | - } |
|
187 | + return $result; |
|
188 | + } |
|
189 | + |
|
190 | + public function getLoginReplace($data) |
|
191 | + { |
|
192 | + $result = array( |
|
193 | + 'store_logo' => $this->storeLogo(), |
|
194 | + 'username' => $data['username'], |
|
195 | + 'store_name' => $data['store_name'], |
|
196 | + 'ip_address' => $data['ip_address'] |
|
197 | + ); |
|
198 | + |
|
199 | + return $result; |
|
200 | + } |
|
201 | 201 | |
202 | - // Affilate |
|
203 | - public function getAffiliateFind() |
|
204 | - { |
|
205 | - $result = array( '{store_logo}', '{firstname}', '{lastname}', '{date}', '{store_name}', '{description}', '{order_id}', '{amount}', '{total}', '{email}','{password}', '{affiliate_code}', '{account_href}' ); |
|
202 | + // Affilate |
|
203 | + public function getAffiliateFind() |
|
204 | + { |
|
205 | + $result = array( '{store_logo}', '{firstname}', '{lastname}', '{date}', '{store_name}', '{description}', '{order_id}', '{amount}', '{total}', '{email}','{password}', '{affiliate_code}', '{account_href}' ); |
|
206 | 206 | |
207 | - return $result; |
|
208 | - } |
|
207 | + return $result; |
|
208 | + } |
|
209 | 209 | |
210 | - public function getAffiliateReplace($data) |
|
211 | - { |
|
212 | - $result = array( |
|
213 | - 'store_logo' => $this->storeLogo(), |
|
214 | - 'firstname' => (!empty($data['firstname'])) ? $data['firstname'] : '', |
|
215 | - 'lastname' => (!empty($data['lastname'])) ? $data['lastname'] : '', |
|
216 | - 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
217 | - 'store_name' => $this->config->get('config_name'), |
|
218 | - 'description' => (!empty($data['description'])) ? nl2br($data['description']) : '', |
|
219 | - 'order_id' => (!empty($data['order_id'])) ? $data['order_id'] : '', |
|
220 | - 'amount' => (!empty($data['amount'])) ? $data['amount'] : '', |
|
221 | - 'total' => (!empty($data['total'])) ? $data['total'] : '', |
|
222 | - 'email' => (!empty($data['email'])) ? $data['email'] : '', |
|
223 | - 'password' => (!empty($data['password'])) ? $data['password'] : '', |
|
224 | - 'affiliate_code' => (!empty($data['code'])) ? $data['code'] : '', |
|
225 | - 'account_href' => $this->url->link('affiliate/login', '', 'SSL') |
|
226 | - ); |
|
227 | - |
|
228 | - return $result; |
|
229 | - } |
|
210 | + public function getAffiliateReplace($data) |
|
211 | + { |
|
212 | + $result = array( |
|
213 | + 'store_logo' => $this->storeLogo(), |
|
214 | + 'firstname' => (!empty($data['firstname'])) ? $data['firstname'] : '', |
|
215 | + 'lastname' => (!empty($data['lastname'])) ? $data['lastname'] : '', |
|
216 | + 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
217 | + 'store_name' => $this->config->get('config_name'), |
|
218 | + 'description' => (!empty($data['description'])) ? nl2br($data['description']) : '', |
|
219 | + 'order_id' => (!empty($data['order_id'])) ? $data['order_id'] : '', |
|
220 | + 'amount' => (!empty($data['amount'])) ? $data['amount'] : '', |
|
221 | + 'total' => (!empty($data['total'])) ? $data['total'] : '', |
|
222 | + 'email' => (!empty($data['email'])) ? $data['email'] : '', |
|
223 | + 'password' => (!empty($data['password'])) ? $data['password'] : '', |
|
224 | + 'affiliate_code' => (!empty($data['code'])) ? $data['code'] : '', |
|
225 | + 'account_href' => $this->url->link('affiliate/login', '', 'SSL') |
|
226 | + ); |
|
227 | + |
|
228 | + return $result; |
|
229 | + } |
|
230 | 230 | |
231 | - // Customer |
|
232 | - public function getCustomerFind() |
|
233 | - { |
|
234 | - $result = array( '{store_logo}', '{firstname}', '{lastname}', '{credit}', '{received_credit}', '{total_credit}', '{date}', '{store_name}', '{email}', '{password}', '{account_href}', '{activate_href}' ); |
|
235 | - |
|
236 | - return $result; |
|
237 | - } |
|
238 | - |
|
239 | - public function getCustomerReplace($data) |
|
240 | - { |
|
241 | - $result = array( |
|
242 | - 'store_logo' => $this->storeLogo(), |
|
243 | - 'firstname' => $data['firstname'], |
|
244 | - 'lastname' => $data['lastname'], |
|
245 | - 'credit' => isset($data['credit']) ? $data['credit'] : '0', |
|
246 | - 'received_credit'=> isset($data['received_credit']) ? $data['received_credit'] : '0', |
|
247 | - 'total_credit' => isset($data['total_credit']) ? $data['total_credit'] : '0', |
|
248 | - 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
249 | - 'store_name' => $this->config->get('config_name'), |
|
250 | - 'email' => $data['email'], |
|
251 | - 'password' => $data['password'], |
|
252 | - 'account_href' => $this->url->link('account/login', '', 'SSL'), |
|
253 | - 'activate_href' => (!empty($data['confirm_code'])) ? $this->url->link('account/activate', 'passkey=' . $data['confirm_code'], 'SSL') : '' |
|
254 | - ); |
|
255 | - |
|
256 | - return $result; |
|
257 | - } |
|
231 | + // Customer |
|
232 | + public function getCustomerFind() |
|
233 | + { |
|
234 | + $result = array( '{store_logo}', '{firstname}', '{lastname}', '{credit}', '{received_credit}', '{total_credit}', '{date}', '{store_name}', '{email}', '{password}', '{account_href}', '{activate_href}' ); |
|
235 | + |
|
236 | + return $result; |
|
237 | + } |
|
238 | + |
|
239 | + public function getCustomerReplace($data) |
|
240 | + { |
|
241 | + $result = array( |
|
242 | + 'store_logo' => $this->storeLogo(), |
|
243 | + 'firstname' => $data['firstname'], |
|
244 | + 'lastname' => $data['lastname'], |
|
245 | + 'credit' => isset($data['credit']) ? $data['credit'] : '0', |
|
246 | + 'received_credit'=> isset($data['received_credit']) ? $data['received_credit'] : '0', |
|
247 | + 'total_credit' => isset($data['total_credit']) ? $data['total_credit'] : '0', |
|
248 | + 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
249 | + 'store_name' => $this->config->get('config_name'), |
|
250 | + 'email' => $data['email'], |
|
251 | + 'password' => $data['password'], |
|
252 | + 'account_href' => $this->url->link('account/login', '', 'SSL'), |
|
253 | + 'activate_href' => (!empty($data['confirm_code'])) ? $this->url->link('account/activate', 'passkey=' . $data['confirm_code'], 'SSL') : '' |
|
254 | + ); |
|
255 | + |
|
256 | + return $result; |
|
257 | + } |
|
258 | 258 | |
259 | - // Contact ( Information ) |
|
260 | - public function getContactFind() |
|
261 | - { |
|
262 | - $result = array( '{store_logo}', '{name}', '{email}', '{store_name}', '{enquiry}' ); |
|
259 | + // Contact ( Information ) |
|
260 | + public function getContactFind() |
|
261 | + { |
|
262 | + $result = array( '{store_logo}', '{name}', '{email}', '{store_name}', '{enquiry}' ); |
|
263 | 263 | |
264 | - return $result; |
|
265 | - } |
|
266 | - |
|
267 | - public function getContactReplace($data) |
|
268 | - { |
|
269 | - $result = array( |
|
270 | - 'store_logo' => $this->storeLogo(), |
|
271 | - 'name' => (!empty($data['name'])) ? $data['name'] : '', |
|
272 | - 'email' => (!empty($data['email'])) ? $data['email'] : '', |
|
273 | - 'store_name' => $this->config->get('config_name'), |
|
274 | - 'enquiry' => (!empty($data['enquiry'])) ? $data['enquiry'] : '' |
|
275 | - ); |
|
276 | - |
|
277 | - return $result; |
|
278 | - } |
|
279 | - |
|
280 | - // Order |
|
281 | - public function getOrderAllFind() |
|
282 | - { |
|
283 | - $result = array ( |
|
284 | - '{store_logo}', '{firstname}', '{lastname}', '{delivery_address}', '{shipping_address}', '{payment_address}', '{order_date}', '{product:start}', '{product:stop}', |
|
285 | - '{total:start}', '{total:stop}', '{voucher:start}', '{voucher:stop}', '{special}', '{date}', '{payment}', '{shipment}', '{order_id}', '{total}', '{invoice_number}', |
|
286 | - '{order_href}', '{store_url}', '{status_name}', '{store_name}', '{ip}', '{comment:start}', '{comment:stop}', '{comment}', '{sub_total}', '{shipping_cost}', |
|
287 | - '{client_comment}', '{tax:start}', '{tax:stop}', '{tax_amount}', '{email}', '{telephone}' |
|
288 | - ); |
|
289 | - |
|
290 | - return $result; |
|
291 | - } |
|
292 | - |
|
293 | - public function getOrderAllReplace($data) |
|
294 | - { |
|
295 | - $emailTemplate = $this->getEmailTemplate($data['template_id']); |
|
296 | - |
|
297 | - foreach ($data as $dataKey => $dataValue) { |
|
298 | - $$dataKey = $dataValue; |
|
299 | - } |
|
300 | - |
|
301 | - // Special |
|
302 | - /* $special = array(); |
|
264 | + return $result; |
|
265 | + } |
|
266 | + |
|
267 | + public function getContactReplace($data) |
|
268 | + { |
|
269 | + $result = array( |
|
270 | + 'store_logo' => $this->storeLogo(), |
|
271 | + 'name' => (!empty($data['name'])) ? $data['name'] : '', |
|
272 | + 'email' => (!empty($data['email'])) ? $data['email'] : '', |
|
273 | + 'store_name' => $this->config->get('config_name'), |
|
274 | + 'enquiry' => (!empty($data['enquiry'])) ? $data['enquiry'] : '' |
|
275 | + ); |
|
276 | + |
|
277 | + return $result; |
|
278 | + } |
|
279 | + |
|
280 | + // Order |
|
281 | + public function getOrderAllFind() |
|
282 | + { |
|
283 | + $result = array ( |
|
284 | + '{store_logo}', '{firstname}', '{lastname}', '{delivery_address}', '{shipping_address}', '{payment_address}', '{order_date}', '{product:start}', '{product:stop}', |
|
285 | + '{total:start}', '{total:stop}', '{voucher:start}', '{voucher:stop}', '{special}', '{date}', '{payment}', '{shipment}', '{order_id}', '{total}', '{invoice_number}', |
|
286 | + '{order_href}', '{store_url}', '{status_name}', '{store_name}', '{ip}', '{comment:start}', '{comment:stop}', '{comment}', '{sub_total}', '{shipping_cost}', |
|
287 | + '{client_comment}', '{tax:start}', '{tax:stop}', '{tax_amount}', '{email}', '{telephone}' |
|
288 | + ); |
|
289 | + |
|
290 | + return $result; |
|
291 | + } |
|
292 | + |
|
293 | + public function getOrderAllReplace($data) |
|
294 | + { |
|
295 | + $emailTemplate = $this->getEmailTemplate($data['template_id']); |
|
296 | + |
|
297 | + foreach ($data as $dataKey => $dataValue) { |
|
298 | + $$dataKey = $dataValue; |
|
299 | + } |
|
300 | + |
|
301 | + // Special |
|
302 | + /* $special = array(); |
|
303 | 303 | |
304 | 304 | if (sizeof($email_template['special']) <> 0) { |
305 | 305 | // $special = $this->_prepareProductSpecial((int)$order_info['customer_group_id'], $email_template['special']); |
306 | 306 | } |
307 | 307 | */ |
308 | 308 | |
309 | - // Products |
|
310 | - preg_match('/{product:start}(.*){product:stop}/Uis', $emailTemplate['description'], $template_product); |
|
311 | - |
|
312 | - |
|
313 | - if (sizeof($template_product) > 0) { |
|
314 | - $getProducts = $this->getOrderProducts($order_info['order_id']); |
|
315 | - |
|
316 | - $products = $this->getProductsTemplate($order_info, $getProducts, $template_product); |
|
317 | - $emailTemplate['description'] = str_replace($template_product[1], '', $emailTemplate['description']); |
|
318 | - } else { |
|
319 | - $products = array(); |
|
320 | - } |
|
321 | - |
|
322 | - // Vouchers |
|
323 | - preg_match('/{voucher:start}(.*){voucher:stop}/Uis', $emailTemplate['description'], $template_voucher); |
|
324 | - |
|
325 | - if (sizeof($template_voucher) > 0) { |
|
326 | - $getVouchers = $this->getOrderVouchers($order_info['order_id']); |
|
327 | - |
|
328 | - $vouchers = $this->getVoucherTemplate($order_info, $getVouchers, $template_voucher); |
|
329 | - $emailTemplate['description'] = str_replace($template_voucher[1], '', $emailTemplate['description']); |
|
330 | - } else { |
|
331 | - $vouchers = array(); |
|
332 | - } |
|
333 | - |
|
334 | - // Comment |
|
335 | - preg_match('/{comment:start}(.*){comment:stop}/Uis', $emailTemplate['description'], $template_comment); |
|
336 | - |
|
337 | - if (sizeof($template_comment) > 0) { |
|
338 | - if (empty($comment)) { |
|
339 | - $comment[0] = ''; |
|
340 | - } else { |
|
341 | - $comment = $this->getCommentTemplate($comment, $template_comment); |
|
342 | - } |
|
343 | - $emailTemplate['description'] = str_replace($template_comment[1], '', $emailTemplate['description']); |
|
344 | - } else { |
|
345 | - $comment[0] = ''; |
|
346 | - } |
|
347 | - |
|
348 | - // Tax |
|
349 | - preg_match('/{tax:start}(.*){tax:stop}/Uis', $emailTemplate['description'], $template_tax); |
|
350 | - |
|
351 | - if (sizeof($template_tax) > 0) { |
|
352 | - $taxes = $this->getTaxTemplate($totals, $template_tax); |
|
353 | - $emailTemplate['description'] = str_replace($template_tax[1], '', $emailTemplate['description']); |
|
354 | - } else { |
|
355 | - $taxes = array(); |
|
356 | - } |
|
357 | - |
|
358 | - // Total |
|
359 | - preg_match('/{total:start}(.*){total:stop}/Uis', $emailTemplate['description'], $template_total); |
|
360 | - |
|
361 | - $order_total = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
362 | - $getTotal = $order_total->rows; |
|
363 | - |
|
364 | - if (sizeof($template_total) > 0) { |
|
365 | - $tempTotals = $this->getTotalTemplate($getTotal, $template_total, $order_info); |
|
366 | - $emailTemplate['description'] = str_replace($template_total[1], '', $emailTemplate['description']); |
|
367 | - } else { |
|
368 | - $tempTotals = array(); |
|
369 | - } |
|
370 | - |
|
371 | - $result = array( |
|
372 | - 'store_logo' => $this->storeLogo(), |
|
373 | - 'firstname' => $order_info['firstname'], |
|
374 | - 'lastname' => $order_info['lastname'], |
|
375 | - 'delivery_address'=> $address, |
|
376 | - 'shipping_address'=> $address, |
|
377 | - 'payment_address' => $payment_address, |
|
378 | - 'order_date' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])), |
|
379 | - 'product:start' => implode("", $products), |
|
380 | - 'product:stop' => '', |
|
381 | - 'total:start' => implode("", $tempTotals), |
|
382 | - 'total:stop' => '', |
|
383 | - 'voucher:start' => implode("", $vouchers), |
|
384 | - 'voucher:stop' => '', |
|
385 | - 'special' => (sizeof($special) <> 0) ? implode("<br />", $special) : '', |
|
386 | - 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
387 | - 'payment' => $order_info['payment_method'], |
|
388 | - 'shipment' => $order_info['shipping_method'], |
|
389 | - 'order_id' => $order_info['order_id'], |
|
390 | - 'total' => $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value']), |
|
391 | - 'invoice_number' => $order_info['invoice_prefix'] . $invoice_no, |
|
392 | - 'order_href' => '<a href="' . $order_href . '" target="_blank">' . $order_href . '</a>', |
|
393 | - 'store_url' => $order_info['store_url'], |
|
394 | - 'status_name' => $order_status, |
|
395 | - 'store_name' => $order_info['store_name'], |
|
396 | - 'ip' => $order_info['ip'], |
|
397 | - 'comment:start' => implode("", $comment), |
|
398 | - 'comment:stop' => '', |
|
399 | - 'comment' => implode("", $comment), |
|
400 | - 'sub_total' => $totals['sub_total'][0]['text'], |
|
401 | - 'shipping_cost' => (isset($totals['shipping'][0]['text'])) ? $totals['shipping'][0]['text'] : '', |
|
402 | - 'client_comment' => $order_info['comment'], |
|
403 | - 'tax:start' => implode("", $taxes), |
|
404 | - 'tax:stop' => '', |
|
405 | - 'tax_amount' => $this->currency->format($tax_amount, $order_info['currency_code'], $order_info['currency_value']), |
|
406 | - 'email' => $order_info['email'], |
|
407 | - 'telephone' => $order_info['telephone'] |
|
408 | - ); |
|
409 | - |
|
410 | - return $result; |
|
411 | - } |
|
412 | - |
|
413 | - // Invoice |
|
414 | - public function getInvoiceFind() |
|
415 | - { |
|
416 | - $result = array( |
|
417 | - '{store_logo}','{invoice_id}', '{invoice_date}', '{invoice_no}', '{invoice_prefix}', '{order_id}', |
|
418 | - '{store_name}', '{customer}', '{email}', '{telephone}', '{fax}', '{comment}', '{ip}', |
|
419 | - '{date_added}', '{date_modified}' |
|
420 | - ); |
|
421 | - |
|
422 | - return $result; |
|
423 | - } |
|
424 | - |
|
425 | - public function getInvoiceReplace($data) |
|
426 | - { |
|
427 | - $result = array( |
|
428 | - 'store_logo' => $this->storeLogo(), |
|
429 | - 'invoice_id' => $data['invoice_id'], |
|
430 | - 'invoice_date' => $data['invoice_date'], |
|
431 | - 'invoice_no' => $data['invoice_no'], |
|
432 | - 'invoice_prefix' => $data['invoice_prefix'], |
|
433 | - 'order_id' => $data['order_id'], |
|
434 | - 'store_name' => $data['store_name'], |
|
435 | - 'customer' => $data['customer'], |
|
436 | - 'email' => $data['email'], |
|
437 | - 'telephone' => $data['telephone'], |
|
438 | - 'fax' => $data['fax'], |
|
439 | - 'comment' => $data['comment'], |
|
440 | - 'ip' => $data['ip'], |
|
441 | - 'date_added' => $data['date_added'], |
|
442 | - 'date_modified' => $data['date_modified'] |
|
443 | - ); |
|
444 | - |
|
445 | - return $result; |
|
446 | - } |
|
447 | - |
|
448 | - //Return |
|
449 | - public function getReturnFind() |
|
450 | - { |
|
451 | - $result = array( '{store_logo}', '{store_name}', '{order_id}', '{date_ordered}', '{firstname}', '{lastname}', '{email}', '{telephone}', '{product}', '{model}', '{quantity}', '{return_reason}', '{opened}', '{comment}' ); |
|
309 | + // Products |
|
310 | + preg_match('/{product:start}(.*){product:stop}/Uis', $emailTemplate['description'], $template_product); |
|
311 | + |
|
312 | + |
|
313 | + if (sizeof($template_product) > 0) { |
|
314 | + $getProducts = $this->getOrderProducts($order_info['order_id']); |
|
315 | + |
|
316 | + $products = $this->getProductsTemplate($order_info, $getProducts, $template_product); |
|
317 | + $emailTemplate['description'] = str_replace($template_product[1], '', $emailTemplate['description']); |
|
318 | + } else { |
|
319 | + $products = array(); |
|
320 | + } |
|
321 | + |
|
322 | + // Vouchers |
|
323 | + preg_match('/{voucher:start}(.*){voucher:stop}/Uis', $emailTemplate['description'], $template_voucher); |
|
324 | + |
|
325 | + if (sizeof($template_voucher) > 0) { |
|
326 | + $getVouchers = $this->getOrderVouchers($order_info['order_id']); |
|
327 | + |
|
328 | + $vouchers = $this->getVoucherTemplate($order_info, $getVouchers, $template_voucher); |
|
329 | + $emailTemplate['description'] = str_replace($template_voucher[1], '', $emailTemplate['description']); |
|
330 | + } else { |
|
331 | + $vouchers = array(); |
|
332 | + } |
|
333 | + |
|
334 | + // Comment |
|
335 | + preg_match('/{comment:start}(.*){comment:stop}/Uis', $emailTemplate['description'], $template_comment); |
|
336 | + |
|
337 | + if (sizeof($template_comment) > 0) { |
|
338 | + if (empty($comment)) { |
|
339 | + $comment[0] = ''; |
|
340 | + } else { |
|
341 | + $comment = $this->getCommentTemplate($comment, $template_comment); |
|
342 | + } |
|
343 | + $emailTemplate['description'] = str_replace($template_comment[1], '', $emailTemplate['description']); |
|
344 | + } else { |
|
345 | + $comment[0] = ''; |
|
346 | + } |
|
347 | + |
|
348 | + // Tax |
|
349 | + preg_match('/{tax:start}(.*){tax:stop}/Uis', $emailTemplate['description'], $template_tax); |
|
350 | + |
|
351 | + if (sizeof($template_tax) > 0) { |
|
352 | + $taxes = $this->getTaxTemplate($totals, $template_tax); |
|
353 | + $emailTemplate['description'] = str_replace($template_tax[1], '', $emailTemplate['description']); |
|
354 | + } else { |
|
355 | + $taxes = array(); |
|
356 | + } |
|
357 | + |
|
358 | + // Total |
|
359 | + preg_match('/{total:start}(.*){total:stop}/Uis', $emailTemplate['description'], $template_total); |
|
360 | + |
|
361 | + $order_total = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
362 | + $getTotal = $order_total->rows; |
|
363 | + |
|
364 | + if (sizeof($template_total) > 0) { |
|
365 | + $tempTotals = $this->getTotalTemplate($getTotal, $template_total, $order_info); |
|
366 | + $emailTemplate['description'] = str_replace($template_total[1], '', $emailTemplate['description']); |
|
367 | + } else { |
|
368 | + $tempTotals = array(); |
|
369 | + } |
|
370 | + |
|
371 | + $result = array( |
|
372 | + 'store_logo' => $this->storeLogo(), |
|
373 | + 'firstname' => $order_info['firstname'], |
|
374 | + 'lastname' => $order_info['lastname'], |
|
375 | + 'delivery_address'=> $address, |
|
376 | + 'shipping_address'=> $address, |
|
377 | + 'payment_address' => $payment_address, |
|
378 | + 'order_date' => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])), |
|
379 | + 'product:start' => implode("", $products), |
|
380 | + 'product:stop' => '', |
|
381 | + 'total:start' => implode("", $tempTotals), |
|
382 | + 'total:stop' => '', |
|
383 | + 'voucher:start' => implode("", $vouchers), |
|
384 | + 'voucher:stop' => '', |
|
385 | + 'special' => (sizeof($special) <> 0) ? implode("<br />", $special) : '', |
|
386 | + 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
387 | + 'payment' => $order_info['payment_method'], |
|
388 | + 'shipment' => $order_info['shipping_method'], |
|
389 | + 'order_id' => $order_info['order_id'], |
|
390 | + 'total' => $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value']), |
|
391 | + 'invoice_number' => $order_info['invoice_prefix'] . $invoice_no, |
|
392 | + 'order_href' => '<a href="' . $order_href . '" target="_blank">' . $order_href . '</a>', |
|
393 | + 'store_url' => $order_info['store_url'], |
|
394 | + 'status_name' => $order_status, |
|
395 | + 'store_name' => $order_info['store_name'], |
|
396 | + 'ip' => $order_info['ip'], |
|
397 | + 'comment:start' => implode("", $comment), |
|
398 | + 'comment:stop' => '', |
|
399 | + 'comment' => implode("", $comment), |
|
400 | + 'sub_total' => $totals['sub_total'][0]['text'], |
|
401 | + 'shipping_cost' => (isset($totals['shipping'][0]['text'])) ? $totals['shipping'][0]['text'] : '', |
|
402 | + 'client_comment' => $order_info['comment'], |
|
403 | + 'tax:start' => implode("", $taxes), |
|
404 | + 'tax:stop' => '', |
|
405 | + 'tax_amount' => $this->currency->format($tax_amount, $order_info['currency_code'], $order_info['currency_value']), |
|
406 | + 'email' => $order_info['email'], |
|
407 | + 'telephone' => $order_info['telephone'] |
|
408 | + ); |
|
409 | + |
|
410 | + return $result; |
|
411 | + } |
|
412 | + |
|
413 | + // Invoice |
|
414 | + public function getInvoiceFind() |
|
415 | + { |
|
416 | + $result = array( |
|
417 | + '{store_logo}','{invoice_id}', '{invoice_date}', '{invoice_no}', '{invoice_prefix}', '{order_id}', |
|
418 | + '{store_name}', '{customer}', '{email}', '{telephone}', '{fax}', '{comment}', '{ip}', |
|
419 | + '{date_added}', '{date_modified}' |
|
420 | + ); |
|
421 | + |
|
422 | + return $result; |
|
423 | + } |
|
424 | + |
|
425 | + public function getInvoiceReplace($data) |
|
426 | + { |
|
427 | + $result = array( |
|
428 | + 'store_logo' => $this->storeLogo(), |
|
429 | + 'invoice_id' => $data['invoice_id'], |
|
430 | + 'invoice_date' => $data['invoice_date'], |
|
431 | + 'invoice_no' => $data['invoice_no'], |
|
432 | + 'invoice_prefix' => $data['invoice_prefix'], |
|
433 | + 'order_id' => $data['order_id'], |
|
434 | + 'store_name' => $data['store_name'], |
|
435 | + 'customer' => $data['customer'], |
|
436 | + 'email' => $data['email'], |
|
437 | + 'telephone' => $data['telephone'], |
|
438 | + 'fax' => $data['fax'], |
|
439 | + 'comment' => $data['comment'], |
|
440 | + 'ip' => $data['ip'], |
|
441 | + 'date_added' => $data['date_added'], |
|
442 | + 'date_modified' => $data['date_modified'] |
|
443 | + ); |
|
444 | + |
|
445 | + return $result; |
|
446 | + } |
|
447 | + |
|
448 | + //Return |
|
449 | + public function getReturnFind() |
|
450 | + { |
|
451 | + $result = array( '{store_logo}', '{store_name}', '{order_id}', '{date_ordered}', '{firstname}', '{lastname}', '{email}', '{telephone}', '{product}', '{model}', '{quantity}', '{return_reason}', '{opened}', '{comment}' ); |
|
452 | 452 | |
453 | - return $result; |
|
454 | - } |
|
453 | + return $result; |
|
454 | + } |
|
455 | 455 | |
456 | - public function getReturnReplace($data) |
|
457 | - { |
|
458 | - $result = array( |
|
459 | - 'store_logo' => $this->storeLogo(), |
|
460 | - 'store_name' => $this->config->get('config_name'), |
|
461 | - 'order_id' => $data['order_id'], |
|
462 | - 'date_ordered' => $data['date_ordered'], |
|
463 | - 'firstname' => $data['firstname'], |
|
464 | - 'lastname' => $data['lastname'], |
|
465 | - 'email' => $data['email'], |
|
466 | - 'telephone' => $data['telephone'], |
|
467 | - 'product' => $data['product'], |
|
468 | - 'model' => $data['model'], |
|
469 | - 'quantity' => $data['quantity'], |
|
470 | - 'return_reason' => $data['return_reason'], |
|
471 | - 'opened' => $data['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no'), |
|
472 | - 'comment' => nl2br($data['comment']) |
|
473 | - ); |
|
456 | + public function getReturnReplace($data) |
|
457 | + { |
|
458 | + $result = array( |
|
459 | + 'store_logo' => $this->storeLogo(), |
|
460 | + 'store_name' => $this->config->get('config_name'), |
|
461 | + 'order_id' => $data['order_id'], |
|
462 | + 'date_ordered' => $data['date_ordered'], |
|
463 | + 'firstname' => $data['firstname'], |
|
464 | + 'lastname' => $data['lastname'], |
|
465 | + 'email' => $data['email'], |
|
466 | + 'telephone' => $data['telephone'], |
|
467 | + 'product' => $data['product'], |
|
468 | + 'model' => $data['model'], |
|
469 | + 'quantity' => $data['quantity'], |
|
470 | + 'return_reason' => $data['return_reason'], |
|
471 | + 'opened' => $data['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no'), |
|
472 | + 'comment' => nl2br($data['comment']) |
|
473 | + ); |
|
474 | 474 | |
475 | - return $result; |
|
476 | - } |
|
475 | + return $result; |
|
476 | + } |
|
477 | 477 | |
478 | - // Review |
|
479 | - public function getReviewFind() |
|
480 | - { |
|
481 | - $result = array( '{store_logo}', '{author}', '{review}', '{date}', '{rating}', '{product}' ); |
|
478 | + // Review |
|
479 | + public function getReviewFind() |
|
480 | + { |
|
481 | + $result = array( '{store_logo}', '{author}', '{review}', '{date}', '{rating}', '{product}' ); |
|
482 | 482 | |
483 | - return $result; |
|
484 | - } |
|
485 | - |
|
486 | - public function getReviewReplace($data) |
|
487 | - { |
|
488 | - $result = array( |
|
489 | - 'store_logo' => $this->storeLogo(), |
|
490 | - 'author' => $data['name'], |
|
491 | - 'review' => $data['text'], |
|
492 | - 'date' => date($this->language->get('date_format_short'), time()), |
|
493 | - 'rating' => $data['rating'], |
|
494 | - 'product' => $data['product'] |
|
495 | - ); |
|
496 | - |
|
497 | - return $result; |
|
498 | - } |
|
483 | + return $result; |
|
484 | + } |
|
485 | + |
|
486 | + public function getReviewReplace($data) |
|
487 | + { |
|
488 | + $result = array( |
|
489 | + 'store_logo' => $this->storeLogo(), |
|
490 | + 'author' => $data['name'], |
|
491 | + 'review' => $data['text'], |
|
492 | + 'date' => date($this->language->get('date_format_short'), time()), |
|
493 | + 'rating' => $data['rating'], |
|
494 | + 'product' => $data['product'] |
|
495 | + ); |
|
496 | + |
|
497 | + return $result; |
|
498 | + } |
|
499 | 499 | |
500 | - // Stock |
|
501 | - public function getStockFind() |
|
502 | - { |
|
503 | - $result = array( '{store_logo}', '{store_name}', '{total_products}' ); |
|
500 | + // Stock |
|
501 | + public function getStockFind() |
|
502 | + { |
|
503 | + $result = array( '{store_logo}', '{store_name}', '{total_products}' ); |
|
504 | 504 | |
505 | - return $result; |
|
506 | - } |
|
505 | + return $result; |
|
506 | + } |
|
507 | 507 | |
508 | - public function getStockReplace($data) |
|
509 | - { |
|
510 | - $result = array( |
|
511 | - 'store_logo' => $this->storeLogo(), |
|
512 | - 'store_name' => $this->config->get('config_name'), |
|
513 | - 'total_products' => $data['outofstock'] |
|
514 | - ); |
|
508 | + public function getStockReplace($data) |
|
509 | + { |
|
510 | + $result = array( |
|
511 | + 'store_logo' => $this->storeLogo(), |
|
512 | + 'store_name' => $this->config->get('config_name'), |
|
513 | + 'total_products' => $data['outofstock'] |
|
514 | + ); |
|
515 | 515 | |
516 | - return $result; |
|
517 | - } |
|
516 | + return $result; |
|
517 | + } |
|
518 | 518 | |
519 | - // Voucher |
|
520 | - public function getVoucherFind() |
|
521 | - { |
|
522 | - $result = array( '{store_logo}', '{recip_name}', '{recip_email}', '{date}', '{store_name}', '{name}', '{amount}', '{message}', '{store_href}', '{store_url}', '{image}', '{code}' ); |
|
519 | + // Voucher |
|
520 | + public function getVoucherFind() |
|
521 | + { |
|
522 | + $result = array( '{store_logo}', '{recip_name}', '{recip_email}', '{date}', '{store_name}', '{name}', '{amount}', '{message}', '{store_href}', '{store_url}', '{image}', '{code}' ); |
|
523 | 523 | |
524 | - return $result; |
|
525 | - } |
|
526 | - |
|
527 | - public function getVoucherReplace($data) |
|
528 | - { |
|
529 | - $result = array( |
|
530 | - 'store_logo' => $this->storeLogo(), |
|
531 | - 'recip_name' => $data['recip_name'], |
|
532 | - 'recip_email' => $data['recip_email'], |
|
533 | - 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
534 | - 'store_name' => $data['store_name'], |
|
535 | - 'name' => $data['name'], |
|
536 | - 'amount' => $data['amount'], |
|
537 | - 'message' => $data['message'], |
|
538 | - 'store_href' => $data['store_href'], |
|
539 | - 'store_url' => '<a href="' . $data['store_href'] . '" title="' . $data['store_href'] . '">' . $data['store_href'] . '</a>', |
|
540 | - 'image' => (file_exists(DIR_IMAGE . $data['image'])) ? 'cid:' . md5(basename($data['image'])) : '', 'code' => $data['code'] |
|
541 | - ); |
|
524 | + return $result; |
|
525 | + } |
|
526 | + |
|
527 | + public function getVoucherReplace($data) |
|
528 | + { |
|
529 | + $result = array( |
|
530 | + 'store_logo' => $this->storeLogo(), |
|
531 | + 'recip_name' => $data['recip_name'], |
|
532 | + 'recip_email' => $data['recip_email'], |
|
533 | + 'date' => date($this->language->get('date_format_short'), strtotime(date("Y-m-d H:i:s"))), |
|
534 | + 'store_name' => $data['store_name'], |
|
535 | + 'name' => $data['name'], |
|
536 | + 'amount' => $data['amount'], |
|
537 | + 'message' => $data['message'], |
|
538 | + 'store_href' => $data['store_href'], |
|
539 | + 'store_url' => '<a href="' . $data['store_href'] . '" title="' . $data['store_href'] . '">' . $data['store_href'] . '</a>', |
|
540 | + 'image' => (file_exists(DIR_IMAGE . $data['image'])) ? 'cid:' . md5(basename($data['image'])) : '', 'code' => $data['code'] |
|
541 | + ); |
|
542 | 542 | |
543 | - return $result; |
|
544 | - } |
|
545 | - |
|
546 | - // Order Text |
|
547 | - public function getOrderText($template_id, $data) |
|
548 | - { |
|
549 | - foreach ($data as $dataKey => $dataValue) { |
|
550 | - $$dataKey = $dataValue; |
|
551 | - } |
|
543 | + return $result; |
|
544 | + } |
|
552 | 545 | |
553 | - // Load the language for any mails that might be required to be sent out |
|
554 | - $language = new Language($order_info['language_directory'], $this->registry); |
|
555 | - $language->load('mail/order'); |
|
546 | + // Order Text |
|
547 | + public function getOrderText($template_id, $data) |
|
548 | + { |
|
549 | + foreach ($data as $dataKey => $dataValue) { |
|
550 | + $$dataKey = $dataValue; |
|
551 | + } |
|
556 | 552 | |
557 | - $text = sprintf($language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8')) . "\n\n"; |
|
558 | - $text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n"; |
|
559 | - $text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n"; |
|
560 | - $text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n"; |
|
553 | + // Load the language for any mails that might be required to be sent out |
|
554 | + $language = new Language($order_info['language_directory'], $this->registry); |
|
555 | + $language->load('mail/order'); |
|
561 | 556 | |
562 | - if ($comment && $notify) { |
|
563 | - $text .= $language->get('text_new_instruction') . "\n\n"; |
|
564 | - $text .= $comment . "\n\n"; |
|
565 | - } |
|
557 | + $text = sprintf($language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8')) . "\n\n"; |
|
558 | + $text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n"; |
|
559 | + $text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n"; |
|
560 | + $text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n"; |
|
566 | 561 | |
567 | - // Products |
|
568 | - $text .= $language->get('text_new_products') . "\n"; |
|
562 | + if ($comment && $notify) { |
|
563 | + $text .= $language->get('text_new_instruction') . "\n\n"; |
|
564 | + $text .= $comment . "\n\n"; |
|
565 | + } |
|
569 | 566 | |
570 | - foreach ($getProducts as $product) { |
|
571 | - $text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n"; |
|
567 | + // Products |
|
568 | + $text .= $language->get('text_new_products') . "\n"; |
|
572 | 569 | |
573 | - $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . $product['order_product_id'] . "'"); |
|
570 | + foreach ($getProducts as $product) { |
|
571 | + $text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n"; |
|
574 | 572 | |
575 | - foreach ($order_option_query->rows as $option) { |
|
576 | - if ($option['type'] != 'file') { |
|
577 | - $value = $option['value']; |
|
578 | - } else { |
|
579 | - $upload_info = $this->getUploadByCode($option['value']); |
|
573 | + $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . $product['order_product_id'] . "'"); |
|
580 | 574 | |
581 | - if ($upload_info) { |
|
582 | - $value = $upload_info['name']; |
|
583 | - } else { |
|
584 | - $value = ''; |
|
585 | - } |
|
586 | - } |
|
575 | + foreach ($order_option_query->rows as $option) { |
|
576 | + if ($option['type'] != 'file') { |
|
577 | + $value = $option['value']; |
|
578 | + } else { |
|
579 | + $upload_info = $this->getUploadByCode($option['value']); |
|
587 | 580 | |
588 | - $text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n"; |
|
589 | - } |
|
590 | - } |
|
581 | + if ($upload_info) { |
|
582 | + $value = $upload_info['name']; |
|
583 | + } else { |
|
584 | + $value = ''; |
|
585 | + } |
|
586 | + } |
|
591 | 587 | |
588 | + $text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n"; |
|
589 | + } |
|
590 | + } |
|
592 | 591 | |
593 | - foreach ($getVouchers as $voucher) { |
|
594 | - $text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']); |
|
595 | - } |
|
596 | 592 | |
597 | - $text .= "\n"; |
|
593 | + foreach ($getVouchers as $voucher) { |
|
594 | + $text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']); |
|
595 | + } |
|
598 | 596 | |
599 | - $text .= $language->get('text_new_order_total') . "\n"; |
|
597 | + $text .= "\n"; |
|
600 | 598 | |
601 | - foreach ($getTotal as $total) { |
|
602 | - $text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n"; |
|
603 | - } |
|
599 | + $text .= $language->get('text_new_order_total') . "\n"; |
|
604 | 600 | |
601 | + foreach ($getTotal as $total) { |
|
602 | + $text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n"; |
|
603 | + } |
|
605 | 604 | |
606 | - $text .= "\n"; |
|
607 | 605 | |
608 | - if ($order_info['customer_id']) { |
|
609 | - $text .= $language->get('text_new_link') . "\n"; |
|
610 | - $text .= $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id . "\n\n"; |
|
611 | - } |
|
606 | + $text .= "\n"; |
|
607 | + |
|
608 | + if ($order_info['customer_id']) { |
|
609 | + $text .= $language->get('text_new_link') . "\n"; |
|
610 | + $text .= $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id . "\n\n"; |
|
611 | + } |
|
612 | 612 | |
613 | - /* |
|
613 | + /* |
|
614 | 614 | if ($download_status) { |
615 | 615 | $text .= $language->get('text_new_download') . "\n"; |
616 | 616 | $text .= $order_info['store_url'] . 'index.php?route=account/download' . "\n\n"; |
617 | 617 | } |
618 | 618 | */ |
619 | - // Comment |
|
620 | - if ($order_info['comment']) { |
|
621 | - $text .= $language->get('text_new_comment') . "\n\n"; |
|
622 | - $text .= $order_info['comment'] . "\n\n"; |
|
623 | - } |
|
624 | - |
|
625 | - $text .= $language->get('text_new_footer') . "\n\n"; |
|
626 | - |
|
627 | - return $text; |
|
628 | - } |
|
629 | - |
|
630 | - // Language |
|
631 | - public function getLanguage() |
|
632 | - { |
|
633 | - $sql = "SELECT * FROM " . DB_PREFIX . "language WHERE language_id = '" . $this->config->get('config_language_id') . "'"; |
|
634 | - $query = $this->db->query($sql); |
|
635 | - |
|
636 | - return $query->row; |
|
637 | - } |
|
638 | - |
|
639 | - // Order Special |
|
640 | - |
|
641 | - // Order Product |
|
642 | - public function getOrderProducts($order_id) |
|
643 | - { |
|
644 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); |
|
645 | - |
|
646 | - return $query->rows; |
|
647 | - } |
|
648 | - |
|
649 | - public function getProductsTemplate($order_info, $getProducts, $template_product) |
|
650 | - { |
|
651 | - $result = array(); |
|
652 | - |
|
653 | - foreach ($getProducts as $product) { |
|
654 | - $option = array(); |
|
655 | - $attribute = array(); |
|
656 | - |
|
657 | - // Product Option Order |
|
658 | - if (stripos($template_product[1], '{product_option}') !== false) { |
|
659 | - $product_option = $this->getOrderOptions($order_info['order_id'], $product['product_id']); |
|
660 | - |
|
661 | - foreach ($product_option as $option) { |
|
662 | - if ($option['type'] != 'file') { |
|
663 | - $option[] = '<i>' . $option['name'] . '</i>: ' . $option['value']; |
|
664 | - } else { |
|
665 | - $filename = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.')); |
|
666 | - $option[] = '<i>' . $option['name'] . '</i>: ' . (utf8_strlen($filename) > 20 ? utf8_substr($filename, 0, 20) . '..' : $filename); |
|
667 | - } |
|
668 | - } |
|
669 | - } |
|
670 | - |
|
671 | - // Product Attribute Order |
|
672 | - if (stripos($template_product[1], '{product_attribute}') !== false) { |
|
673 | - $product_attributes = $this->getProductAttributes($product['product_id'], $order_info['language_id']); |
|
674 | - |
|
675 | - foreach ($product_attributes as $attribute_group) { |
|
676 | - $attribute_sub_data = ''; |
|
677 | - |
|
678 | - foreach ($attribute_group['attribute'] as $attribute) { |
|
679 | - $attribute_sub_data .= '<br />' . $attribute['name'] . ': ' . $attribute['text']; |
|
680 | - } |
|
681 | - |
|
682 | - $attribute[] = '<u>' . $attribute_group['name'] . '</u>' . $attribute_sub_data; |
|
683 | - } |
|
684 | - } |
|
685 | - |
|
686 | - $getProduct = $this->getProduct($product['product_id']); |
|
687 | - |
|
688 | - // Product Image Order |
|
689 | - if ($getProduct['image']) { |
|
690 | - if ($this->config->get('template_email_product_thumbnail_width') && $this->config->get('template_email_product_thumbnail_height')) { |
|
691 | - $image = $this->imageResize($getProduct['image'], $this->config->get('template_email_product_thumbnail_width'), $this->config->get('template_email_product_thumbnail_height')); |
|
692 | - } else { |
|
693 | - $image = $this->imageResize($getProduct['image'], 80, 80); |
|
694 | - } |
|
695 | - } else { |
|
696 | - $image = ''; |
|
697 | - } |
|
698 | - |
|
699 | - #Replace Product Short Code to Values |
|
700 | - $product_replace = $this->getProductReplace($image, $product, $order_info, $attribute, $option); |
|
701 | - |
|
702 | - $product_find = $this->getProductFind(); |
|
703 | - |
|
704 | - $result[] = trim(str_replace($product_find, $product_replace, $template_product[1])); |
|
705 | - } |
|
706 | - |
|
707 | - return $result; |
|
708 | - } |
|
709 | - |
|
710 | - public function getProductFind() |
|
711 | - { |
|
712 | - $result = array( |
|
713 | - '{product_image}', '{product_name}', '{product_model}', '{product_quantity}', '{product_price}', '{product_price_gross}', '{product_attribute}', |
|
714 | - '{product_option}', '{product_sku}', '{product_upc}', '{product_tax}', '{product_total}', '{product_total_gross}' |
|
715 | - ); |
|
716 | - |
|
717 | - return $result; |
|
718 | - } |
|
719 | - |
|
720 | - public function getProductReplace($image, $product, $order_info, $attribute, $option) |
|
721 | - { |
|
722 | - $getProduct = $this->getProduct($product['product_id']); |
|
723 | - |
|
724 | - $result = array( |
|
725 | - 'product_image' => '<img src="' . $image . '" style="width: 50px;height: 50px;padding: auto;">', |
|
726 | - 'product_name' => $product['name'], |
|
727 | - 'product_model' => $product['model'], |
|
728 | - 'product_quantity' => $product['quantity'], |
|
729 | - 'product_price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']), |
|
730 | - 'product_price_gross' => $this->currency->format(($product['price'] + $product['tax']), $order_info['currency_code'], $order_info['currency_value']), |
|
731 | - 'product_attribute' => implode('<br />', $attribute), |
|
732 | - 'product_option' => implode('<br />', $option), |
|
733 | - 'product_sku' => $getProduct['sku'], |
|
734 | - 'product_upc' => $getProduct['upc'], |
|
735 | - 'product_tax' => $this->currency->format($product['tax'], $order_info['currency_code'], $order_info['currency_value']), |
|
736 | - 'product_total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']), |
|
737 | - 'product_total_gross' => $this->currency->format($product['total'] + ($product['tax'] * $product['quantity']), $order_info['currency_code'], $order_info['currency_value']) |
|
738 | - ); |
|
739 | - |
|
740 | - return $result; |
|
741 | - } |
|
742 | - |
|
743 | - public function getOrderOptions($order_id, $order_product_id) |
|
744 | - { |
|
745 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product_id . "'"); |
|
746 | - |
|
747 | - return $query->rows; |
|
748 | - } |
|
749 | - |
|
750 | - public function getProductAttributes($product_id, $language_id) |
|
751 | - { |
|
752 | - $product_attribute_group_data = array(); |
|
753 | - |
|
754 | - $product_attribute_group_query = $this->db->query("SELECT ag.attribute_group_id, agd.name FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_group ag ON (a.attribute_group_id = ag.attribute_group_id) LEFT JOIN " . DB_PREFIX . "attribute_group_description agd ON (ag.attribute_group_id = agd.attribute_group_id) WHERE pa.product_id = '" . (int)$product_id . "' AND agd.language_id = '" . (int)$language_id . "' GROUP BY ag.attribute_group_id ORDER BY ag.sort_order, agd.name"); |
|
755 | - |
|
756 | - foreach ($product_attribute_group_query->rows as $product_attribute_group) { |
|
757 | - $product_attribute_data = array(); |
|
758 | - |
|
759 | - $product_attribute_query = $this->db->query("SELECT a.attribute_id, ad.name, pa.text FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.attribute_group_id = '" . (int)$product_attribute_group['attribute_group_id'] . "' AND ad.language_id = '" . (int)$language_id . "' AND pa.language_id = '" . (int)$language_id . "' ORDER BY a.sort_order, ad.name"); |
|
760 | - |
|
761 | - foreach ($product_attribute_query->rows as $product_attribute) { |
|
762 | - $product_attribute_data[] = array( |
|
763 | - 'attribute_id' => $product_attribute['attribute_id'], |
|
764 | - 'name' => $product_attribute['name'], |
|
765 | - 'text' => $product_attribute['text'] |
|
766 | - ); |
|
767 | - } |
|
768 | - |
|
769 | - $product_attribute_group_data[] = array( |
|
770 | - 'attribute_group_id' => $product_attribute_group['attribute_group_id'], |
|
771 | - 'name' => $product_attribute_group['name'], |
|
772 | - 'attribute' => $product_attribute_data |
|
773 | - ); |
|
774 | - } |
|
775 | - |
|
776 | - return $product_attribute_group_data; |
|
777 | - } |
|
778 | - |
|
779 | - // Order Voucher |
|
780 | - public function getOrderVouchers($order_id) |
|
781 | - { |
|
782 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_id . "'"); |
|
783 | - |
|
784 | - return $query->rows; |
|
785 | - } |
|
786 | - |
|
787 | - public function getVoucherTemplate($order_info, $getVouchers, $template_voucher) |
|
788 | - { |
|
789 | - $result = array(); |
|
790 | - |
|
791 | - foreach ($getVouchers as $voucher) { |
|
792 | - // Replace Product Short Code to Values |
|
793 | - $voucher_find = $this->getOrderVoucherFind(); |
|
794 | - $voucher_replace = $this->getOrderVoucherReplace($voucher, $order_info); |
|
795 | - |
|
796 | - $result[] = trim(str_replace($voucher_find, $voucher_replace, $template_voucher[1])); |
|
797 | - } |
|
798 | - |
|
799 | - return $result; |
|
800 | - } |
|
801 | - |
|
802 | - public function getOrderVoucherFind() |
|
803 | - { |
|
804 | - $result = array( '{voucher_description}', '{voucher_amount}' ); |
|
805 | - |
|
806 | - return $result; |
|
807 | - } |
|
808 | - |
|
809 | - public function getOrderVoucherReplace($voucher, $order_info) |
|
810 | - { |
|
811 | - $result = array( |
|
812 | - 'voucher_description' => $voucher['description'], |
|
813 | - 'voucher_amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']) |
|
814 | - ); |
|
815 | - |
|
816 | - return $result; |
|
817 | - } |
|
818 | - |
|
819 | - // Order Comment |
|
820 | - public function getCommentTemplate($comment, $template_comment) |
|
821 | - { |
|
822 | - $result = array(); |
|
823 | - |
|
824 | - // Replace Product Short Code to Values |
|
825 | - $comment_find = $this->getCommentFind(); |
|
826 | - $comment_replace = $this->getCommentReplace($comment); |
|
827 | - |
|
828 | - $result[] = trim(str_replace($comment_find, $comment_replace, $template_comment[1])); |
|
829 | - |
|
830 | - return $result; |
|
831 | - } |
|
832 | - |
|
833 | - public function getCommentFind() |
|
834 | - { |
|
835 | - $result = array( '{comment}' ); |
|
836 | - |
|
837 | - return $result; |
|
838 | - } |
|
839 | - |
|
840 | - public function getCommentReplace($comment) |
|
841 | - { |
|
842 | - $result = array( |
|
843 | - 'comment' => $comment, |
|
844 | - ); |
|
845 | - |
|
846 | - return $result; |
|
847 | - } |
|
848 | - |
|
849 | - // Order Tax |
|
850 | - public function getTaxTemplate($totals, $template_tax) |
|
851 | - { |
|
852 | - $result = array(); |
|
853 | - |
|
854 | - if (isset($totals['tax'])) { |
|
855 | - foreach ($totals['tax'] as $tax) { |
|
856 | - // Replace Product Short Code to Values |
|
857 | - $tax_find = $this->getTaxFind(); |
|
858 | - $tax_replace = $this->getTaxReplace($tax); |
|
859 | - |
|
860 | - $result[] = trim(str_replace($tax_find, $tax_replace, $template_tax[1])); |
|
861 | - } |
|
862 | - } |
|
863 | - |
|
864 | - return $result; |
|
865 | - } |
|
866 | - |
|
867 | - public function getTaxFind() |
|
868 | - { |
|
869 | - $result = array( '{tax_title}', '{tax_value}' ); |
|
870 | - |
|
871 | - return $result; |
|
872 | - } |
|
873 | - |
|
874 | - public function getTaxReplace($tax) |
|
875 | - { |
|
876 | - $result = array( |
|
877 | - 'tax_title' => $tax['title'], |
|
878 | - 'tax_value' => $tax['text'] |
|
879 | - ); |
|
880 | - |
|
881 | - return $result; |
|
882 | - } |
|
883 | - |
|
884 | - // Order Total |
|
885 | - public function getTotalTemplate($getTotal, $template_total, $order_info) |
|
886 | - { |
|
887 | - $result = array(); |
|
888 | - |
|
889 | - // Sort |
|
890 | - $sort_order = array(); |
|
891 | - |
|
892 | - foreach ($getTotal as $key => $value) { |
|
893 | - $sort_order[$key] = $value['sort_order']; |
|
894 | - } |
|
895 | - |
|
896 | - array_multisort($sort_order, SORT_ASC, $getTotal); |
|
897 | - |
|
898 | - foreach ($getTotal as $total) { |
|
899 | - // Replace Product Short Code to Values |
|
900 | - $total_find = $this->getTotalFind(); |
|
901 | - $total_replace = $this->getTotalReplace($total, $order_info); |
|
902 | - |
|
903 | - $result[] = trim(str_replace($total_find, $total_replace, $template_total[1])); |
|
904 | - } |
|
905 | - |
|
906 | - return $result; |
|
907 | - } |
|
908 | - |
|
909 | - public function getTotalFind() |
|
910 | - { |
|
911 | - $result = array( '{total_title}', '{total_value}' ); |
|
912 | - |
|
913 | - return $result; |
|
914 | - } |
|
915 | - |
|
916 | - public function getTotalReplace($total, $order_info) |
|
917 | - { |
|
918 | - $result = array( |
|
919 | - 'total_title' => $total['title'], |
|
920 | - 'total_value' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']) |
|
921 | - ); |
|
922 | - |
|
923 | - return $result; |
|
924 | - } |
|
925 | - |
|
926 | - // Default Mail Subject & Message |
|
927 | - public function getDefaultSubject($type, $template_id, $data) |
|
928 | - { |
|
929 | - switch (ucwords($type)) { |
|
930 | - case 'Login': |
|
931 | - $subject = $this->getDefaultLoginSubject($template_id, $data); |
|
932 | - break; |
|
933 | - case 'Affilate': |
|
934 | - $subject = $this->getDefaultAffilateSubject($template_id, $data); |
|
935 | - break; |
|
936 | - case 'Customer': |
|
937 | - $subject = $this->getDefaultCustomerSubject($template_id, $data); |
|
938 | - break; |
|
939 | - case 'Contact': |
|
940 | - $subject = $this->getDefaultContactSubject($template_id, $data); |
|
941 | - break; |
|
942 | - case 'Order': |
|
943 | - $subject = $this->getDefaultOrderSubject($template_id, $data); |
|
944 | - break; |
|
945 | - case 'OrderAll': |
|
946 | - $subject = $this->getDefaultOrderSubject($template_id, $data); |
|
947 | - break; |
|
948 | - case 'Return': |
|
949 | - $subject = $this->getDefaultReturnSubject($template_id, $data); |
|
950 | - break; |
|
951 | - case 'Review': |
|
952 | - $subject = $this->getDefaultReviewSubject($template_id, $data); |
|
953 | - break; |
|
954 | - case 'Stock': |
|
955 | - $subject = $this->getDefaultStockSubject($template_id, $data); |
|
956 | - break; |
|
957 | - case 'Voucher': |
|
958 | - $subject = $this->getDefaultVoucherSubject($template_id, $data); |
|
959 | - break; |
|
960 | - } |
|
961 | - |
|
962 | - return $subject; |
|
963 | - } |
|
964 | - |
|
965 | - public function getDefaultMessage($type, $template_id, $data) |
|
966 | - { |
|
967 | - switch (ucwords($type)) { |
|
968 | - case 'Login': |
|
969 | - $subject = $this->getDefaultLoginMessage($template_id, $data); |
|
970 | - break; |
|
971 | - case 'Affilate': |
|
972 | - $subject = $this->getDefaultAffilateMessage($template_id, $data); |
|
973 | - break; |
|
974 | - case 'Customer': |
|
975 | - $subject = $this->getDefaultCustomerMessage($template_id, $data); |
|
976 | - break; |
|
977 | - case 'Contact': |
|
978 | - $subject = $this->getDefaultContactMessage($template_id, $data); |
|
979 | - break; |
|
980 | - case 'Order': |
|
981 | - $subject = $this->getDefaultOrderMessage($template_id, $data); |
|
982 | - break; |
|
983 | - case 'OrderAll': |
|
984 | - $subject = $this->getDefaultOrderMessage($template_id, $data); |
|
985 | - break; |
|
986 | - case 'Return': |
|
987 | - $subject = $this->getDefaultReturnMessage($template_id, $data); |
|
988 | - break; |
|
989 | - case 'Review': |
|
990 | - $subject = $this->getDefaultReviewMessage($template_id, $data); |
|
991 | - break; |
|
992 | - case 'Stock': |
|
993 | - $subject = $this->getDefaultStockMessage($template_id, $data); |
|
994 | - break; |
|
995 | - case 'Voucher': |
|
996 | - $subject = $this->getDefaultVoucherMessage($template_id, $data); |
|
997 | - break; |
|
998 | - } |
|
999 | - |
|
1000 | - return $subject; |
|
1001 | - } |
|
1002 | - |
|
1003 | - public function getDefaultLoginSubject($type_id, $data) |
|
1004 | - { |
|
1005 | - $username = $data['username']; |
|
1006 | - |
|
1007 | - $subject = 'User '.$username.' logged in on '.$this->config->get('config_name').' admin panel'; |
|
1008 | - |
|
1009 | - return $subject; |
|
1010 | - } |
|
1011 | - |
|
1012 | - public function getDefaultLoginMessage($type_id, $data) |
|
1013 | - { |
|
1014 | - $message = 'Hello,<br/><br/>'; |
|
1015 | - $message .= 'We would like to notify you that user ' . $data['username'] . ' has just logged in to the admin panel of your store, ' . $data['store_name'] . ', using IP address ' . $data['ip_address'].'.<br/><br/>'; |
|
1016 | - $message .= 'If this is expected you need to do nothing about it. If you suspect a hacking attempt, please log in to your store\'s admin panel immediately and change your password at once.<br/><br/>'; |
|
1017 | - $message .= 'Best Regards,<br/><br/>'; |
|
1018 | - $message .= 'The ' . $data['store_name'] . ' team<br/><br/>'; |
|
1019 | - |
|
1020 | - return $message; |
|
1021 | - } |
|
1022 | - |
|
1023 | - public function getDefaultAffilateSubject($type_id, $data) |
|
1024 | - { |
|
1025 | - $this->load->language('mail/affiliate'); |
|
1026 | - |
|
1027 | - if ($type_id == 'affiliate_4') { |
|
1028 | - $subject = sprintf($this->language->get('text_approve_subject'), $this->config->get('config_name')); |
|
1029 | - } elseif ($type_id == 'affiliate_5') { |
|
1030 | - $subject = sprintf($this->language->get('text_commission_subject'), $this->config->get('config_name')); |
|
1031 | - } elseif ($type_id == 'affiliate_1') { |
|
1032 | - $subject = sprintf($this->language->get('text_register_subject'), $this->config->get('config_name')); |
|
1033 | - } elseif ($type_id == 'affiliate_3') { |
|
1034 | - $subject = sprintf($this->language->get('text_register_approve_subject'), $this->config->get('config_name')); |
|
1035 | - } elseif ($type_id == 'affiliate_2') { |
|
1036 | - // Reset Password Null |
|
1037 | - $subject = ''; |
|
1038 | - } else { |
|
1039 | - $subject = $this->config->get('config_name') . ' - Affilate Mail'; |
|
1040 | - } |
|
1041 | - |
|
1042 | - return $subject; |
|
1043 | - } |
|
1044 | - |
|
1045 | - public function getDefaultAffilateMessage($type_id, $data) |
|
1046 | - { |
|
1047 | - $this->load->language('mail/affiliate'); |
|
1048 | - |
|
1049 | - if ($type_id == 'affiliate_4') { |
|
1050 | - $message = sprintf($this->language->get('text_approve_welcome'), $this->config->get('config_name')) . "\n\n"; |
|
1051 | - $message .= $this->language->get('text_approve_login') . "\n"; |
|
1052 | - $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
|
1053 | - $message .= $store_url . 'index.php?route=affiliate/login' . "\n\n"; |
|
1054 | - $message .= $this->language->get('text_approve_services') . "\n\n"; |
|
1055 | - $message .= $this->language->get('text_approve_thanks') . "\n"; |
|
1056 | - $message .= $this->config->get('config_name'); |
|
1057 | - } elseif ($type_id == 'affiliate_5') { |
|
1058 | - $message = sprintf($this->language->get('text_commission_received'), $this->currency->format($data['amount'], $this->config->get('config_currency'))) . "\n\n"; |
|
1059 | - $message .= sprintf($this->language->get('text_commission_total'), $this->currency->format($this->getCommissionTotal($data['affiliate_id']), $this->config->get('config_currency'))); |
|
1060 | - } elseif ($type_id == 'affiliate_1') { |
|
1061 | - $message = sprintf($this->language->get('text_register_message'), $data['firstname'] . ' ' . $data['lastname'], $this->config->get('config_name')); |
|
1062 | - } elseif ($type_id == 'affiliate_3') { |
|
1063 | - $message = sprintf($this->language->get('text_register_approve_message'), $data['firstname'] . ' ' . $data['lastname'], $this->config->get('config_name')); |
|
1064 | - } elseif ($type_id == 'affiliate_2') { |
|
1065 | - // Reset Password Null |
|
1066 | - $message = sprintf($this->language->get('text_register_approve_subject'), $this->config->get('config_name'), $data['firstname'] . ' ' . $data['lastname']); |
|
1067 | - } else { |
|
1068 | - $message = 'Hi!' . "\n" . 'Welcome ' . $data['firstname'] . ' ' . $data['lastname']; |
|
1069 | - } |
|
1070 | - |
|
1071 | - return $message; |
|
1072 | - } |
|
1073 | - |
|
1074 | - // Affilate getComissionTotal Frontend & Backend |
|
1075 | - public function getCommissionTotal($affiliate_id) |
|
1076 | - { |
|
1077 | - $query = $this->db->query("SELECT SUM(amount) AS total FROM " . DB_PREFIX . "affiliate_commission WHERE affiliate_id = '" . (int)$affiliate_id . "'"); |
|
1078 | - |
|
1079 | - return $query->row['total']; |
|
1080 | - } |
|
1081 | - |
|
1082 | - public function getDefaultCustomerSubject($type_id, $data) |
|
1083 | - { |
|
1084 | - $this->load->language('mail/customer'); |
|
1085 | - |
|
1086 | - if ($type_id == 'customer_4') { |
|
1087 | - $subject = sprintf($this->language->get('text_approve_subject'), $this->config->get('config_name')); |
|
1088 | - } elseif ($type_id == 'customer_1') { |
|
1089 | - // Register |
|
1090 | - $subject = sprintf($this->language->get('text_register_subject'), $this->config->get('config_name')); |
|
1091 | - } elseif ($type_id == 'customer_2') { |
|
1092 | - // Aprove |
|
1093 | - $subject = sprintf($this->language->get('text_approve_wait_subject'), $this->config->get('config_name')); |
|
1094 | - } elseif ($type_id == 'customer_3') { |
|
1095 | - // Reset |
|
1096 | - $subject = sprintf($this->language->get('text_approve_subject'), $this->config->get('config_name')); |
|
1097 | - } elseif ($type_id == 'customer_5') { |
|
1098 | - $subject = $this->getDefaultVoucherSubject($type_id, $data); |
|
1099 | - } else { |
|
1100 | - $subject = $this->config->get('config_name') . ' - Customer Mail'; |
|
1101 | - } |
|
1102 | - |
|
1103 | - return $subject; |
|
1104 | - } |
|
1105 | - |
|
1106 | - public function getDefaultCustomerMessage($type_id, $data) |
|
1107 | - { |
|
1108 | - $this->load->language('mail/customer'); |
|
1109 | - |
|
1110 | - if ($type_id == 'customer_4') { |
|
1111 | - $store_name = $this->config->get('config_name'); |
|
1112 | - $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
|
1113 | - $store_url .= 'index.php?route=account/login'; |
|
1114 | - |
|
1115 | - $message = sprintf($this->language->get('text_approve_welcome'), $store_name) . "\n\n"; |
|
1116 | - $message .= $this->language->get('text_approve_login') . "\n"; |
|
1117 | - $message .= $store_url . "\n\n"; |
|
1118 | - $message .= $this->language->get('text_approve_services') . "\n\n"; |
|
1119 | - $message .= $this->language->get('text_approve_thanks') . "\n"; |
|
1120 | - $message .= $store_name; |
|
1121 | - } elseif ($type_id == 'customer_1') { |
|
1122 | - // Register |
|
1123 | - $message = sprintf($this->language->get('text_register_message'), $this->config->get('config_name')); |
|
1124 | - } elseif ($type_id == 'customer_2') { |
|
1125 | - // Aprove |
|
1126 | - $message = sprintf($this->language->get('text_register_message'), $this->config->get('config_name')); |
|
1127 | - } elseif ($type_id == 'customer_3') { |
|
1128 | - $message = ' --- '; |
|
1129 | - } elseif ($type_id == 'customer_5') { |
|
1130 | - $message = $this->getDefaultVoucherMessage($type_id, $data); |
|
1131 | - } else { |
|
1132 | - $message = 'Customer Mail Description'; |
|
1133 | - } |
|
1134 | - |
|
1135 | - return $message; |
|
1136 | - } |
|
1137 | - |
|
1138 | - public function getDefaultContactSubject($type_id, $data) |
|
1139 | - { |
|
1140 | - $this->load->language('information/contact'); |
|
1141 | - |
|
1142 | - $subject = sprintf($this->language->get('email_subject'), $data['name']); |
|
1143 | - |
|
1144 | - return $subject; |
|
1145 | - } |
|
1146 | - |
|
1147 | - public function getDefaultContactMessage($type_id, $data) |
|
1148 | - { |
|
1149 | - return strip_tags($data['enquiry']); |
|
1150 | - } |
|
1151 | - |
|
1152 | - public function getDefaultOrderSubject($type_id, $data) |
|
1153 | - { |
|
1154 | - $this->load->language('mail/order'); |
|
1155 | - |
|
1156 | - $subject = sprintf($this->language->get('text_new_subject'), $data['order_info']['store_name'], $data['order_info']['order_id']); |
|
1157 | - |
|
1158 | - return $subject; |
|
1159 | - } |
|
1160 | - |
|
1161 | - public function getDefaultOrderMessage($type_id, $data) |
|
1162 | - { |
|
1163 | - $this->load->language('mail/order'); |
|
1164 | - |
|
1165 | - foreach ($data as $dataKey => $dataValue) { |
|
1166 | - $$dataKey = $dataValue; |
|
1167 | - } |
|
1168 | - |
|
1169 | - // HTML Mail |
|
1170 | - $html_data = array(); |
|
1171 | - |
|
1172 | - $html_data['title'] = sprintf($this->language->get('text_new_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_info['order_id']); |
|
1173 | - |
|
1174 | - $html_data['text_greeting'] = sprintf($this->language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8')); |
|
1175 | - $html_data['text_link'] = $this->language->get('text_new_link'); |
|
1176 | - $html_data['text_download'] = $this->language->get('text_new_download'); |
|
1177 | - $html_data['text_order_detail'] = $this->language->get('text_new_order_detail'); |
|
1178 | - $html_data['text_instruction'] = $this->language->get('text_new_instruction'); |
|
1179 | - $html_data['text_order_id'] = $this->language->get('text_new_order_id'); |
|
1180 | - $html_data['text_date_added'] = $this->language->get('text_new_date_added'); |
|
1181 | - $html_data['text_payment_method'] = $this->language->get('text_new_payment_method'); |
|
1182 | - $html_data['text_shipping_method'] = $this->language->get('text_new_shipping_method'); |
|
1183 | - $html_data['text_email'] = $this->language->get('text_new_email'); |
|
1184 | - $html_data['text_telephone'] = $this->language->get('text_new_telephone'); |
|
1185 | - $html_data['text_ip'] = $this->language->get('text_new_ip'); |
|
1186 | - $html_data['text_order_status'] = $this->language->get('text_new_order_status'); |
|
1187 | - $html_data['text_payment_address'] = $this->language->get('text_new_payment_address'); |
|
1188 | - $html_data['text_shipping_address'] = $this->language->get('text_new_shipping_address'); |
|
1189 | - $html_data['text_product'] = $this->language->get('text_new_product'); |
|
1190 | - $html_data['text_model'] = $this->language->get('text_new_model'); |
|
1191 | - $html_data['text_quantity'] = $this->language->get('text_new_quantity'); |
|
1192 | - $html_data['text_price'] = $this->language->get('text_new_price'); |
|
1193 | - $html_data['text_total'] = $this->language->get('text_new_total'); |
|
1194 | - $html_data['text_footer'] = $this->language->get('text_new_footer'); |
|
1195 | - |
|
1196 | - $html_data['logo'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo'); |
|
1197 | - $html_data['store_name'] = $order_info['store_name']; |
|
1198 | - $html_data['store_url'] = $order_info['store_url']; |
|
1199 | - $html_data['customer_id'] = $order_info['customer_id']; |
|
1200 | - $html_data['link'] = $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_info['order_id']; |
|
1201 | - |
|
1202 | - if (isset($download_status) && $download_status) { |
|
1203 | - $html_data['download'] = $order_info['store_url'] . 'index.php?route=account/download'; |
|
1204 | - } else { |
|
1205 | - $html_data['download'] = ''; |
|
1206 | - } |
|
1207 | - |
|
1208 | - $html_data['order_id'] = $order_info['order_id']; |
|
1209 | - $html_data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added'])); |
|
1210 | - $html_data['payment_method'] = $order_info['payment_method']; |
|
1211 | - $html_data['shipping_method'] = $order_info['shipping_method']; |
|
1212 | - $html_data['email'] = $order_info['email']; |
|
1213 | - $html_data['telephone'] = $order_info['telephone']; |
|
1214 | - $html_data['ip'] = $order_info['ip']; |
|
1215 | - $html_data['order_status'] = $order_status; |
|
1216 | - |
|
1217 | - if ($comment && $notify) { |
|
1218 | - $html_data['comment'] = nl2br($comment); |
|
1219 | - } else { |
|
1220 | - $html_data['comment'] = ''; |
|
1221 | - } |
|
1222 | - |
|
1223 | - if ($order_info['payment_address_format']) { |
|
1224 | - $format = $order_info['payment_address_format']; |
|
1225 | - } else { |
|
1226 | - $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; |
|
1227 | - } |
|
1228 | - |
|
1229 | - $find = array( |
|
1230 | - '{firstname}', |
|
1231 | - '{lastname}', |
|
1232 | - '{company}', |
|
1233 | - '{address_1}', |
|
1234 | - '{address_2}', |
|
1235 | - '{city}', |
|
1236 | - '{postcode}', |
|
1237 | - '{zone}', |
|
1238 | - '{zone_code}', |
|
1239 | - '{country}' |
|
1240 | - ); |
|
1241 | - |
|
1242 | - $replace = array( |
|
1243 | - 'firstname' => $order_info['payment_firstname'], |
|
1244 | - 'lastname' => $order_info['payment_lastname'], |
|
1245 | - 'company' => $order_info['payment_company'], |
|
1246 | - 'address_1' => $order_info['payment_address_1'], |
|
1247 | - 'address_2' => $order_info['payment_address_2'], |
|
1248 | - 'city' => $order_info['payment_city'], |
|
1249 | - 'postcode' => $order_info['payment_postcode'], |
|
1250 | - 'zone' => $order_info['payment_zone'], |
|
1251 | - 'zone_code' => $order_info['payment_zone_code'], |
|
1252 | - 'country' => $order_info['payment_country'] |
|
1253 | - ); |
|
1254 | - |
|
1255 | - $html_data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); |
|
1256 | - |
|
1257 | - if ($order_info['shipping_address_format']) { |
|
1258 | - $format = $order_info['shipping_address_format']; |
|
1259 | - } else { |
|
1260 | - $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; |
|
1261 | - } |
|
1262 | - |
|
1263 | - $find = array( |
|
1264 | - '{firstname}', |
|
1265 | - '{lastname}', |
|
1266 | - '{company}', |
|
1267 | - '{address_1}', |
|
1268 | - '{address_2}', |
|
1269 | - '{city}', |
|
1270 | - '{postcode}', |
|
1271 | - '{zone}', |
|
1272 | - '{zone_code}', |
|
1273 | - '{country}' |
|
1274 | - ); |
|
1275 | - |
|
1276 | - $replace = array( |
|
1277 | - 'firstname' => $order_info['shipping_firstname'], |
|
1278 | - 'lastname' => $order_info['shipping_lastname'], |
|
1279 | - 'company' => $order_info['shipping_company'], |
|
1280 | - 'address_1' => $order_info['shipping_address_1'], |
|
1281 | - 'address_2' => $order_info['shipping_address_2'], |
|
1282 | - 'city' => $order_info['shipping_city'], |
|
1283 | - 'postcode' => $order_info['shipping_postcode'], |
|
1284 | - 'zone' => $order_info['shipping_zone'], |
|
1285 | - 'zone_code' => $order_info['shipping_zone_code'], |
|
1286 | - 'country' => $order_info['shipping_country'] |
|
1287 | - ); |
|
1288 | - |
|
1289 | - $html_data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); |
|
1290 | - |
|
1291 | - |
|
1292 | - $this->load->model('tool/upload'); |
|
1293 | - |
|
1294 | - // Products |
|
1295 | - $html_data['products'] = array(); |
|
1296 | - |
|
1297 | - $order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
1298 | - |
|
1299 | - foreach ($order_product_query->rows as $product) { |
|
1300 | - $option_data = array(); |
|
1301 | - |
|
1302 | - $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_info['order_id'] . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'"); |
|
1303 | - |
|
1304 | - foreach ($order_option_query->rows as $option) { |
|
1305 | - if ($option['type'] != 'file') { |
|
1306 | - $value = $option['value']; |
|
1307 | - } else { |
|
1308 | - $upload_info = $this->model_tool_upload->getUploadByCode($option['value']); |
|
1309 | - |
|
1310 | - if ($upload_info) { |
|
1311 | - $value = $upload_info['name']; |
|
1312 | - } else { |
|
1313 | - $value = ''; |
|
1314 | - } |
|
1315 | - } |
|
1316 | - |
|
1317 | - $option_data[] = array( |
|
1318 | - 'name' => $option['name'], |
|
1319 | - 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) |
|
1320 | - ); |
|
1321 | - } |
|
1322 | - |
|
1323 | - $html_data['products'][] = array( |
|
1324 | - 'name' => $product['name'], |
|
1325 | - 'model' => $product['model'], |
|
1326 | - 'option' => $option_data, |
|
1327 | - 'quantity' => $product['quantity'], |
|
1328 | - 'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']), |
|
1329 | - 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']) |
|
1330 | - ); |
|
1331 | - } |
|
1332 | - |
|
1333 | - // Vouchers |
|
1334 | - $html_data['vouchers'] = array(); |
|
1335 | - |
|
1336 | - |
|
1337 | - $order_voucher_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
1338 | - |
|
1339 | - foreach ($order_voucher_query->rows as $voucher) { |
|
1340 | - $html_data['vouchers'][] = array( |
|
1341 | - 'description' => $voucher['description'], |
|
1342 | - 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']), |
|
1343 | - ); |
|
1344 | - } |
|
1345 | - |
|
1346 | - // Order Totals |
|
1347 | - $order_total_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int)$order_info['order_id'] . "' ORDER BY sort_order ASC"); |
|
1348 | - |
|
1349 | - foreach ($order_total_query->rows as $total) { |
|
1350 | - $html_data['totals'][] = array( |
|
1351 | - 'title' => $total['title'], |
|
1352 | - 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), |
|
1353 | - ); |
|
1354 | - } |
|
1355 | - |
|
1356 | - if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) { |
|
1357 | - $html = $this->load->view($this->config->get('config_template') . '/template/mail/order.tpl', $html_data); |
|
1358 | - } else { |
|
1359 | - $html = $this->load->view('default/template/mail/order.tpl', $html_data); |
|
1360 | - } |
|
1361 | - |
|
1362 | - return $html; |
|
1363 | - } |
|
619 | + // Comment |
|
620 | + if ($order_info['comment']) { |
|
621 | + $text .= $language->get('text_new_comment') . "\n\n"; |
|
622 | + $text .= $order_info['comment'] . "\n\n"; |
|
623 | + } |
|
624 | + |
|
625 | + $text .= $language->get('text_new_footer') . "\n\n"; |
|
626 | + |
|
627 | + return $text; |
|
628 | + } |
|
629 | + |
|
630 | + // Language |
|
631 | + public function getLanguage() |
|
632 | + { |
|
633 | + $sql = "SELECT * FROM " . DB_PREFIX . "language WHERE language_id = '" . $this->config->get('config_language_id') . "'"; |
|
634 | + $query = $this->db->query($sql); |
|
635 | + |
|
636 | + return $query->row; |
|
637 | + } |
|
638 | + |
|
639 | + // Order Special |
|
640 | + |
|
641 | + // Order Product |
|
642 | + public function getOrderProducts($order_id) |
|
643 | + { |
|
644 | + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); |
|
645 | + |
|
646 | + return $query->rows; |
|
647 | + } |
|
648 | + |
|
649 | + public function getProductsTemplate($order_info, $getProducts, $template_product) |
|
650 | + { |
|
651 | + $result = array(); |
|
652 | + |
|
653 | + foreach ($getProducts as $product) { |
|
654 | + $option = array(); |
|
655 | + $attribute = array(); |
|
656 | + |
|
657 | + // Product Option Order |
|
658 | + if (stripos($template_product[1], '{product_option}') !== false) { |
|
659 | + $product_option = $this->getOrderOptions($order_info['order_id'], $product['product_id']); |
|
660 | + |
|
661 | + foreach ($product_option as $option) { |
|
662 | + if ($option['type'] != 'file') { |
|
663 | + $option[] = '<i>' . $option['name'] . '</i>: ' . $option['value']; |
|
664 | + } else { |
|
665 | + $filename = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.')); |
|
666 | + $option[] = '<i>' . $option['name'] . '</i>: ' . (utf8_strlen($filename) > 20 ? utf8_substr($filename, 0, 20) . '..' : $filename); |
|
667 | + } |
|
668 | + } |
|
669 | + } |
|
670 | + |
|
671 | + // Product Attribute Order |
|
672 | + if (stripos($template_product[1], '{product_attribute}') !== false) { |
|
673 | + $product_attributes = $this->getProductAttributes($product['product_id'], $order_info['language_id']); |
|
674 | + |
|
675 | + foreach ($product_attributes as $attribute_group) { |
|
676 | + $attribute_sub_data = ''; |
|
677 | + |
|
678 | + foreach ($attribute_group['attribute'] as $attribute) { |
|
679 | + $attribute_sub_data .= '<br />' . $attribute['name'] . ': ' . $attribute['text']; |
|
680 | + } |
|
681 | + |
|
682 | + $attribute[] = '<u>' . $attribute_group['name'] . '</u>' . $attribute_sub_data; |
|
683 | + } |
|
684 | + } |
|
685 | + |
|
686 | + $getProduct = $this->getProduct($product['product_id']); |
|
687 | + |
|
688 | + // Product Image Order |
|
689 | + if ($getProduct['image']) { |
|
690 | + if ($this->config->get('template_email_product_thumbnail_width') && $this->config->get('template_email_product_thumbnail_height')) { |
|
691 | + $image = $this->imageResize($getProduct['image'], $this->config->get('template_email_product_thumbnail_width'), $this->config->get('template_email_product_thumbnail_height')); |
|
692 | + } else { |
|
693 | + $image = $this->imageResize($getProduct['image'], 80, 80); |
|
694 | + } |
|
695 | + } else { |
|
696 | + $image = ''; |
|
697 | + } |
|
698 | + |
|
699 | + #Replace Product Short Code to Values |
|
700 | + $product_replace = $this->getProductReplace($image, $product, $order_info, $attribute, $option); |
|
701 | + |
|
702 | + $product_find = $this->getProductFind(); |
|
703 | + |
|
704 | + $result[] = trim(str_replace($product_find, $product_replace, $template_product[1])); |
|
705 | + } |
|
706 | + |
|
707 | + return $result; |
|
708 | + } |
|
709 | + |
|
710 | + public function getProductFind() |
|
711 | + { |
|
712 | + $result = array( |
|
713 | + '{product_image}', '{product_name}', '{product_model}', '{product_quantity}', '{product_price}', '{product_price_gross}', '{product_attribute}', |
|
714 | + '{product_option}', '{product_sku}', '{product_upc}', '{product_tax}', '{product_total}', '{product_total_gross}' |
|
715 | + ); |
|
716 | + |
|
717 | + return $result; |
|
718 | + } |
|
719 | + |
|
720 | + public function getProductReplace($image, $product, $order_info, $attribute, $option) |
|
721 | + { |
|
722 | + $getProduct = $this->getProduct($product['product_id']); |
|
723 | + |
|
724 | + $result = array( |
|
725 | + 'product_image' => '<img src="' . $image . '" style="width: 50px;height: 50px;padding: auto;">', |
|
726 | + 'product_name' => $product['name'], |
|
727 | + 'product_model' => $product['model'], |
|
728 | + 'product_quantity' => $product['quantity'], |
|
729 | + 'product_price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']), |
|
730 | + 'product_price_gross' => $this->currency->format(($product['price'] + $product['tax']), $order_info['currency_code'], $order_info['currency_value']), |
|
731 | + 'product_attribute' => implode('<br />', $attribute), |
|
732 | + 'product_option' => implode('<br />', $option), |
|
733 | + 'product_sku' => $getProduct['sku'], |
|
734 | + 'product_upc' => $getProduct['upc'], |
|
735 | + 'product_tax' => $this->currency->format($product['tax'], $order_info['currency_code'], $order_info['currency_value']), |
|
736 | + 'product_total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']), |
|
737 | + 'product_total_gross' => $this->currency->format($product['total'] + ($product['tax'] * $product['quantity']), $order_info['currency_code'], $order_info['currency_value']) |
|
738 | + ); |
|
739 | + |
|
740 | + return $result; |
|
741 | + } |
|
742 | + |
|
743 | + public function getOrderOptions($order_id, $order_product_id) |
|
744 | + { |
|
745 | + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product_id . "'"); |
|
746 | + |
|
747 | + return $query->rows; |
|
748 | + } |
|
749 | + |
|
750 | + public function getProductAttributes($product_id, $language_id) |
|
751 | + { |
|
752 | + $product_attribute_group_data = array(); |
|
753 | + |
|
754 | + $product_attribute_group_query = $this->db->query("SELECT ag.attribute_group_id, agd.name FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_group ag ON (a.attribute_group_id = ag.attribute_group_id) LEFT JOIN " . DB_PREFIX . "attribute_group_description agd ON (ag.attribute_group_id = agd.attribute_group_id) WHERE pa.product_id = '" . (int)$product_id . "' AND agd.language_id = '" . (int)$language_id . "' GROUP BY ag.attribute_group_id ORDER BY ag.sort_order, agd.name"); |
|
755 | + |
|
756 | + foreach ($product_attribute_group_query->rows as $product_attribute_group) { |
|
757 | + $product_attribute_data = array(); |
|
758 | + |
|
759 | + $product_attribute_query = $this->db->query("SELECT a.attribute_id, ad.name, pa.text FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.attribute_group_id = '" . (int)$product_attribute_group['attribute_group_id'] . "' AND ad.language_id = '" . (int)$language_id . "' AND pa.language_id = '" . (int)$language_id . "' ORDER BY a.sort_order, ad.name"); |
|
760 | + |
|
761 | + foreach ($product_attribute_query->rows as $product_attribute) { |
|
762 | + $product_attribute_data[] = array( |
|
763 | + 'attribute_id' => $product_attribute['attribute_id'], |
|
764 | + 'name' => $product_attribute['name'], |
|
765 | + 'text' => $product_attribute['text'] |
|
766 | + ); |
|
767 | + } |
|
768 | + |
|
769 | + $product_attribute_group_data[] = array( |
|
770 | + 'attribute_group_id' => $product_attribute_group['attribute_group_id'], |
|
771 | + 'name' => $product_attribute_group['name'], |
|
772 | + 'attribute' => $product_attribute_data |
|
773 | + ); |
|
774 | + } |
|
775 | + |
|
776 | + return $product_attribute_group_data; |
|
777 | + } |
|
778 | + |
|
779 | + // Order Voucher |
|
780 | + public function getOrderVouchers($order_id) |
|
781 | + { |
|
782 | + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_id . "'"); |
|
783 | + |
|
784 | + return $query->rows; |
|
785 | + } |
|
786 | + |
|
787 | + public function getVoucherTemplate($order_info, $getVouchers, $template_voucher) |
|
788 | + { |
|
789 | + $result = array(); |
|
790 | + |
|
791 | + foreach ($getVouchers as $voucher) { |
|
792 | + // Replace Product Short Code to Values |
|
793 | + $voucher_find = $this->getOrderVoucherFind(); |
|
794 | + $voucher_replace = $this->getOrderVoucherReplace($voucher, $order_info); |
|
795 | + |
|
796 | + $result[] = trim(str_replace($voucher_find, $voucher_replace, $template_voucher[1])); |
|
797 | + } |
|
798 | + |
|
799 | + return $result; |
|
800 | + } |
|
801 | + |
|
802 | + public function getOrderVoucherFind() |
|
803 | + { |
|
804 | + $result = array( '{voucher_description}', '{voucher_amount}' ); |
|
805 | + |
|
806 | + return $result; |
|
807 | + } |
|
808 | + |
|
809 | + public function getOrderVoucherReplace($voucher, $order_info) |
|
810 | + { |
|
811 | + $result = array( |
|
812 | + 'voucher_description' => $voucher['description'], |
|
813 | + 'voucher_amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']) |
|
814 | + ); |
|
815 | + |
|
816 | + return $result; |
|
817 | + } |
|
818 | + |
|
819 | + // Order Comment |
|
820 | + public function getCommentTemplate($comment, $template_comment) |
|
821 | + { |
|
822 | + $result = array(); |
|
823 | + |
|
824 | + // Replace Product Short Code to Values |
|
825 | + $comment_find = $this->getCommentFind(); |
|
826 | + $comment_replace = $this->getCommentReplace($comment); |
|
827 | + |
|
828 | + $result[] = trim(str_replace($comment_find, $comment_replace, $template_comment[1])); |
|
829 | + |
|
830 | + return $result; |
|
831 | + } |
|
832 | + |
|
833 | + public function getCommentFind() |
|
834 | + { |
|
835 | + $result = array( '{comment}' ); |
|
836 | + |
|
837 | + return $result; |
|
838 | + } |
|
839 | + |
|
840 | + public function getCommentReplace($comment) |
|
841 | + { |
|
842 | + $result = array( |
|
843 | + 'comment' => $comment, |
|
844 | + ); |
|
845 | + |
|
846 | + return $result; |
|
847 | + } |
|
848 | + |
|
849 | + // Order Tax |
|
850 | + public function getTaxTemplate($totals, $template_tax) |
|
851 | + { |
|
852 | + $result = array(); |
|
853 | + |
|
854 | + if (isset($totals['tax'])) { |
|
855 | + foreach ($totals['tax'] as $tax) { |
|
856 | + // Replace Product Short Code to Values |
|
857 | + $tax_find = $this->getTaxFind(); |
|
858 | + $tax_replace = $this->getTaxReplace($tax); |
|
859 | + |
|
860 | + $result[] = trim(str_replace($tax_find, $tax_replace, $template_tax[1])); |
|
861 | + } |
|
862 | + } |
|
863 | + |
|
864 | + return $result; |
|
865 | + } |
|
866 | + |
|
867 | + public function getTaxFind() |
|
868 | + { |
|
869 | + $result = array( '{tax_title}', '{tax_value}' ); |
|
870 | + |
|
871 | + return $result; |
|
872 | + } |
|
873 | + |
|
874 | + public function getTaxReplace($tax) |
|
875 | + { |
|
876 | + $result = array( |
|
877 | + 'tax_title' => $tax['title'], |
|
878 | + 'tax_value' => $tax['text'] |
|
879 | + ); |
|
880 | + |
|
881 | + return $result; |
|
882 | + } |
|
883 | + |
|
884 | + // Order Total |
|
885 | + public function getTotalTemplate($getTotal, $template_total, $order_info) |
|
886 | + { |
|
887 | + $result = array(); |
|
888 | + |
|
889 | + // Sort |
|
890 | + $sort_order = array(); |
|
891 | + |
|
892 | + foreach ($getTotal as $key => $value) { |
|
893 | + $sort_order[$key] = $value['sort_order']; |
|
894 | + } |
|
895 | + |
|
896 | + array_multisort($sort_order, SORT_ASC, $getTotal); |
|
897 | + |
|
898 | + foreach ($getTotal as $total) { |
|
899 | + // Replace Product Short Code to Values |
|
900 | + $total_find = $this->getTotalFind(); |
|
901 | + $total_replace = $this->getTotalReplace($total, $order_info); |
|
902 | + |
|
903 | + $result[] = trim(str_replace($total_find, $total_replace, $template_total[1])); |
|
904 | + } |
|
905 | + |
|
906 | + return $result; |
|
907 | + } |
|
908 | + |
|
909 | + public function getTotalFind() |
|
910 | + { |
|
911 | + $result = array( '{total_title}', '{total_value}' ); |
|
912 | + |
|
913 | + return $result; |
|
914 | + } |
|
915 | + |
|
916 | + public function getTotalReplace($total, $order_info) |
|
917 | + { |
|
918 | + $result = array( |
|
919 | + 'total_title' => $total['title'], |
|
920 | + 'total_value' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']) |
|
921 | + ); |
|
922 | + |
|
923 | + return $result; |
|
924 | + } |
|
925 | + |
|
926 | + // Default Mail Subject & Message |
|
927 | + public function getDefaultSubject($type, $template_id, $data) |
|
928 | + { |
|
929 | + switch (ucwords($type)) { |
|
930 | + case 'Login': |
|
931 | + $subject = $this->getDefaultLoginSubject($template_id, $data); |
|
932 | + break; |
|
933 | + case 'Affilate': |
|
934 | + $subject = $this->getDefaultAffilateSubject($template_id, $data); |
|
935 | + break; |
|
936 | + case 'Customer': |
|
937 | + $subject = $this->getDefaultCustomerSubject($template_id, $data); |
|
938 | + break; |
|
939 | + case 'Contact': |
|
940 | + $subject = $this->getDefaultContactSubject($template_id, $data); |
|
941 | + break; |
|
942 | + case 'Order': |
|
943 | + $subject = $this->getDefaultOrderSubject($template_id, $data); |
|
944 | + break; |
|
945 | + case 'OrderAll': |
|
946 | + $subject = $this->getDefaultOrderSubject($template_id, $data); |
|
947 | + break; |
|
948 | + case 'Return': |
|
949 | + $subject = $this->getDefaultReturnSubject($template_id, $data); |
|
950 | + break; |
|
951 | + case 'Review': |
|
952 | + $subject = $this->getDefaultReviewSubject($template_id, $data); |
|
953 | + break; |
|
954 | + case 'Stock': |
|
955 | + $subject = $this->getDefaultStockSubject($template_id, $data); |
|
956 | + break; |
|
957 | + case 'Voucher': |
|
958 | + $subject = $this->getDefaultVoucherSubject($template_id, $data); |
|
959 | + break; |
|
960 | + } |
|
961 | + |
|
962 | + return $subject; |
|
963 | + } |
|
964 | + |
|
965 | + public function getDefaultMessage($type, $template_id, $data) |
|
966 | + { |
|
967 | + switch (ucwords($type)) { |
|
968 | + case 'Login': |
|
969 | + $subject = $this->getDefaultLoginMessage($template_id, $data); |
|
970 | + break; |
|
971 | + case 'Affilate': |
|
972 | + $subject = $this->getDefaultAffilateMessage($template_id, $data); |
|
973 | + break; |
|
974 | + case 'Customer': |
|
975 | + $subject = $this->getDefaultCustomerMessage($template_id, $data); |
|
976 | + break; |
|
977 | + case 'Contact': |
|
978 | + $subject = $this->getDefaultContactMessage($template_id, $data); |
|
979 | + break; |
|
980 | + case 'Order': |
|
981 | + $subject = $this->getDefaultOrderMessage($template_id, $data); |
|
982 | + break; |
|
983 | + case 'OrderAll': |
|
984 | + $subject = $this->getDefaultOrderMessage($template_id, $data); |
|
985 | + break; |
|
986 | + case 'Return': |
|
987 | + $subject = $this->getDefaultReturnMessage($template_id, $data); |
|
988 | + break; |
|
989 | + case 'Review': |
|
990 | + $subject = $this->getDefaultReviewMessage($template_id, $data); |
|
991 | + break; |
|
992 | + case 'Stock': |
|
993 | + $subject = $this->getDefaultStockMessage($template_id, $data); |
|
994 | + break; |
|
995 | + case 'Voucher': |
|
996 | + $subject = $this->getDefaultVoucherMessage($template_id, $data); |
|
997 | + break; |
|
998 | + } |
|
999 | + |
|
1000 | + return $subject; |
|
1001 | + } |
|
1002 | + |
|
1003 | + public function getDefaultLoginSubject($type_id, $data) |
|
1004 | + { |
|
1005 | + $username = $data['username']; |
|
1006 | + |
|
1007 | + $subject = 'User '.$username.' logged in on '.$this->config->get('config_name').' admin panel'; |
|
1008 | + |
|
1009 | + return $subject; |
|
1010 | + } |
|
1011 | + |
|
1012 | + public function getDefaultLoginMessage($type_id, $data) |
|
1013 | + { |
|
1014 | + $message = 'Hello,<br/><br/>'; |
|
1015 | + $message .= 'We would like to notify you that user ' . $data['username'] . ' has just logged in to the admin panel of your store, ' . $data['store_name'] . ', using IP address ' . $data['ip_address'].'.<br/><br/>'; |
|
1016 | + $message .= 'If this is expected you need to do nothing about it. If you suspect a hacking attempt, please log in to your store\'s admin panel immediately and change your password at once.<br/><br/>'; |
|
1017 | + $message .= 'Best Regards,<br/><br/>'; |
|
1018 | + $message .= 'The ' . $data['store_name'] . ' team<br/><br/>'; |
|
1019 | + |
|
1020 | + return $message; |
|
1021 | + } |
|
1022 | + |
|
1023 | + public function getDefaultAffilateSubject($type_id, $data) |
|
1024 | + { |
|
1025 | + $this->load->language('mail/affiliate'); |
|
1026 | + |
|
1027 | + if ($type_id == 'affiliate_4') { |
|
1028 | + $subject = sprintf($this->language->get('text_approve_subject'), $this->config->get('config_name')); |
|
1029 | + } elseif ($type_id == 'affiliate_5') { |
|
1030 | + $subject = sprintf($this->language->get('text_commission_subject'), $this->config->get('config_name')); |
|
1031 | + } elseif ($type_id == 'affiliate_1') { |
|
1032 | + $subject = sprintf($this->language->get('text_register_subject'), $this->config->get('config_name')); |
|
1033 | + } elseif ($type_id == 'affiliate_3') { |
|
1034 | + $subject = sprintf($this->language->get('text_register_approve_subject'), $this->config->get('config_name')); |
|
1035 | + } elseif ($type_id == 'affiliate_2') { |
|
1036 | + // Reset Password Null |
|
1037 | + $subject = ''; |
|
1038 | + } else { |
|
1039 | + $subject = $this->config->get('config_name') . ' - Affilate Mail'; |
|
1040 | + } |
|
1041 | + |
|
1042 | + return $subject; |
|
1043 | + } |
|
1044 | + |
|
1045 | + public function getDefaultAffilateMessage($type_id, $data) |
|
1046 | + { |
|
1047 | + $this->load->language('mail/affiliate'); |
|
1048 | + |
|
1049 | + if ($type_id == 'affiliate_4') { |
|
1050 | + $message = sprintf($this->language->get('text_approve_welcome'), $this->config->get('config_name')) . "\n\n"; |
|
1051 | + $message .= $this->language->get('text_approve_login') . "\n"; |
|
1052 | + $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
|
1053 | + $message .= $store_url . 'index.php?route=affiliate/login' . "\n\n"; |
|
1054 | + $message .= $this->language->get('text_approve_services') . "\n\n"; |
|
1055 | + $message .= $this->language->get('text_approve_thanks') . "\n"; |
|
1056 | + $message .= $this->config->get('config_name'); |
|
1057 | + } elseif ($type_id == 'affiliate_5') { |
|
1058 | + $message = sprintf($this->language->get('text_commission_received'), $this->currency->format($data['amount'], $this->config->get('config_currency'))) . "\n\n"; |
|
1059 | + $message .= sprintf($this->language->get('text_commission_total'), $this->currency->format($this->getCommissionTotal($data['affiliate_id']), $this->config->get('config_currency'))); |
|
1060 | + } elseif ($type_id == 'affiliate_1') { |
|
1061 | + $message = sprintf($this->language->get('text_register_message'), $data['firstname'] . ' ' . $data['lastname'], $this->config->get('config_name')); |
|
1062 | + } elseif ($type_id == 'affiliate_3') { |
|
1063 | + $message = sprintf($this->language->get('text_register_approve_message'), $data['firstname'] . ' ' . $data['lastname'], $this->config->get('config_name')); |
|
1064 | + } elseif ($type_id == 'affiliate_2') { |
|
1065 | + // Reset Password Null |
|
1066 | + $message = sprintf($this->language->get('text_register_approve_subject'), $this->config->get('config_name'), $data['firstname'] . ' ' . $data['lastname']); |
|
1067 | + } else { |
|
1068 | + $message = 'Hi!' . "\n" . 'Welcome ' . $data['firstname'] . ' ' . $data['lastname']; |
|
1069 | + } |
|
1070 | + |
|
1071 | + return $message; |
|
1072 | + } |
|
1073 | + |
|
1074 | + // Affilate getComissionTotal Frontend & Backend |
|
1075 | + public function getCommissionTotal($affiliate_id) |
|
1076 | + { |
|
1077 | + $query = $this->db->query("SELECT SUM(amount) AS total FROM " . DB_PREFIX . "affiliate_commission WHERE affiliate_id = '" . (int)$affiliate_id . "'"); |
|
1078 | + |
|
1079 | + return $query->row['total']; |
|
1080 | + } |
|
1081 | + |
|
1082 | + public function getDefaultCustomerSubject($type_id, $data) |
|
1083 | + { |
|
1084 | + $this->load->language('mail/customer'); |
|
1085 | + |
|
1086 | + if ($type_id == 'customer_4') { |
|
1087 | + $subject = sprintf($this->language->get('text_approve_subject'), $this->config->get('config_name')); |
|
1088 | + } elseif ($type_id == 'customer_1') { |
|
1089 | + // Register |
|
1090 | + $subject = sprintf($this->language->get('text_register_subject'), $this->config->get('config_name')); |
|
1091 | + } elseif ($type_id == 'customer_2') { |
|
1092 | + // Aprove |
|
1093 | + $subject = sprintf($this->language->get('text_approve_wait_subject'), $this->config->get('config_name')); |
|
1094 | + } elseif ($type_id == 'customer_3') { |
|
1095 | + // Reset |
|
1096 | + $subject = sprintf($this->language->get('text_approve_subject'), $this->config->get('config_name')); |
|
1097 | + } elseif ($type_id == 'customer_5') { |
|
1098 | + $subject = $this->getDefaultVoucherSubject($type_id, $data); |
|
1099 | + } else { |
|
1100 | + $subject = $this->config->get('config_name') . ' - Customer Mail'; |
|
1101 | + } |
|
1102 | + |
|
1103 | + return $subject; |
|
1104 | + } |
|
1105 | + |
|
1106 | + public function getDefaultCustomerMessage($type_id, $data) |
|
1107 | + { |
|
1108 | + $this->load->language('mail/customer'); |
|
1109 | + |
|
1110 | + if ($type_id == 'customer_4') { |
|
1111 | + $store_name = $this->config->get('config_name'); |
|
1112 | + $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
|
1113 | + $store_url .= 'index.php?route=account/login'; |
|
1114 | + |
|
1115 | + $message = sprintf($this->language->get('text_approve_welcome'), $store_name) . "\n\n"; |
|
1116 | + $message .= $this->language->get('text_approve_login') . "\n"; |
|
1117 | + $message .= $store_url . "\n\n"; |
|
1118 | + $message .= $this->language->get('text_approve_services') . "\n\n"; |
|
1119 | + $message .= $this->language->get('text_approve_thanks') . "\n"; |
|
1120 | + $message .= $store_name; |
|
1121 | + } elseif ($type_id == 'customer_1') { |
|
1122 | + // Register |
|
1123 | + $message = sprintf($this->language->get('text_register_message'), $this->config->get('config_name')); |
|
1124 | + } elseif ($type_id == 'customer_2') { |
|
1125 | + // Aprove |
|
1126 | + $message = sprintf($this->language->get('text_register_message'), $this->config->get('config_name')); |
|
1127 | + } elseif ($type_id == 'customer_3') { |
|
1128 | + $message = ' --- '; |
|
1129 | + } elseif ($type_id == 'customer_5') { |
|
1130 | + $message = $this->getDefaultVoucherMessage($type_id, $data); |
|
1131 | + } else { |
|
1132 | + $message = 'Customer Mail Description'; |
|
1133 | + } |
|
1134 | + |
|
1135 | + return $message; |
|
1136 | + } |
|
1137 | + |
|
1138 | + public function getDefaultContactSubject($type_id, $data) |
|
1139 | + { |
|
1140 | + $this->load->language('information/contact'); |
|
1141 | + |
|
1142 | + $subject = sprintf($this->language->get('email_subject'), $data['name']); |
|
1143 | + |
|
1144 | + return $subject; |
|
1145 | + } |
|
1146 | + |
|
1147 | + public function getDefaultContactMessage($type_id, $data) |
|
1148 | + { |
|
1149 | + return strip_tags($data['enquiry']); |
|
1150 | + } |
|
1151 | + |
|
1152 | + public function getDefaultOrderSubject($type_id, $data) |
|
1153 | + { |
|
1154 | + $this->load->language('mail/order'); |
|
1155 | + |
|
1156 | + $subject = sprintf($this->language->get('text_new_subject'), $data['order_info']['store_name'], $data['order_info']['order_id']); |
|
1157 | + |
|
1158 | + return $subject; |
|
1159 | + } |
|
1160 | + |
|
1161 | + public function getDefaultOrderMessage($type_id, $data) |
|
1162 | + { |
|
1163 | + $this->load->language('mail/order'); |
|
1164 | + |
|
1165 | + foreach ($data as $dataKey => $dataValue) { |
|
1166 | + $$dataKey = $dataValue; |
|
1167 | + } |
|
1168 | + |
|
1169 | + // HTML Mail |
|
1170 | + $html_data = array(); |
|
1171 | + |
|
1172 | + $html_data['title'] = sprintf($this->language->get('text_new_subject'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'), $order_info['order_id']); |
|
1173 | + |
|
1174 | + $html_data['text_greeting'] = sprintf($this->language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8')); |
|
1175 | + $html_data['text_link'] = $this->language->get('text_new_link'); |
|
1176 | + $html_data['text_download'] = $this->language->get('text_new_download'); |
|
1177 | + $html_data['text_order_detail'] = $this->language->get('text_new_order_detail'); |
|
1178 | + $html_data['text_instruction'] = $this->language->get('text_new_instruction'); |
|
1179 | + $html_data['text_order_id'] = $this->language->get('text_new_order_id'); |
|
1180 | + $html_data['text_date_added'] = $this->language->get('text_new_date_added'); |
|
1181 | + $html_data['text_payment_method'] = $this->language->get('text_new_payment_method'); |
|
1182 | + $html_data['text_shipping_method'] = $this->language->get('text_new_shipping_method'); |
|
1183 | + $html_data['text_email'] = $this->language->get('text_new_email'); |
|
1184 | + $html_data['text_telephone'] = $this->language->get('text_new_telephone'); |
|
1185 | + $html_data['text_ip'] = $this->language->get('text_new_ip'); |
|
1186 | + $html_data['text_order_status'] = $this->language->get('text_new_order_status'); |
|
1187 | + $html_data['text_payment_address'] = $this->language->get('text_new_payment_address'); |
|
1188 | + $html_data['text_shipping_address'] = $this->language->get('text_new_shipping_address'); |
|
1189 | + $html_data['text_product'] = $this->language->get('text_new_product'); |
|
1190 | + $html_data['text_model'] = $this->language->get('text_new_model'); |
|
1191 | + $html_data['text_quantity'] = $this->language->get('text_new_quantity'); |
|
1192 | + $html_data['text_price'] = $this->language->get('text_new_price'); |
|
1193 | + $html_data['text_total'] = $this->language->get('text_new_total'); |
|
1194 | + $html_data['text_footer'] = $this->language->get('text_new_footer'); |
|
1195 | + |
|
1196 | + $html_data['logo'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo'); |
|
1197 | + $html_data['store_name'] = $order_info['store_name']; |
|
1198 | + $html_data['store_url'] = $order_info['store_url']; |
|
1199 | + $html_data['customer_id'] = $order_info['customer_id']; |
|
1200 | + $html_data['link'] = $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_info['order_id']; |
|
1201 | + |
|
1202 | + if (isset($download_status) && $download_status) { |
|
1203 | + $html_data['download'] = $order_info['store_url'] . 'index.php?route=account/download'; |
|
1204 | + } else { |
|
1205 | + $html_data['download'] = ''; |
|
1206 | + } |
|
1207 | + |
|
1208 | + $html_data['order_id'] = $order_info['order_id']; |
|
1209 | + $html_data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added'])); |
|
1210 | + $html_data['payment_method'] = $order_info['payment_method']; |
|
1211 | + $html_data['shipping_method'] = $order_info['shipping_method']; |
|
1212 | + $html_data['email'] = $order_info['email']; |
|
1213 | + $html_data['telephone'] = $order_info['telephone']; |
|
1214 | + $html_data['ip'] = $order_info['ip']; |
|
1215 | + $html_data['order_status'] = $order_status; |
|
1216 | + |
|
1217 | + if ($comment && $notify) { |
|
1218 | + $html_data['comment'] = nl2br($comment); |
|
1219 | + } else { |
|
1220 | + $html_data['comment'] = ''; |
|
1221 | + } |
|
1222 | + |
|
1223 | + if ($order_info['payment_address_format']) { |
|
1224 | + $format = $order_info['payment_address_format']; |
|
1225 | + } else { |
|
1226 | + $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; |
|
1227 | + } |
|
1228 | + |
|
1229 | + $find = array( |
|
1230 | + '{firstname}', |
|
1231 | + '{lastname}', |
|
1232 | + '{company}', |
|
1233 | + '{address_1}', |
|
1234 | + '{address_2}', |
|
1235 | + '{city}', |
|
1236 | + '{postcode}', |
|
1237 | + '{zone}', |
|
1238 | + '{zone_code}', |
|
1239 | + '{country}' |
|
1240 | + ); |
|
1241 | + |
|
1242 | + $replace = array( |
|
1243 | + 'firstname' => $order_info['payment_firstname'], |
|
1244 | + 'lastname' => $order_info['payment_lastname'], |
|
1245 | + 'company' => $order_info['payment_company'], |
|
1246 | + 'address_1' => $order_info['payment_address_1'], |
|
1247 | + 'address_2' => $order_info['payment_address_2'], |
|
1248 | + 'city' => $order_info['payment_city'], |
|
1249 | + 'postcode' => $order_info['payment_postcode'], |
|
1250 | + 'zone' => $order_info['payment_zone'], |
|
1251 | + 'zone_code' => $order_info['payment_zone_code'], |
|
1252 | + 'country' => $order_info['payment_country'] |
|
1253 | + ); |
|
1254 | + |
|
1255 | + $html_data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); |
|
1256 | + |
|
1257 | + if ($order_info['shipping_address_format']) { |
|
1258 | + $format = $order_info['shipping_address_format']; |
|
1259 | + } else { |
|
1260 | + $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; |
|
1261 | + } |
|
1262 | + |
|
1263 | + $find = array( |
|
1264 | + '{firstname}', |
|
1265 | + '{lastname}', |
|
1266 | + '{company}', |
|
1267 | + '{address_1}', |
|
1268 | + '{address_2}', |
|
1269 | + '{city}', |
|
1270 | + '{postcode}', |
|
1271 | + '{zone}', |
|
1272 | + '{zone_code}', |
|
1273 | + '{country}' |
|
1274 | + ); |
|
1275 | + |
|
1276 | + $replace = array( |
|
1277 | + 'firstname' => $order_info['shipping_firstname'], |
|
1278 | + 'lastname' => $order_info['shipping_lastname'], |
|
1279 | + 'company' => $order_info['shipping_company'], |
|
1280 | + 'address_1' => $order_info['shipping_address_1'], |
|
1281 | + 'address_2' => $order_info['shipping_address_2'], |
|
1282 | + 'city' => $order_info['shipping_city'], |
|
1283 | + 'postcode' => $order_info['shipping_postcode'], |
|
1284 | + 'zone' => $order_info['shipping_zone'], |
|
1285 | + 'zone_code' => $order_info['shipping_zone_code'], |
|
1286 | + 'country' => $order_info['shipping_country'] |
|
1287 | + ); |
|
1288 | + |
|
1289 | + $html_data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format)))); |
|
1290 | + |
|
1291 | + |
|
1292 | + $this->load->model('tool/upload'); |
|
1293 | + |
|
1294 | + // Products |
|
1295 | + $html_data['products'] = array(); |
|
1296 | + |
|
1297 | + $order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
1298 | + |
|
1299 | + foreach ($order_product_query->rows as $product) { |
|
1300 | + $option_data = array(); |
|
1301 | + |
|
1302 | + $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_info['order_id'] . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'"); |
|
1303 | + |
|
1304 | + foreach ($order_option_query->rows as $option) { |
|
1305 | + if ($option['type'] != 'file') { |
|
1306 | + $value = $option['value']; |
|
1307 | + } else { |
|
1308 | + $upload_info = $this->model_tool_upload->getUploadByCode($option['value']); |
|
1309 | + |
|
1310 | + if ($upload_info) { |
|
1311 | + $value = $upload_info['name']; |
|
1312 | + } else { |
|
1313 | + $value = ''; |
|
1314 | + } |
|
1315 | + } |
|
1316 | + |
|
1317 | + $option_data[] = array( |
|
1318 | + 'name' => $option['name'], |
|
1319 | + 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) |
|
1320 | + ); |
|
1321 | + } |
|
1322 | + |
|
1323 | + $html_data['products'][] = array( |
|
1324 | + 'name' => $product['name'], |
|
1325 | + 'model' => $product['model'], |
|
1326 | + 'option' => $option_data, |
|
1327 | + 'quantity' => $product['quantity'], |
|
1328 | + 'price' => $this->currency->format($product['price'] + ($this->config->get('config_tax') ? $product['tax'] : 0), $order_info['currency_code'], $order_info['currency_value']), |
|
1329 | + 'total' => $this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']) |
|
1330 | + ); |
|
1331 | + } |
|
1332 | + |
|
1333 | + // Vouchers |
|
1334 | + $html_data['vouchers'] = array(); |
|
1335 | + |
|
1336 | + |
|
1337 | + $order_voucher_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
1338 | + |
|
1339 | + foreach ($order_voucher_query->rows as $voucher) { |
|
1340 | + $html_data['vouchers'][] = array( |
|
1341 | + 'description' => $voucher['description'], |
|
1342 | + 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']), |
|
1343 | + ); |
|
1344 | + } |
|
1345 | + |
|
1346 | + // Order Totals |
|
1347 | + $order_total_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int)$order_info['order_id'] . "' ORDER BY sort_order ASC"); |
|
1348 | + |
|
1349 | + foreach ($order_total_query->rows as $total) { |
|
1350 | + $html_data['totals'][] = array( |
|
1351 | + 'title' => $total['title'], |
|
1352 | + 'text' => $this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), |
|
1353 | + ); |
|
1354 | + } |
|
1355 | + |
|
1356 | + if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) { |
|
1357 | + $html = $this->load->view($this->config->get('config_template') . '/template/mail/order.tpl', $html_data); |
|
1358 | + } else { |
|
1359 | + $html = $this->load->view('default/template/mail/order.tpl', $html_data); |
|
1360 | + } |
|
1361 | + |
|
1362 | + return $html; |
|
1363 | + } |
|
1364 | 1364 | |
1365 | - public function getDefaultReturnSubject($type_id, $data) |
|
1366 | - { |
|
1367 | - $this->load->language('mail/return'); |
|
1368 | - |
|
1369 | - $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name')); |
|
1370 | - |
|
1371 | - return $subject; |
|
1372 | - } |
|
1373 | - |
|
1374 | - public function getDefaultReturnMessage($type_id, $data) |
|
1375 | - { |
|
1376 | - $this->load->language('mail/return'); |
|
1377 | - |
|
1378 | - $message = $this->language->get('text_request') . "\n"; |
|
1379 | - $message .= "\n"; |
|
1380 | - $message .= sprintf($this->language->get('text_order_id'), $data['order_id']) . "\n"; |
|
1381 | - $message .= sprintf($this->language->get('text_date_ordered'), $this->db->escape(strip_tags($data['date_ordered']))) . "\n"; |
|
1382 | - $message .= sprintf($this->language->get('text_customer'), $this->db->escape(strip_tags($data['firstname'])), $this->db->escape(strip_tags($data['lastname']))) . "\n"; |
|
1383 | - $message .= sprintf($this->language->get('text_email'), $this->db->escape(strip_tags($data['email']))) . "\n"; |
|
1384 | - $message .= sprintf($this->language->get('text_telephone'), $this->db->escape(strip_tags($data['telephone']))) . "\n"; |
|
1385 | - $message .= "\n"; |
|
1386 | - $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($data['product']))) . "\n"; |
|
1387 | - $message .= sprintf($this->language->get('text_model'), $this->db->escape(strip_tags($data['model']))) . "\n"; |
|
1388 | - $message .= sprintf($this->language->get('text_quantity'), $data['quantity']) . "\n"; |
|
1389 | - $message .= "\n"; |
|
1390 | - $message .= sprintf($this->language->get('text_return_reason'), $data['return_reason']) . "\n"; |
|
1391 | - $message .= sprintf($this->language->get('text_opened'), ($data['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no'))) . "\n"; |
|
1392 | - $message .= "\n"; |
|
1393 | - $message .= strip_tags($data['comment']); |
|
1394 | - |
|
1395 | - return nl2br($message); |
|
1396 | - } |
|
1397 | - |
|
1398 | - public function getDefaultReviewSubject($type_id, $data) |
|
1399 | - { |
|
1400 | - $this->load->language('mail/review'); |
|
1401 | - |
|
1402 | - $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name')); |
|
1403 | - |
|
1404 | - return $subject; |
|
1405 | - } |
|
1406 | - |
|
1407 | - public function getDefaultReviewMessage($type_id, $data) |
|
1408 | - { |
|
1409 | - $this->load->language('mail/review'); |
|
1410 | - $this->load->model('catalog/product'); |
|
1411 | - |
|
1412 | - $product_info = $this->model_catalog_product->getProduct($data['product_id']); |
|
1413 | - |
|
1414 | - $message = $this->language->get('text_waiting') . "\n"; |
|
1415 | - $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name']))) . "\n"; |
|
1416 | - $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n"; |
|
1417 | - $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n"; |
|
1418 | - $message .= $this->language->get('text_review') . "\n"; |
|
1419 | - $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n"; |
|
1420 | - |
|
1421 | - return $message; |
|
1422 | - } |
|
1365 | + public function getDefaultReturnSubject($type_id, $data) |
|
1366 | + { |
|
1367 | + $this->load->language('mail/return'); |
|
1368 | + |
|
1369 | + $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name')); |
|
1370 | + |
|
1371 | + return $subject; |
|
1372 | + } |
|
1373 | + |
|
1374 | + public function getDefaultReturnMessage($type_id, $data) |
|
1375 | + { |
|
1376 | + $this->load->language('mail/return'); |
|
1377 | + |
|
1378 | + $message = $this->language->get('text_request') . "\n"; |
|
1379 | + $message .= "\n"; |
|
1380 | + $message .= sprintf($this->language->get('text_order_id'), $data['order_id']) . "\n"; |
|
1381 | + $message .= sprintf($this->language->get('text_date_ordered'), $this->db->escape(strip_tags($data['date_ordered']))) . "\n"; |
|
1382 | + $message .= sprintf($this->language->get('text_customer'), $this->db->escape(strip_tags($data['firstname'])), $this->db->escape(strip_tags($data['lastname']))) . "\n"; |
|
1383 | + $message .= sprintf($this->language->get('text_email'), $this->db->escape(strip_tags($data['email']))) . "\n"; |
|
1384 | + $message .= sprintf($this->language->get('text_telephone'), $this->db->escape(strip_tags($data['telephone']))) . "\n"; |
|
1385 | + $message .= "\n"; |
|
1386 | + $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($data['product']))) . "\n"; |
|
1387 | + $message .= sprintf($this->language->get('text_model'), $this->db->escape(strip_tags($data['model']))) . "\n"; |
|
1388 | + $message .= sprintf($this->language->get('text_quantity'), $data['quantity']) . "\n"; |
|
1389 | + $message .= "\n"; |
|
1390 | + $message .= sprintf($this->language->get('text_return_reason'), $data['return_reason']) . "\n"; |
|
1391 | + $message .= sprintf($this->language->get('text_opened'), ($data['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no'))) . "\n"; |
|
1392 | + $message .= "\n"; |
|
1393 | + $message .= strip_tags($data['comment']); |
|
1394 | + |
|
1395 | + return nl2br($message); |
|
1396 | + } |
|
1397 | + |
|
1398 | + public function getDefaultReviewSubject($type_id, $data) |
|
1399 | + { |
|
1400 | + $this->load->language('mail/review'); |
|
1401 | + |
|
1402 | + $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name')); |
|
1403 | + |
|
1404 | + return $subject; |
|
1405 | + } |
|
1406 | + |
|
1407 | + public function getDefaultReviewMessage($type_id, $data) |
|
1408 | + { |
|
1409 | + $this->load->language('mail/review'); |
|
1410 | + $this->load->model('catalog/product'); |
|
1411 | + |
|
1412 | + $product_info = $this->model_catalog_product->getProduct($data['product_id']); |
|
1413 | + |
|
1414 | + $message = $this->language->get('text_waiting') . "\n"; |
|
1415 | + $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name']))) . "\n"; |
|
1416 | + $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n"; |
|
1417 | + $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n"; |
|
1418 | + $message .= $this->language->get('text_review') . "\n"; |
|
1419 | + $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n"; |
|
1420 | + |
|
1421 | + return $message; |
|
1422 | + } |
|
1423 | 1423 | |
1424 | - public function getDefaultStockSubject($type_id, $data) |
|
1425 | - { |
|
1426 | - $this->load->language('mail/stock'); |
|
1427 | - |
|
1428 | - $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'), $data['outofstock']); |
|
1429 | - |
|
1430 | - return $subject; |
|
1431 | - } |
|
1424 | + public function getDefaultStockSubject($type_id, $data) |
|
1425 | + { |
|
1426 | + $this->load->language('mail/stock'); |
|
1432 | 1427 | |
1433 | - public function getDefaultStockMessage($type_id, $data) |
|
1434 | - { |
|
1435 | - $this->load->language('mail/stock'); |
|
1428 | + $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'), $data['outofstock']); |
|
1436 | 1429 | |
1437 | - $message = sprintf($this->language->get('text_notify'), $data['outofstock'], $this->config->get('config_name')) . "\n"; |
|
1438 | - $message .= $this->language->get('text_view') . "\n"; |
|
1439 | - $message .= sprintf($this->language->get('text_signature'), $this->config->get('config_name')); |
|
1430 | + return $subject; |
|
1431 | + } |
|
1440 | 1432 | |
1441 | - return nl2br($message); |
|
1442 | - } |
|
1433 | + public function getDefaultStockMessage($type_id, $data) |
|
1434 | + { |
|
1435 | + $this->load->language('mail/stock'); |
|
1443 | 1436 | |
1444 | - public function getDefaultVoucherSubject($type_id, $data) |
|
1445 | - { |
|
1446 | - $this->load->language('mail/review'); |
|
1437 | + $message = sprintf($this->language->get('text_notify'), $data['outofstock'], $this->config->get('config_name')) . "\n"; |
|
1438 | + $message .= $this->language->get('text_view') . "\n"; |
|
1439 | + $message .= sprintf($this->language->get('text_signature'), $this->config->get('config_name')); |
|
1447 | 1440 | |
1448 | - $subject = sprintf($this->language->get('text_subject'), $data['name']); |
|
1441 | + return nl2br($message); |
|
1442 | + } |
|
1449 | 1443 | |
1450 | - return $subject; |
|
1451 | - } |
|
1444 | + public function getDefaultVoucherSubject($type_id, $data) |
|
1445 | + { |
|
1446 | + $this->load->language('mail/review'); |
|
1452 | 1447 | |
1453 | - public function getDefaultVoucherMessage($type_id, $data) |
|
1454 | - { |
|
1455 | - $this->load->language('mail/voucher'); |
|
1448 | + $subject = sprintf($this->language->get('text_subject'), $data['name']); |
|
1456 | 1449 | |
1457 | - $voucher_data = array(); |
|
1458 | - |
|
1459 | - $voucher_data['title'] = sprintf($this->language->get('text_subject'), $data['name']); |
|
1460 | - |
|
1461 | - $voucher_data['text_greeting'] = sprintf($this->language->get('text_greeting'), $data['amount']); |
|
1462 | - $voucher_data['text_from'] = sprintf($this->language->get('text_from'), $data['name']); |
|
1463 | - $voucher_data['text_message'] = $this->language->get('text_message'); |
|
1464 | - $voucher_data['text_redeem'] = sprintf($this->language->get('text_redeem'), $data['code']); |
|
1465 | - $voucher_data['text_footer'] = $this->language->get('text_footer'); |
|
1466 | - |
|
1467 | - if (is_file(DIR_IMAGE . $data['image'])) { |
|
1468 | - $voucher_data['image'] = $this->config->get('config_url') . 'image/' . $data['image']; |
|
1469 | - } else { |
|
1470 | - $voucher_data['image'] = ''; |
|
1471 | - } |
|
1472 | - |
|
1473 | - $voucher_data['store_name'] = $data['store_name']; |
|
1474 | - $voucher_data['store_url'] = $data['store_href']; |
|
1475 | - $voucher_data['message'] = $data['message']; |
|
1476 | - |
|
1477 | - if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) { |
|
1478 | - $message = $this->load->view($this->config->get('config_template') . '/template/mail/voucher.tpl', $voucher_data); |
|
1479 | - } else { |
|
1480 | - $message = $this->load->view('default/template/mail/voucher.tpl', $voucher_data); |
|
1481 | - } |
|
1482 | - |
|
1483 | - return $message; |
|
1484 | - } |
|
1485 | - |
|
1486 | - public function imageResize($filename, $width, $height) |
|
1487 | - { |
|
1488 | - if (!is_file(DIR_IMAGE . $filename)) { |
|
1489 | - return; |
|
1490 | - } |
|
1491 | - |
|
1492 | - $extension = pathinfo($filename, PATHINFO_EXTENSION); |
|
1493 | - |
|
1494 | - $old_image = $filename; |
|
1495 | - $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension; |
|
1496 | - |
|
1497 | - if (!is_file(DIR_IMAGE . $new_image) || (filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image))) { |
|
1498 | - $path = ''; |
|
1499 | - |
|
1500 | - $directories = explode('/', dirname(str_replace('../', '', $new_image))); |
|
1501 | - |
|
1502 | - foreach ($directories as $directory) { |
|
1503 | - $path = $path . '/' . $directory; |
|
1504 | - |
|
1505 | - if (!is_dir(DIR_IMAGE . $path)) { |
|
1506 | - $this->filesystem->mkdir(DIR_IMAGE . $path); |
|
1507 | - } |
|
1508 | - } |
|
1509 | - |
|
1510 | - list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image); |
|
1511 | - |
|
1512 | - |
|
1513 | - if ($width_orig != $width || $height_orig != $height) { |
|
1514 | - $image = new Image(DIR_IMAGE . $old_image); |
|
1515 | - $image->resize($width, $height); |
|
1516 | - $image->save(DIR_IMAGE . $new_image); |
|
1517 | - } else { |
|
1518 | - copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image); |
|
1519 | - } |
|
1520 | - } |
|
1521 | - |
|
1522 | - if ($_SERVER['HTTPS']) { |
|
1523 | - return HTTPS_IMAGE . $new_image; |
|
1524 | - } else { |
|
1525 | - return HTTP_IMAGE . $new_image; |
|
1526 | - } |
|
1527 | - } |
|
1528 | - |
|
1529 | - public function getUploadByCode($code) |
|
1530 | - { |
|
1531 | - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "upload` WHERE code = '" . $this->db->escape($code) . "'"); |
|
1532 | - |
|
1533 | - return $query->row; |
|
1534 | - } |
|
1535 | - |
|
1536 | - public function getProduct($product_id) |
|
1537 | - { |
|
1538 | - $query = $this->db->query("SELECT DISTINCT p.*, pd.*, md.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer_description md ON (p.manufacturer_id = md.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"); |
|
1539 | - |
|
1540 | - if ($query->num_rows) { |
|
1541 | - return array( |
|
1542 | - 'product_id' => $query->row['product_id'], |
|
1543 | - 'name' => $query->row['name'], |
|
1544 | - 'description' => $query->row['description'], |
|
1545 | - 'meta_title' => $query->row['meta_title'], |
|
1546 | - 'meta_description' => $query->row['meta_description'], |
|
1547 | - 'meta_keyword' => $query->row['meta_keyword'], |
|
1548 | - 'tag' => $query->row['tag'], |
|
1549 | - 'model' => $query->row['model'], |
|
1550 | - 'sku' => $query->row['sku'], |
|
1551 | - 'upc' => $query->row['upc'], |
|
1552 | - 'ean' => $query->row['ean'], |
|
1553 | - 'jan' => $query->row['jan'], |
|
1554 | - 'isbn' => $query->row['isbn'], |
|
1555 | - 'mpn' => $query->row['mpn'], |
|
1556 | - 'location' => $query->row['location'], |
|
1557 | - 'quantity' => $query->row['quantity'], |
|
1558 | - 'stock_status' => $query->row['stock_status'], |
|
1559 | - 'image' => $query->row['image'], |
|
1560 | - 'manufacturer_id' => $query->row['manufacturer_id'], |
|
1561 | - 'manufacturer' => $query->row['manufacturer'], |
|
1562 | - 'price' => ($query->row['discount'] ? $query->row['discount'] : $query->row['price']), |
|
1563 | - 'special' => $query->row['special'], |
|
1564 | - 'reward' => $query->row['reward'], |
|
1565 | - 'points' => $query->row['points'], |
|
1566 | - 'tax_class_id' => $query->row['tax_class_id'], |
|
1567 | - 'date_available' => $query->row['date_available'], |
|
1568 | - 'weight' => $query->row['weight'], |
|
1569 | - 'weight_class_id' => $query->row['weight_class_id'], |
|
1570 | - 'length' => $query->row['length'], |
|
1571 | - 'width' => $query->row['width'], |
|
1572 | - 'height' => $query->row['height'], |
|
1573 | - 'length_class_id' => $query->row['length_class_id'], |
|
1574 | - 'subtract' => $query->row['subtract'], |
|
1575 | - 'rating' => round($query->row['rating']), |
|
1576 | - 'reviews' => $query->row['reviews'] ? $query->row['reviews'] : 0, |
|
1577 | - 'minimum' => $query->row['minimum'], |
|
1578 | - 'sort_order' => $query->row['sort_order'], |
|
1579 | - 'status' => $query->row['status'], |
|
1580 | - 'date_added' => $query->row['date_added'], |
|
1581 | - 'date_modified' => $query->row['date_modified'], |
|
1582 | - 'viewed' => $query->row['viewed'] |
|
1583 | - ); |
|
1584 | - } else { |
|
1585 | - return false; |
|
1586 | - } |
|
1587 | - } |
|
1450 | + return $subject; |
|
1451 | + } |
|
1452 | + |
|
1453 | + public function getDefaultVoucherMessage($type_id, $data) |
|
1454 | + { |
|
1455 | + $this->load->language('mail/voucher'); |
|
1456 | + |
|
1457 | + $voucher_data = array(); |
|
1458 | + |
|
1459 | + $voucher_data['title'] = sprintf($this->language->get('text_subject'), $data['name']); |
|
1460 | + |
|
1461 | + $voucher_data['text_greeting'] = sprintf($this->language->get('text_greeting'), $data['amount']); |
|
1462 | + $voucher_data['text_from'] = sprintf($this->language->get('text_from'), $data['name']); |
|
1463 | + $voucher_data['text_message'] = $this->language->get('text_message'); |
|
1464 | + $voucher_data['text_redeem'] = sprintf($this->language->get('text_redeem'), $data['code']); |
|
1465 | + $voucher_data['text_footer'] = $this->language->get('text_footer'); |
|
1466 | + |
|
1467 | + if (is_file(DIR_IMAGE . $data['image'])) { |
|
1468 | + $voucher_data['image'] = $this->config->get('config_url') . 'image/' . $data['image']; |
|
1469 | + } else { |
|
1470 | + $voucher_data['image'] = ''; |
|
1471 | + } |
|
1472 | + |
|
1473 | + $voucher_data['store_name'] = $data['store_name']; |
|
1474 | + $voucher_data['store_url'] = $data['store_href']; |
|
1475 | + $voucher_data['message'] = $data['message']; |
|
1476 | + |
|
1477 | + if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) { |
|
1478 | + $message = $this->load->view($this->config->get('config_template') . '/template/mail/voucher.tpl', $voucher_data); |
|
1479 | + } else { |
|
1480 | + $message = $this->load->view('default/template/mail/voucher.tpl', $voucher_data); |
|
1481 | + } |
|
1482 | + |
|
1483 | + return $message; |
|
1484 | + } |
|
1485 | + |
|
1486 | + public function imageResize($filename, $width, $height) |
|
1487 | + { |
|
1488 | + if (!is_file(DIR_IMAGE . $filename)) { |
|
1489 | + return; |
|
1490 | + } |
|
1491 | + |
|
1492 | + $extension = pathinfo($filename, PATHINFO_EXTENSION); |
|
1493 | + |
|
1494 | + $old_image = $filename; |
|
1495 | + $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension; |
|
1496 | + |
|
1497 | + if (!is_file(DIR_IMAGE . $new_image) || (filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image))) { |
|
1498 | + $path = ''; |
|
1499 | + |
|
1500 | + $directories = explode('/', dirname(str_replace('../', '', $new_image))); |
|
1501 | + |
|
1502 | + foreach ($directories as $directory) { |
|
1503 | + $path = $path . '/' . $directory; |
|
1504 | + |
|
1505 | + if (!is_dir(DIR_IMAGE . $path)) { |
|
1506 | + $this->filesystem->mkdir(DIR_IMAGE . $path); |
|
1507 | + } |
|
1508 | + } |
|
1509 | + |
|
1510 | + list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image); |
|
1511 | + |
|
1512 | + |
|
1513 | + if ($width_orig != $width || $height_orig != $height) { |
|
1514 | + $image = new Image(DIR_IMAGE . $old_image); |
|
1515 | + $image->resize($width, $height); |
|
1516 | + $image->save(DIR_IMAGE . $new_image); |
|
1517 | + } else { |
|
1518 | + copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image); |
|
1519 | + } |
|
1520 | + } |
|
1521 | + |
|
1522 | + if ($_SERVER['HTTPS']) { |
|
1523 | + return HTTPS_IMAGE . $new_image; |
|
1524 | + } else { |
|
1525 | + return HTTP_IMAGE . $new_image; |
|
1526 | + } |
|
1527 | + } |
|
1528 | + |
|
1529 | + public function getUploadByCode($code) |
|
1530 | + { |
|
1531 | + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "upload` WHERE code = '" . $this->db->escape($code) . "'"); |
|
1532 | + |
|
1533 | + return $query->row; |
|
1534 | + } |
|
1535 | + |
|
1536 | + public function getProduct($product_id) |
|
1537 | + { |
|
1538 | + $query = $this->db->query("SELECT DISTINCT p.*, pd.*, md.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer_description md ON (p.manufacturer_id = md.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"); |
|
1539 | + |
|
1540 | + if ($query->num_rows) { |
|
1541 | + return array( |
|
1542 | + 'product_id' => $query->row['product_id'], |
|
1543 | + 'name' => $query->row['name'], |
|
1544 | + 'description' => $query->row['description'], |
|
1545 | + 'meta_title' => $query->row['meta_title'], |
|
1546 | + 'meta_description' => $query->row['meta_description'], |
|
1547 | + 'meta_keyword' => $query->row['meta_keyword'], |
|
1548 | + 'tag' => $query->row['tag'], |
|
1549 | + 'model' => $query->row['model'], |
|
1550 | + 'sku' => $query->row['sku'], |
|
1551 | + 'upc' => $query->row['upc'], |
|
1552 | + 'ean' => $query->row['ean'], |
|
1553 | + 'jan' => $query->row['jan'], |
|
1554 | + 'isbn' => $query->row['isbn'], |
|
1555 | + 'mpn' => $query->row['mpn'], |
|
1556 | + 'location' => $query->row['location'], |
|
1557 | + 'quantity' => $query->row['quantity'], |
|
1558 | + 'stock_status' => $query->row['stock_status'], |
|
1559 | + 'image' => $query->row['image'], |
|
1560 | + 'manufacturer_id' => $query->row['manufacturer_id'], |
|
1561 | + 'manufacturer' => $query->row['manufacturer'], |
|
1562 | + 'price' => ($query->row['discount'] ? $query->row['discount'] : $query->row['price']), |
|
1563 | + 'special' => $query->row['special'], |
|
1564 | + 'reward' => $query->row['reward'], |
|
1565 | + 'points' => $query->row['points'], |
|
1566 | + 'tax_class_id' => $query->row['tax_class_id'], |
|
1567 | + 'date_available' => $query->row['date_available'], |
|
1568 | + 'weight' => $query->row['weight'], |
|
1569 | + 'weight_class_id' => $query->row['weight_class_id'], |
|
1570 | + 'length' => $query->row['length'], |
|
1571 | + 'width' => $query->row['width'], |
|
1572 | + 'height' => $query->row['height'], |
|
1573 | + 'length_class_id' => $query->row['length_class_id'], |
|
1574 | + 'subtract' => $query->row['subtract'], |
|
1575 | + 'rating' => round($query->row['rating']), |
|
1576 | + 'reviews' => $query->row['reviews'] ? $query->row['reviews'] : 0, |
|
1577 | + 'minimum' => $query->row['minimum'], |
|
1578 | + 'sort_order' => $query->row['sort_order'], |
|
1579 | + 'status' => $query->row['status'], |
|
1580 | + 'date_added' => $query->row['date_added'], |
|
1581 | + 'date_modified' => $query->row['date_modified'], |
|
1582 | + 'viewed' => $query->row['viewed'] |
|
1583 | + ); |
|
1584 | + } else { |
|
1585 | + return false; |
|
1586 | + } |
|
1587 | + } |
|
1588 | 1588 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | { |
32 | 32 | $template = $this->getEmailTemplate($template_id); |
33 | 33 | |
34 | - $findFunctionName = 'get' . ucwords($type) . 'Find'; |
|
35 | - $replaceFunctionName = 'get' . ucwords($type) . 'Replace'; |
|
34 | + $findFunctionName = 'get'.ucwords($type).'Find'; |
|
35 | + $replaceFunctionName = 'get'.ucwords($type).'Replace'; |
|
36 | 36 | |
37 | 37 | $find = array(); |
38 | 38 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | { |
65 | 65 | $template = $this->getEmailTemplate($template_id); |
66 | 66 | |
67 | - $findFunctionName = 'get' . ucwords($type) . 'Find'; |
|
68 | - $replaceFunctionName = 'get' . ucwords($type) . 'Replace'; |
|
67 | + $findFunctionName = 'get'.ucwords($type).'Find'; |
|
68 | + $replaceFunctionName = 'get'.ucwords($type).'Replace'; |
|
69 | 69 | |
70 | 70 | $find = array(); |
71 | 71 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | $data['site_url'] = ($this->request->server['HTTPS']) ? HTTPS_SERVER : HTTP_SERVER; |
124 | 124 | |
125 | 125 | if (Client::isCatalog()) { |
126 | - if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/default.tpl')) { |
|
127 | - $message = $this->load->view($this->config->get('config_template') . '/template/mail/default.tpl', $data); |
|
126 | + if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/mail/default.tpl')) { |
|
127 | + $message = $this->load->view($this->config->get('config_template').'/template/mail/default.tpl', $data); |
|
128 | 128 | } else { |
129 | 129 | $message = $this->load->view('default/template/mail/default.tpl', $data); |
130 | 130 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | //Mail Text |
139 | 139 | public function getText($type, $template_id, $data) |
140 | 140 | { |
141 | - $findName = 'get' . ucwords($type) . 'Text'; |
|
141 | + $findName = 'get'.ucwords($type).'Text'; |
|
142 | 142 | |
143 | 143 | return $this->$findName($template_id, $data); |
144 | 144 | } |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | { |
149 | 149 | $item = explode("_", $email_template); |
150 | 150 | |
151 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "email AS e LEFT JOIN " . DB_PREFIX . "email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}' AND ed.language_id = '{$this->config->get('config_language_id')}'"); |
|
151 | + $query = $this->db->query("SELECT * FROM ".DB_PREFIX."email AS e LEFT JOIN ".DB_PREFIX."email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}' AND ed.language_id = '{$this->config->get('config_language_id')}'"); |
|
152 | 152 | |
153 | 153 | if (!$query->num_rows) { |
154 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "email AS e LEFT JOIN " . DB_PREFIX . "email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}'"); |
|
154 | + $query = $this->db->query("SELECT * FROM ".DB_PREFIX."email AS e LEFT JOIN ".DB_PREFIX."email_description AS ed ON ed.email_id = e.id WHERE e.type = '{$item[0]}' AND e.text_id = '{$item[1]}'"); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | foreach ($query->rows as $result) { |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | { |
175 | 175 | $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
176 | 176 | $store_name = $this->config->get('config_name'); |
177 | - $store_logo = HTTPS_IMAGE . $this->config->get('config_logo'); |
|
177 | + $store_logo = HTTPS_IMAGE.$this->config->get('config_logo'); |
|
178 | 178 | |
179 | - return '<a href="' . $store_url . '" title="' . $store_name . '"><img src="' . $store_logo . '"></a>'; |
|
179 | + return '<a href="'.$store_url.'" title="'.$store_name.'"><img src="'.$store_logo.'"></a>'; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // Admin Login |
183 | 183 | public function getLoginFind() |
184 | 184 | { |
185 | - $result = array( '{store_logo}', '{username}', '{store_name}', '{ip_address}' ); |
|
185 | + $result = array('{store_logo}', '{username}', '{store_name}', '{ip_address}'); |
|
186 | 186 | |
187 | 187 | return $result; |
188 | 188 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | // Affilate |
203 | 203 | public function getAffiliateFind() |
204 | 204 | { |
205 | - $result = array( '{store_logo}', '{firstname}', '{lastname}', '{date}', '{store_name}', '{description}', '{order_id}', '{amount}', '{total}', '{email}','{password}', '{affiliate_code}', '{account_href}' ); |
|
205 | + $result = array('{store_logo}', '{firstname}', '{lastname}', '{date}', '{store_name}', '{description}', '{order_id}', '{amount}', '{total}', '{email}', '{password}', '{affiliate_code}', '{account_href}'); |
|
206 | 206 | |
207 | 207 | return $result; |
208 | 208 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | // Customer |
232 | 232 | public function getCustomerFind() |
233 | 233 | { |
234 | - $result = array( '{store_logo}', '{firstname}', '{lastname}', '{credit}', '{received_credit}', '{total_credit}', '{date}', '{store_name}', '{email}', '{password}', '{account_href}', '{activate_href}' ); |
|
234 | + $result = array('{store_logo}', '{firstname}', '{lastname}', '{credit}', '{received_credit}', '{total_credit}', '{date}', '{store_name}', '{email}', '{password}', '{account_href}', '{activate_href}'); |
|
235 | 235 | |
236 | 236 | return $result; |
237 | 237 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | 'email' => $data['email'], |
251 | 251 | 'password' => $data['password'], |
252 | 252 | 'account_href' => $this->url->link('account/login', '', 'SSL'), |
253 | - 'activate_href' => (!empty($data['confirm_code'])) ? $this->url->link('account/activate', 'passkey=' . $data['confirm_code'], 'SSL') : '' |
|
253 | + 'activate_href' => (!empty($data['confirm_code'])) ? $this->url->link('account/activate', 'passkey='.$data['confirm_code'], 'SSL') : '' |
|
254 | 254 | ); |
255 | 255 | |
256 | 256 | return $result; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // Contact ( Information ) |
260 | 260 | public function getContactFind() |
261 | 261 | { |
262 | - $result = array( '{store_logo}', '{name}', '{email}', '{store_name}', '{enquiry}' ); |
|
262 | + $result = array('{store_logo}', '{name}', '{email}', '{store_name}', '{enquiry}'); |
|
263 | 263 | |
264 | 264 | return $result; |
265 | 265 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | // Order |
281 | 281 | public function getOrderAllFind() |
282 | 282 | { |
283 | - $result = array ( |
|
283 | + $result = array( |
|
284 | 284 | '{store_logo}', '{firstname}', '{lastname}', '{delivery_address}', '{shipping_address}', '{payment_address}', '{order_date}', '{product:start}', '{product:stop}', |
285 | 285 | '{total:start}', '{total:stop}', '{voucher:start}', '{voucher:stop}', '{special}', '{date}', '{payment}', '{shipment}', '{order_id}', '{total}', '{invoice_number}', |
286 | 286 | '{order_href}', '{store_url}', '{status_name}', '{store_name}', '{ip}', '{comment:start}', '{comment:stop}', '{comment}', '{sub_total}', '{shipping_cost}', |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | // Total |
359 | 359 | preg_match('/{total:start}(.*){total:stop}/Uis', $emailTemplate['description'], $template_total); |
360 | 360 | |
361 | - $order_total = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
361 | + $order_total = $this->db->query("SELECT * FROM `".DB_PREFIX."order_total` WHERE order_id = '".(int)$order_info['order_id']."'"); |
|
362 | 362 | $getTotal = $order_total->rows; |
363 | 363 | |
364 | 364 | if (sizeof($template_total) > 0) { |
@@ -388,8 +388,8 @@ discard block |
||
388 | 388 | 'shipment' => $order_info['shipping_method'], |
389 | 389 | 'order_id' => $order_info['order_id'], |
390 | 390 | 'total' => $this->currency->format($order_info['total'], $order_info['currency_code'], $order_info['currency_value']), |
391 | - 'invoice_number' => $order_info['invoice_prefix'] . $invoice_no, |
|
392 | - 'order_href' => '<a href="' . $order_href . '" target="_blank">' . $order_href . '</a>', |
|
391 | + 'invoice_number' => $order_info['invoice_prefix'].$invoice_no, |
|
392 | + 'order_href' => '<a href="'.$order_href.'" target="_blank">'.$order_href.'</a>', |
|
393 | 393 | 'store_url' => $order_info['store_url'], |
394 | 394 | 'status_name' => $order_status, |
395 | 395 | 'store_name' => $order_info['store_name'], |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | public function getInvoiceFind() |
415 | 415 | { |
416 | 416 | $result = array( |
417 | - '{store_logo}','{invoice_id}', '{invoice_date}', '{invoice_no}', '{invoice_prefix}', '{order_id}', |
|
417 | + '{store_logo}', '{invoice_id}', '{invoice_date}', '{invoice_no}', '{invoice_prefix}', '{order_id}', |
|
418 | 418 | '{store_name}', '{customer}', '{email}', '{telephone}', '{fax}', '{comment}', '{ip}', |
419 | 419 | '{date_added}', '{date_modified}' |
420 | 420 | ); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | //Return |
449 | 449 | public function getReturnFind() |
450 | 450 | { |
451 | - $result = array( '{store_logo}', '{store_name}', '{order_id}', '{date_ordered}', '{firstname}', '{lastname}', '{email}', '{telephone}', '{product}', '{model}', '{quantity}', '{return_reason}', '{opened}', '{comment}' ); |
|
451 | + $result = array('{store_logo}', '{store_name}', '{order_id}', '{date_ordered}', '{firstname}', '{lastname}', '{email}', '{telephone}', '{product}', '{model}', '{quantity}', '{return_reason}', '{opened}', '{comment}'); |
|
452 | 452 | |
453 | 453 | return $result; |
454 | 454 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | // Review |
479 | 479 | public function getReviewFind() |
480 | 480 | { |
481 | - $result = array( '{store_logo}', '{author}', '{review}', '{date}', '{rating}', '{product}' ); |
|
481 | + $result = array('{store_logo}', '{author}', '{review}', '{date}', '{rating}', '{product}'); |
|
482 | 482 | |
483 | 483 | return $result; |
484 | 484 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | // Stock |
501 | 501 | public function getStockFind() |
502 | 502 | { |
503 | - $result = array( '{store_logo}', '{store_name}', '{total_products}' ); |
|
503 | + $result = array('{store_logo}', '{store_name}', '{total_products}'); |
|
504 | 504 | |
505 | 505 | return $result; |
506 | 506 | } |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | // Voucher |
520 | 520 | public function getVoucherFind() |
521 | 521 | { |
522 | - $result = array( '{store_logo}', '{recip_name}', '{recip_email}', '{date}', '{store_name}', '{name}', '{amount}', '{message}', '{store_href}', '{store_url}', '{image}', '{code}' ); |
|
522 | + $result = array('{store_logo}', '{recip_name}', '{recip_email}', '{date}', '{store_name}', '{name}', '{amount}', '{message}', '{store_href}', '{store_url}', '{image}', '{code}'); |
|
523 | 523 | |
524 | 524 | return $result; |
525 | 525 | } |
@@ -536,8 +536,8 @@ discard block |
||
536 | 536 | 'amount' => $data['amount'], |
537 | 537 | 'message' => $data['message'], |
538 | 538 | 'store_href' => $data['store_href'], |
539 | - 'store_url' => '<a href="' . $data['store_href'] . '" title="' . $data['store_href'] . '">' . $data['store_href'] . '</a>', |
|
540 | - 'image' => (file_exists(DIR_IMAGE . $data['image'])) ? 'cid:' . md5(basename($data['image'])) : '', 'code' => $data['code'] |
|
539 | + 'store_url' => '<a href="'.$data['store_href'].'" title="'.$data['store_href'].'">'.$data['store_href'].'</a>', |
|
540 | + 'image' => (file_exists(DIR_IMAGE.$data['image'])) ? 'cid:'.md5(basename($data['image'])) : '', 'code' => $data['code'] |
|
541 | 541 | ); |
542 | 542 | |
543 | 543 | return $result; |
@@ -554,23 +554,23 @@ discard block |
||
554 | 554 | $language = new Language($order_info['language_directory'], $this->registry); |
555 | 555 | $language->load('mail/order'); |
556 | 556 | |
557 | - $text = sprintf($language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8')) . "\n\n"; |
|
558 | - $text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n"; |
|
559 | - $text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n"; |
|
560 | - $text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n"; |
|
557 | + $text = sprintf($language->get('text_new_greeting'), html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'))."\n\n"; |
|
558 | + $text .= $language->get('text_new_order_id').' '.$order_id."\n"; |
|
559 | + $text .= $language->get('text_new_date_added').' '.date($language->get('date_format_short'), strtotime($order_info['date_added']))."\n"; |
|
560 | + $text .= $language->get('text_new_order_status').' '.$order_status."\n\n"; |
|
561 | 561 | |
562 | 562 | if ($comment && $notify) { |
563 | - $text .= $language->get('text_new_instruction') . "\n\n"; |
|
564 | - $text .= $comment . "\n\n"; |
|
563 | + $text .= $language->get('text_new_instruction')."\n\n"; |
|
564 | + $text .= $comment."\n\n"; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | // Products |
568 | - $text .= $language->get('text_new_products') . "\n"; |
|
568 | + $text .= $language->get('text_new_products')."\n"; |
|
569 | 569 | |
570 | 570 | foreach ($getProducts as $product) { |
571 | - $text .= $product['quantity'] . 'x ' . $product['name'] . ' (' . $product['model'] . ') ' . html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n"; |
|
571 | + $text .= $product['quantity'].'x '.$product['name'].' ('.$product['model'].') '.html_entity_decode($this->currency->format($product['total'] + ($this->config->get('config_tax') ? ($product['tax'] * $product['quantity']) : 0), $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8')."\n"; |
|
572 | 572 | |
573 | - $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . $product['order_product_id'] . "'"); |
|
573 | + $order_option_query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_option WHERE order_id = '".(int)$order_id."' AND order_product_id = '".$product['order_product_id']."'"); |
|
574 | 574 | |
575 | 575 | foreach ($order_option_query->rows as $option) { |
576 | 576 | if ($option['type'] != 'file') { |
@@ -585,29 +585,29 @@ discard block |
||
585 | 585 | } |
586 | 586 | } |
587 | 587 | |
588 | - $text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n"; |
|
588 | + $text .= chr(9).'-'.$option['name'].' '.(utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20).'..' : $value)."\n"; |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | foreach ($getVouchers as $voucher) { |
594 | - $text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']); |
|
594 | + $text .= '1x '.$voucher['description'].' '.$this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | $text .= "\n"; |
598 | 598 | |
599 | - $text .= $language->get('text_new_order_total') . "\n"; |
|
599 | + $text .= $language->get('text_new_order_total')."\n"; |
|
600 | 600 | |
601 | 601 | foreach ($getTotal as $total) { |
602 | - $text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n"; |
|
602 | + $text .= $total['title'].': '.html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8')."\n"; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | |
606 | 606 | $text .= "\n"; |
607 | 607 | |
608 | 608 | if ($order_info['customer_id']) { |
609 | - $text .= $language->get('text_new_link') . "\n"; |
|
610 | - $text .= $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_id . "\n\n"; |
|
609 | + $text .= $language->get('text_new_link')."\n"; |
|
610 | + $text .= $order_info['store_url'].'index.php?route=account/order/info&order_id='.$order_id."\n\n"; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /* |
@@ -618,11 +618,11 @@ discard block |
||
618 | 618 | */ |
619 | 619 | // Comment |
620 | 620 | if ($order_info['comment']) { |
621 | - $text .= $language->get('text_new_comment') . "\n\n"; |
|
622 | - $text .= $order_info['comment'] . "\n\n"; |
|
621 | + $text .= $language->get('text_new_comment')."\n\n"; |
|
622 | + $text .= $order_info['comment']."\n\n"; |
|
623 | 623 | } |
624 | 624 | |
625 | - $text .= $language->get('text_new_footer') . "\n\n"; |
|
625 | + $text .= $language->get('text_new_footer')."\n\n"; |
|
626 | 626 | |
627 | 627 | return $text; |
628 | 628 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | // Language |
631 | 631 | public function getLanguage() |
632 | 632 | { |
633 | - $sql = "SELECT * FROM " . DB_PREFIX . "language WHERE language_id = '" . $this->config->get('config_language_id') . "'"; |
|
633 | + $sql = "SELECT * FROM ".DB_PREFIX."language WHERE language_id = '".$this->config->get('config_language_id')."'"; |
|
634 | 634 | $query = $this->db->query($sql); |
635 | 635 | |
636 | 636 | return $query->row; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | // Order Product |
642 | 642 | public function getOrderProducts($order_id) |
643 | 643 | { |
644 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); |
|
644 | + $query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_product WHERE order_id = '".(int)$order_id."'"); |
|
645 | 645 | |
646 | 646 | return $query->rows; |
647 | 647 | } |
@@ -660,10 +660,10 @@ discard block |
||
660 | 660 | |
661 | 661 | foreach ($product_option as $option) { |
662 | 662 | if ($option['type'] != 'file') { |
663 | - $option[] = '<i>' . $option['name'] . '</i>: ' . $option['value']; |
|
663 | + $option[] = '<i>'.$option['name'].'</i>: '.$option['value']; |
|
664 | 664 | } else { |
665 | 665 | $filename = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.')); |
666 | - $option[] = '<i>' . $option['name'] . '</i>: ' . (utf8_strlen($filename) > 20 ? utf8_substr($filename, 0, 20) . '..' : $filename); |
|
666 | + $option[] = '<i>'.$option['name'].'</i>: '.(utf8_strlen($filename) > 20 ? utf8_substr($filename, 0, 20).'..' : $filename); |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | } |
@@ -676,10 +676,10 @@ discard block |
||
676 | 676 | $attribute_sub_data = ''; |
677 | 677 | |
678 | 678 | foreach ($attribute_group['attribute'] as $attribute) { |
679 | - $attribute_sub_data .= '<br />' . $attribute['name'] . ': ' . $attribute['text']; |
|
679 | + $attribute_sub_data .= '<br />'.$attribute['name'].': '.$attribute['text']; |
|
680 | 680 | } |
681 | 681 | |
682 | - $attribute[] = '<u>' . $attribute_group['name'] . '</u>' . $attribute_sub_data; |
|
682 | + $attribute[] = '<u>'.$attribute_group['name'].'</u>'.$attribute_sub_data; |
|
683 | 683 | } |
684 | 684 | } |
685 | 685 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $getProduct = $this->getProduct($product['product_id']); |
723 | 723 | |
724 | 724 | $result = array( |
725 | - 'product_image' => '<img src="' . $image . '" style="width: 50px;height: 50px;padding: auto;">', |
|
725 | + 'product_image' => '<img src="'.$image.'" style="width: 50px;height: 50px;padding: auto;">', |
|
726 | 726 | 'product_name' => $product['name'], |
727 | 727 | 'product_model' => $product['model'], |
728 | 728 | 'product_quantity' => $product['quantity'], |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | public function getOrderOptions($order_id, $order_product_id) |
744 | 744 | { |
745 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product_id . "'"); |
|
745 | + $query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_option WHERE order_id = '".(int)$order_id."' AND order_product_id = '".(int)$order_product_id."'"); |
|
746 | 746 | |
747 | 747 | return $query->rows; |
748 | 748 | } |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | { |
752 | 752 | $product_attribute_group_data = array(); |
753 | 753 | |
754 | - $product_attribute_group_query = $this->db->query("SELECT ag.attribute_group_id, agd.name FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_group ag ON (a.attribute_group_id = ag.attribute_group_id) LEFT JOIN " . DB_PREFIX . "attribute_group_description agd ON (ag.attribute_group_id = agd.attribute_group_id) WHERE pa.product_id = '" . (int)$product_id . "' AND agd.language_id = '" . (int)$language_id . "' GROUP BY ag.attribute_group_id ORDER BY ag.sort_order, agd.name"); |
|
754 | + $product_attribute_group_query = $this->db->query("SELECT ag.attribute_group_id, agd.name FROM ".DB_PREFIX."product_attribute pa LEFT JOIN ".DB_PREFIX."attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN ".DB_PREFIX."attribute_group ag ON (a.attribute_group_id = ag.attribute_group_id) LEFT JOIN ".DB_PREFIX."attribute_group_description agd ON (ag.attribute_group_id = agd.attribute_group_id) WHERE pa.product_id = '".(int)$product_id."' AND agd.language_id = '".(int)$language_id."' GROUP BY ag.attribute_group_id ORDER BY ag.sort_order, agd.name"); |
|
755 | 755 | |
756 | 756 | foreach ($product_attribute_group_query->rows as $product_attribute_group) { |
757 | 757 | $product_attribute_data = array(); |
758 | 758 | |
759 | - $product_attribute_query = $this->db->query("SELECT a.attribute_id, ad.name, pa.text FROM " . DB_PREFIX . "product_attribute pa LEFT JOIN " . DB_PREFIX . "attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN " . DB_PREFIX . "attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE pa.product_id = '" . (int)$product_id . "' AND a.attribute_group_id = '" . (int)$product_attribute_group['attribute_group_id'] . "' AND ad.language_id = '" . (int)$language_id . "' AND pa.language_id = '" . (int)$language_id . "' ORDER BY a.sort_order, ad.name"); |
|
759 | + $product_attribute_query = $this->db->query("SELECT a.attribute_id, ad.name, pa.text FROM ".DB_PREFIX."product_attribute pa LEFT JOIN ".DB_PREFIX."attribute a ON (pa.attribute_id = a.attribute_id) LEFT JOIN ".DB_PREFIX."attribute_description ad ON (a.attribute_id = ad.attribute_id) WHERE pa.product_id = '".(int)$product_id."' AND a.attribute_group_id = '".(int)$product_attribute_group['attribute_group_id']."' AND ad.language_id = '".(int)$language_id."' AND pa.language_id = '".(int)$language_id."' ORDER BY a.sort_order, ad.name"); |
|
760 | 760 | |
761 | 761 | foreach ($product_attribute_query->rows as $product_attribute) { |
762 | 762 | $product_attribute_data[] = array( |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | // Order Voucher |
780 | 780 | public function getOrderVouchers($order_id) |
781 | 781 | { |
782 | - $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_id . "'"); |
|
782 | + $query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_voucher WHERE order_id = '".(int)$order_id."'"); |
|
783 | 783 | |
784 | 784 | return $query->rows; |
785 | 785 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | |
802 | 802 | public function getOrderVoucherFind() |
803 | 803 | { |
804 | - $result = array( '{voucher_description}', '{voucher_amount}' ); |
|
804 | + $result = array('{voucher_description}', '{voucher_amount}'); |
|
805 | 805 | |
806 | 806 | return $result; |
807 | 807 | } |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | |
833 | 833 | public function getCommentFind() |
834 | 834 | { |
835 | - $result = array( '{comment}' ); |
|
835 | + $result = array('{comment}'); |
|
836 | 836 | |
837 | 837 | return $result; |
838 | 838 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | |
867 | 867 | public function getTaxFind() |
868 | 868 | { |
869 | - $result = array( '{tax_title}', '{tax_value}' ); |
|
869 | + $result = array('{tax_title}', '{tax_value}'); |
|
870 | 870 | |
871 | 871 | return $result; |
872 | 872 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | public function getTotalFind() |
910 | 910 | { |
911 | - $result = array( '{total_title}', '{total_value}' ); |
|
911 | + $result = array('{total_title}', '{total_value}'); |
|
912 | 912 | |
913 | 913 | return $result; |
914 | 914 | } |
@@ -1012,10 +1012,10 @@ discard block |
||
1012 | 1012 | public function getDefaultLoginMessage($type_id, $data) |
1013 | 1013 | { |
1014 | 1014 | $message = 'Hello,<br/><br/>'; |
1015 | - $message .= 'We would like to notify you that user ' . $data['username'] . ' has just logged in to the admin panel of your store, ' . $data['store_name'] . ', using IP address ' . $data['ip_address'].'.<br/><br/>'; |
|
1015 | + $message .= 'We would like to notify you that user '.$data['username'].' has just logged in to the admin panel of your store, '.$data['store_name'].', using IP address '.$data['ip_address'].'.<br/><br/>'; |
|
1016 | 1016 | $message .= 'If this is expected you need to do nothing about it. If you suspect a hacking attempt, please log in to your store\'s admin panel immediately and change your password at once.<br/><br/>'; |
1017 | 1017 | $message .= 'Best Regards,<br/><br/>'; |
1018 | - $message .= 'The ' . $data['store_name'] . ' team<br/><br/>'; |
|
1018 | + $message .= 'The '.$data['store_name'].' team<br/><br/>'; |
|
1019 | 1019 | |
1020 | 1020 | return $message; |
1021 | 1021 | } |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | // Reset Password Null |
1037 | 1037 | $subject = ''; |
1038 | 1038 | } else { |
1039 | - $subject = $this->config->get('config_name') . ' - Affilate Mail'; |
|
1039 | + $subject = $this->config->get('config_name').' - Affilate Mail'; |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | return $subject; |
@@ -1047,25 +1047,25 @@ discard block |
||
1047 | 1047 | $this->load->language('mail/affiliate'); |
1048 | 1048 | |
1049 | 1049 | if ($type_id == 'affiliate_4') { |
1050 | - $message = sprintf($this->language->get('text_approve_welcome'), $this->config->get('config_name')) . "\n\n"; |
|
1051 | - $message .= $this->language->get('text_approve_login') . "\n"; |
|
1050 | + $message = sprintf($this->language->get('text_approve_welcome'), $this->config->get('config_name'))."\n\n"; |
|
1051 | + $message .= $this->language->get('text_approve_login')."\n"; |
|
1052 | 1052 | $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
1053 | - $message .= $store_url . 'index.php?route=affiliate/login' . "\n\n"; |
|
1054 | - $message .= $this->language->get('text_approve_services') . "\n\n"; |
|
1055 | - $message .= $this->language->get('text_approve_thanks') . "\n"; |
|
1053 | + $message .= $store_url.'index.php?route=affiliate/login'."\n\n"; |
|
1054 | + $message .= $this->language->get('text_approve_services')."\n\n"; |
|
1055 | + $message .= $this->language->get('text_approve_thanks')."\n"; |
|
1056 | 1056 | $message .= $this->config->get('config_name'); |
1057 | 1057 | } elseif ($type_id == 'affiliate_5') { |
1058 | - $message = sprintf($this->language->get('text_commission_received'), $this->currency->format($data['amount'], $this->config->get('config_currency'))) . "\n\n"; |
|
1058 | + $message = sprintf($this->language->get('text_commission_received'), $this->currency->format($data['amount'], $this->config->get('config_currency')))."\n\n"; |
|
1059 | 1059 | $message .= sprintf($this->language->get('text_commission_total'), $this->currency->format($this->getCommissionTotal($data['affiliate_id']), $this->config->get('config_currency'))); |
1060 | 1060 | } elseif ($type_id == 'affiliate_1') { |
1061 | - $message = sprintf($this->language->get('text_register_message'), $data['firstname'] . ' ' . $data['lastname'], $this->config->get('config_name')); |
|
1061 | + $message = sprintf($this->language->get('text_register_message'), $data['firstname'].' '.$data['lastname'], $this->config->get('config_name')); |
|
1062 | 1062 | } elseif ($type_id == 'affiliate_3') { |
1063 | - $message = sprintf($this->language->get('text_register_approve_message'), $data['firstname'] . ' ' . $data['lastname'], $this->config->get('config_name')); |
|
1063 | + $message = sprintf($this->language->get('text_register_approve_message'), $data['firstname'].' '.$data['lastname'], $this->config->get('config_name')); |
|
1064 | 1064 | } elseif ($type_id == 'affiliate_2') { |
1065 | 1065 | // Reset Password Null |
1066 | - $message = sprintf($this->language->get('text_register_approve_subject'), $this->config->get('config_name'), $data['firstname'] . ' ' . $data['lastname']); |
|
1066 | + $message = sprintf($this->language->get('text_register_approve_subject'), $this->config->get('config_name'), $data['firstname'].' '.$data['lastname']); |
|
1067 | 1067 | } else { |
1068 | - $message = 'Hi!' . "\n" . 'Welcome ' . $data['firstname'] . ' ' . $data['lastname']; |
|
1068 | + $message = 'Hi!'."\n".'Welcome '.$data['firstname'].' '.$data['lastname']; |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | return $message; |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | // Affilate getComissionTotal Frontend & Backend |
1075 | 1075 | public function getCommissionTotal($affiliate_id) |
1076 | 1076 | { |
1077 | - $query = $this->db->query("SELECT SUM(amount) AS total FROM " . DB_PREFIX . "affiliate_commission WHERE affiliate_id = '" . (int)$affiliate_id . "'"); |
|
1077 | + $query = $this->db->query("SELECT SUM(amount) AS total FROM ".DB_PREFIX."affiliate_commission WHERE affiliate_id = '".(int)$affiliate_id."'"); |
|
1078 | 1078 | |
1079 | 1079 | return $query->row['total']; |
1080 | 1080 | } |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | } elseif ($type_id == 'customer_5') { |
1098 | 1098 | $subject = $this->getDefaultVoucherSubject($type_id, $data); |
1099 | 1099 | } else { |
1100 | - $subject = $this->config->get('config_name') . ' - Customer Mail'; |
|
1100 | + $subject = $this->config->get('config_name').' - Customer Mail'; |
|
1101 | 1101 | } |
1102 | 1102 | |
1103 | 1103 | return $subject; |
@@ -1112,11 +1112,11 @@ discard block |
||
1112 | 1112 | $store_url = defined('HTTPS_CATALOG') ? HTTPS_CATALOG : HTTPS_SERVER; |
1113 | 1113 | $store_url .= 'index.php?route=account/login'; |
1114 | 1114 | |
1115 | - $message = sprintf($this->language->get('text_approve_welcome'), $store_name) . "\n\n"; |
|
1116 | - $message .= $this->language->get('text_approve_login') . "\n"; |
|
1117 | - $message .= $store_url . "\n\n"; |
|
1118 | - $message .= $this->language->get('text_approve_services') . "\n\n"; |
|
1119 | - $message .= $this->language->get('text_approve_thanks') . "\n"; |
|
1115 | + $message = sprintf($this->language->get('text_approve_welcome'), $store_name)."\n\n"; |
|
1116 | + $message .= $this->language->get('text_approve_login')."\n"; |
|
1117 | + $message .= $store_url."\n\n"; |
|
1118 | + $message .= $this->language->get('text_approve_services')."\n\n"; |
|
1119 | + $message .= $this->language->get('text_approve_thanks')."\n"; |
|
1120 | 1120 | $message .= $store_name; |
1121 | 1121 | } elseif ($type_id == 'customer_1') { |
1122 | 1122 | // Register |
@@ -1193,14 +1193,14 @@ discard block |
||
1193 | 1193 | $html_data['text_total'] = $this->language->get('text_new_total'); |
1194 | 1194 | $html_data['text_footer'] = $this->language->get('text_new_footer'); |
1195 | 1195 | |
1196 | - $html_data['logo'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo'); |
|
1196 | + $html_data['logo'] = $this->config->get('config_url').'image/'.$this->config->get('config_logo'); |
|
1197 | 1197 | $html_data['store_name'] = $order_info['store_name']; |
1198 | 1198 | $html_data['store_url'] = $order_info['store_url']; |
1199 | 1199 | $html_data['customer_id'] = $order_info['customer_id']; |
1200 | - $html_data['link'] = $order_info['store_url'] . 'index.php?route=account/order/info&order_id=' . $order_info['order_id']; |
|
1200 | + $html_data['link'] = $order_info['store_url'].'index.php?route=account/order/info&order_id='.$order_info['order_id']; |
|
1201 | 1201 | |
1202 | 1202 | if (isset($download_status) && $download_status) { |
1203 | - $html_data['download'] = $order_info['store_url'] . 'index.php?route=account/download'; |
|
1203 | + $html_data['download'] = $order_info['store_url'].'index.php?route=account/download'; |
|
1204 | 1204 | } else { |
1205 | 1205 | $html_data['download'] = ''; |
1206 | 1206 | } |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | if ($order_info['payment_address_format']) { |
1224 | 1224 | $format = $order_info['payment_address_format']; |
1225 | 1225 | } else { |
1226 | - $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; |
|
1226 | + $format = '{firstname} {lastname}'."\n".'{company}'."\n".'{address_1}'."\n".'{address_2}'."\n".'{city} {postcode}'."\n".'{zone}'."\n".'{country}'; |
|
1227 | 1227 | } |
1228 | 1228 | |
1229 | 1229 | $find = array( |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | if ($order_info['shipping_address_format']) { |
1258 | 1258 | $format = $order_info['shipping_address_format']; |
1259 | 1259 | } else { |
1260 | - $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}'; |
|
1260 | + $format = '{firstname} {lastname}'."\n".'{company}'."\n".'{address_1}'."\n".'{address_2}'."\n".'{city} {postcode}'."\n".'{zone}'."\n".'{country}'; |
|
1261 | 1261 | } |
1262 | 1262 | |
1263 | 1263 | $find = array( |
@@ -1294,12 +1294,12 @@ discard block |
||
1294 | 1294 | // Products |
1295 | 1295 | $html_data['products'] = array(); |
1296 | 1296 | |
1297 | - $order_product_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
1297 | + $order_product_query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_product WHERE order_id = '".(int)$order_info['order_id']."'"); |
|
1298 | 1298 | |
1299 | 1299 | foreach ($order_product_query->rows as $product) { |
1300 | 1300 | $option_data = array(); |
1301 | 1301 | |
1302 | - $order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_info['order_id'] . "' AND order_product_id = '" . (int)$product['order_product_id'] . "'"); |
|
1302 | + $order_option_query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_option WHERE order_id = '".(int)$order_info['order_id']."' AND order_product_id = '".(int)$product['order_product_id']."'"); |
|
1303 | 1303 | |
1304 | 1304 | foreach ($order_option_query->rows as $option) { |
1305 | 1305 | if ($option['type'] != 'file') { |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | |
1317 | 1317 | $option_data[] = array( |
1318 | 1318 | 'name' => $option['name'], |
1319 | - 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) |
|
1319 | + 'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20).'..' : $value) |
|
1320 | 1320 | ); |
1321 | 1321 | } |
1322 | 1322 | |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | $html_data['vouchers'] = array(); |
1335 | 1335 | |
1336 | 1336 | |
1337 | - $order_voucher_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_voucher WHERE order_id = '" . (int)$order_info['order_id'] . "'"); |
|
1337 | + $order_voucher_query = $this->db->query("SELECT * FROM ".DB_PREFIX."order_voucher WHERE order_id = '".(int)$order_info['order_id']."'"); |
|
1338 | 1338 | |
1339 | 1339 | foreach ($order_voucher_query->rows as $voucher) { |
1340 | 1340 | $html_data['vouchers'][] = array( |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | } |
1345 | 1345 | |
1346 | 1346 | // Order Totals |
1347 | - $order_total_query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_total` WHERE order_id = '" . (int)$order_info['order_id'] . "' ORDER BY sort_order ASC"); |
|
1347 | + $order_total_query = $this->db->query("SELECT * FROM `".DB_PREFIX."order_total` WHERE order_id = '".(int)$order_info['order_id']."' ORDER BY sort_order ASC"); |
|
1348 | 1348 | |
1349 | 1349 | foreach ($order_total_query->rows as $total) { |
1350 | 1350 | $html_data['totals'][] = array( |
@@ -1353,8 +1353,8 @@ discard block |
||
1353 | 1353 | ); |
1354 | 1354 | } |
1355 | 1355 | |
1356 | - if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) { |
|
1357 | - $html = $this->load->view($this->config->get('config_template') . '/template/mail/order.tpl', $html_data); |
|
1356 | + if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/mail/order.tpl')) { |
|
1357 | + $html = $this->load->view($this->config->get('config_template').'/template/mail/order.tpl', $html_data); |
|
1358 | 1358 | } else { |
1359 | 1359 | $html = $this->load->view('default/template/mail/order.tpl', $html_data); |
1360 | 1360 | } |
@@ -1375,20 +1375,20 @@ discard block |
||
1375 | 1375 | { |
1376 | 1376 | $this->load->language('mail/return'); |
1377 | 1377 | |
1378 | - $message = $this->language->get('text_request') . "\n"; |
|
1378 | + $message = $this->language->get('text_request')."\n"; |
|
1379 | 1379 | $message .= "\n"; |
1380 | - $message .= sprintf($this->language->get('text_order_id'), $data['order_id']) . "\n"; |
|
1381 | - $message .= sprintf($this->language->get('text_date_ordered'), $this->db->escape(strip_tags($data['date_ordered']))) . "\n"; |
|
1382 | - $message .= sprintf($this->language->get('text_customer'), $this->db->escape(strip_tags($data['firstname'])), $this->db->escape(strip_tags($data['lastname']))) . "\n"; |
|
1383 | - $message .= sprintf($this->language->get('text_email'), $this->db->escape(strip_tags($data['email']))) . "\n"; |
|
1384 | - $message .= sprintf($this->language->get('text_telephone'), $this->db->escape(strip_tags($data['telephone']))) . "\n"; |
|
1380 | + $message .= sprintf($this->language->get('text_order_id'), $data['order_id'])."\n"; |
|
1381 | + $message .= sprintf($this->language->get('text_date_ordered'), $this->db->escape(strip_tags($data['date_ordered'])))."\n"; |
|
1382 | + $message .= sprintf($this->language->get('text_customer'), $this->db->escape(strip_tags($data['firstname'])), $this->db->escape(strip_tags($data['lastname'])))."\n"; |
|
1383 | + $message .= sprintf($this->language->get('text_email'), $this->db->escape(strip_tags($data['email'])))."\n"; |
|
1384 | + $message .= sprintf($this->language->get('text_telephone'), $this->db->escape(strip_tags($data['telephone'])))."\n"; |
|
1385 | 1385 | $message .= "\n"; |
1386 | - $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($data['product']))) . "\n"; |
|
1387 | - $message .= sprintf($this->language->get('text_model'), $this->db->escape(strip_tags($data['model']))) . "\n"; |
|
1388 | - $message .= sprintf($this->language->get('text_quantity'), $data['quantity']) . "\n"; |
|
1386 | + $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($data['product'])))."\n"; |
|
1387 | + $message .= sprintf($this->language->get('text_model'), $this->db->escape(strip_tags($data['model'])))."\n"; |
|
1388 | + $message .= sprintf($this->language->get('text_quantity'), $data['quantity'])."\n"; |
|
1389 | 1389 | $message .= "\n"; |
1390 | - $message .= sprintf($this->language->get('text_return_reason'), $data['return_reason']) . "\n"; |
|
1391 | - $message .= sprintf($this->language->get('text_opened'), ($data['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no'))) . "\n"; |
|
1390 | + $message .= sprintf($this->language->get('text_return_reason'), $data['return_reason'])."\n"; |
|
1391 | + $message .= sprintf($this->language->get('text_opened'), ($data['opened'] ? $this->language->get('text_yes') : $this->language->get('text_no')))."\n"; |
|
1392 | 1392 | $message .= "\n"; |
1393 | 1393 | $message .= strip_tags($data['comment']); |
1394 | 1394 | |
@@ -1411,12 +1411,12 @@ discard block |
||
1411 | 1411 | |
1412 | 1412 | $product_info = $this->model_catalog_product->getProduct($data['product_id']); |
1413 | 1413 | |
1414 | - $message = $this->language->get('text_waiting') . "\n"; |
|
1415 | - $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name']))) . "\n"; |
|
1416 | - $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n"; |
|
1417 | - $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n"; |
|
1418 | - $message .= $this->language->get('text_review') . "\n"; |
|
1419 | - $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n"; |
|
1414 | + $message = $this->language->get('text_waiting')."\n"; |
|
1415 | + $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name'])))."\n"; |
|
1416 | + $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name'])))."\n"; |
|
1417 | + $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating'])))."\n"; |
|
1418 | + $message .= $this->language->get('text_review')."\n"; |
|
1419 | + $message .= $this->db->escape(strip_tags($data['text']))."\n\n"; |
|
1420 | 1420 | |
1421 | 1421 | return $message; |
1422 | 1422 | } |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | { |
1435 | 1435 | $this->load->language('mail/stock'); |
1436 | 1436 | |
1437 | - $message = sprintf($this->language->get('text_notify'), $data['outofstock'], $this->config->get('config_name')) . "\n"; |
|
1438 | - $message .= $this->language->get('text_view') . "\n"; |
|
1437 | + $message = sprintf($this->language->get('text_notify'), $data['outofstock'], $this->config->get('config_name'))."\n"; |
|
1438 | + $message .= $this->language->get('text_view')."\n"; |
|
1439 | 1439 | $message .= sprintf($this->language->get('text_signature'), $this->config->get('config_name')); |
1440 | 1440 | |
1441 | 1441 | return nl2br($message); |
@@ -1464,8 +1464,8 @@ discard block |
||
1464 | 1464 | $voucher_data['text_redeem'] = sprintf($this->language->get('text_redeem'), $data['code']); |
1465 | 1465 | $voucher_data['text_footer'] = $this->language->get('text_footer'); |
1466 | 1466 | |
1467 | - if (is_file(DIR_IMAGE . $data['image'])) { |
|
1468 | - $voucher_data['image'] = $this->config->get('config_url') . 'image/' . $data['image']; |
|
1467 | + if (is_file(DIR_IMAGE.$data['image'])) { |
|
1468 | + $voucher_data['image'] = $this->config->get('config_url').'image/'.$data['image']; |
|
1469 | 1469 | } else { |
1470 | 1470 | $voucher_data['image'] = ''; |
1471 | 1471 | } |
@@ -1474,8 +1474,8 @@ discard block |
||
1474 | 1474 | $voucher_data['store_url'] = $data['store_href']; |
1475 | 1475 | $voucher_data['message'] = $data['message']; |
1476 | 1476 | |
1477 | - if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) { |
|
1478 | - $message = $this->load->view($this->config->get('config_template') . '/template/mail/voucher.tpl', $voucher_data); |
|
1477 | + if (file_exists(DIR_TEMPLATE.$this->config->get('config_template').'/template/mail/voucher.tpl')) { |
|
1478 | + $message = $this->load->view($this->config->get('config_template').'/template/mail/voucher.tpl', $voucher_data); |
|
1479 | 1479 | } else { |
1480 | 1480 | $message = $this->load->view('default/template/mail/voucher.tpl', $voucher_data); |
1481 | 1481 | } |
@@ -1485,57 +1485,57 @@ discard block |
||
1485 | 1485 | |
1486 | 1486 | public function imageResize($filename, $width, $height) |
1487 | 1487 | { |
1488 | - if (!is_file(DIR_IMAGE . $filename)) { |
|
1488 | + if (!is_file(DIR_IMAGE.$filename)) { |
|
1489 | 1489 | return; |
1490 | 1490 | } |
1491 | 1491 | |
1492 | 1492 | $extension = pathinfo($filename, PATHINFO_EXTENSION); |
1493 | 1493 | |
1494 | 1494 | $old_image = $filename; |
1495 | - $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension; |
|
1495 | + $new_image = 'cache/'.utf8_substr($filename, 0, utf8_strrpos($filename, '.')).'-'.$width.'x'.$height.'.'.$extension; |
|
1496 | 1496 | |
1497 | - if (!is_file(DIR_IMAGE . $new_image) || (filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image))) { |
|
1497 | + if (!is_file(DIR_IMAGE.$new_image) || (filectime(DIR_IMAGE.$old_image) > filectime(DIR_IMAGE.$new_image))) { |
|
1498 | 1498 | $path = ''; |
1499 | 1499 | |
1500 | 1500 | $directories = explode('/', dirname(str_replace('../', '', $new_image))); |
1501 | 1501 | |
1502 | 1502 | foreach ($directories as $directory) { |
1503 | - $path = $path . '/' . $directory; |
|
1503 | + $path = $path.'/'.$directory; |
|
1504 | 1504 | |
1505 | - if (!is_dir(DIR_IMAGE . $path)) { |
|
1506 | - $this->filesystem->mkdir(DIR_IMAGE . $path); |
|
1505 | + if (!is_dir(DIR_IMAGE.$path)) { |
|
1506 | + $this->filesystem->mkdir(DIR_IMAGE.$path); |
|
1507 | 1507 | } |
1508 | 1508 | } |
1509 | 1509 | |
1510 | - list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image); |
|
1510 | + list($width_orig, $height_orig) = getimagesize(DIR_IMAGE.$old_image); |
|
1511 | 1511 | |
1512 | 1512 | |
1513 | 1513 | if ($width_orig != $width || $height_orig != $height) { |
1514 | - $image = new Image(DIR_IMAGE . $old_image); |
|
1514 | + $image = new Image(DIR_IMAGE.$old_image); |
|
1515 | 1515 | $image->resize($width, $height); |
1516 | - $image->save(DIR_IMAGE . $new_image); |
|
1516 | + $image->save(DIR_IMAGE.$new_image); |
|
1517 | 1517 | } else { |
1518 | - copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image); |
|
1518 | + copy(DIR_IMAGE.$old_image, DIR_IMAGE.$new_image); |
|
1519 | 1519 | } |
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | if ($_SERVER['HTTPS']) { |
1523 | - return HTTPS_IMAGE . $new_image; |
|
1523 | + return HTTPS_IMAGE.$new_image; |
|
1524 | 1524 | } else { |
1525 | - return HTTP_IMAGE . $new_image; |
|
1525 | + return HTTP_IMAGE.$new_image; |
|
1526 | 1526 | } |
1527 | 1527 | } |
1528 | 1528 | |
1529 | 1529 | public function getUploadByCode($code) |
1530 | 1530 | { |
1531 | - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "upload` WHERE code = '" . $this->db->escape($code) . "'"); |
|
1531 | + $query = $this->db->query("SELECT * FROM `".DB_PREFIX."upload` WHERE code = '".$this->db->escape($code)."'"); |
|
1532 | 1532 | |
1533 | 1533 | return $query->row; |
1534 | 1534 | } |
1535 | 1535 | |
1536 | 1536 | public function getProduct($product_id) |
1537 | 1537 | { |
1538 | - $query = $this->db->query("SELECT DISTINCT p.*, pd.*, md.name AS manufacturer, (SELECT price FROM " . DB_PREFIX . "product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM " . DB_PREFIX . "product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "') AS reward, (SELECT ss.name FROM " . DB_PREFIX . "stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '" . (int)$this->config->get('config_language_id') . "') AS stock_status, (SELECT wcd.unit FROM " . DB_PREFIX . "weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS weight_class, (SELECT lcd.unit FROM " . DB_PREFIX . "length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '" . (int)$this->config->get('config_language_id') . "') AS length_class, (SELECT AVG(rating) AS total FROM " . DB_PREFIX . "review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM " . DB_PREFIX . "review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN " . DB_PREFIX . "manufacturer_description md ON (p.manufacturer_id = md.manufacturer_id AND md.language_id = '" . (int)$this->config->get('config_language_id') . "') WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "'"); |
|
1538 | + $query = $this->db->query("SELECT DISTINCT p.*, pd.*, md.name AS manufacturer, (SELECT price FROM ".DB_PREFIX."product_discount pd2 WHERE pd2.product_id = p.product_id AND pd2.customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND pd2.quantity = '1' AND ((pd2.date_start = '0000-00-00' OR pd2.date_start < NOW()) AND (pd2.date_end = '0000-00-00' OR pd2.date_end > NOW())) ORDER BY pd2.priority ASC, pd2.price ASC LIMIT 1) AS discount, (SELECT price FROM ".DB_PREFIX."product_special ps WHERE ps.product_id = p.product_id AND ps.customer_group_id = '".(int)$this->config->get('config_customer_group_id')."' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW())) ORDER BY ps.priority ASC, ps.price ASC LIMIT 1) AS special, (SELECT points FROM ".DB_PREFIX."product_reward pr WHERE pr.product_id = p.product_id AND customer_group_id = '".(int)$this->config->get('config_customer_group_id')."') AS reward, (SELECT ss.name FROM ".DB_PREFIX."stock_status ss WHERE ss.stock_status_id = p.stock_status_id AND ss.language_id = '".(int)$this->config->get('config_language_id')."') AS stock_status, (SELECT wcd.unit FROM ".DB_PREFIX."weight_class_description wcd WHERE p.weight_class_id = wcd.weight_class_id AND wcd.language_id = '".(int)$this->config->get('config_language_id')."') AS weight_class, (SELECT lcd.unit FROM ".DB_PREFIX."length_class_description lcd WHERE p.length_class_id = lcd.length_class_id AND lcd.language_id = '".(int)$this->config->get('config_language_id')."') AS length_class, (SELECT AVG(rating) AS total FROM ".DB_PREFIX."review r1 WHERE r1.product_id = p.product_id AND r1.status = '1' GROUP BY r1.product_id) AS rating, (SELECT COUNT(*) AS total FROM ".DB_PREFIX."review r2 WHERE r2.product_id = p.product_id AND r2.status = '1' GROUP BY r2.product_id) AS reviews, p.sort_order FROM ".DB_PREFIX."product p LEFT JOIN ".DB_PREFIX."product_description pd ON (p.product_id = pd.product_id) LEFT JOIN ".DB_PREFIX."product_to_store p2s ON (p.product_id = p2s.product_id) LEFT JOIN ".DB_PREFIX."manufacturer_description md ON (p.manufacturer_id = md.manufacturer_id AND md.language_id = '".(int)$this->config->get('config_language_id')."') WHERE p.product_id = '".(int)$product_id."' AND pd.language_id = '".(int)$this->config->get('config_language_id')."' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '".(int)$this->config->get('config_store_id')."'"); |
|
1539 | 1539 | |
1540 | 1540 | if ($query->num_rows) { |
1541 | 1541 | return array( |