Post by whisk » Fri May 22, 2015 4:15 pm

ahoj,
už několik dní se snažím, aby se při potvrzení objednávky, do emailu vložila i příloha s všeobecnými obchodními podmínkami, dle nového OZ. Zkoušela jsem v catalog/model/checkout/order.php vložit před email alert - $mail->addAttachment('nazev_souboru');, ale vůbec to nefunguje. Používám 2.0.1.1. Napadá někoho, proč to stále nejde?

Newbie

Posts

Joined
Fri May 22, 2015 4:10 pm

Post by hawkey » Fri May 22, 2015 6:13 pm

Třeba proto že je špatná cesta k souboru?

Visit OpencartEx - Opencart extensions
Opencart rady a návody česky | Podpora Opencart


Active Member

Posts

Joined
Sun Apr 25, 2010 12:10 am
Location - Olomouc, Czech Republic, Europe

Post by kamii » Fri May 22, 2015 7:24 pm

Hawkey a poradíš mi, prosím, správnou cestu?

Newbie

Posts

Joined
Mon Mar 02, 2015 8:19 pm

Post by hawkey » Fri May 22, 2015 8:00 pm

To asi těžko, když nevím kam jsi tu přílohu umístila :)

Visit OpencartEx - Opencart extensions
Opencart rady a návody česky | Podpora Opencart


Active Member

Posts

Joined
Sun Apr 25, 2010 12:10 am
Location - Olomouc, Czech Republic, Europe

Post by kamii » Fri May 22, 2015 8:37 pm

Podmínky mam v kořenovém adresáři.

Newbie

Posts

Joined
Mon Mar 02, 2015 8:19 pm

Post by hawkey » Fri May 22, 2015 10:07 pm

Tak pak by to mělo být

$mail->addAttachment(DIR_SYSTEM . 'nazev_souboru');

Visit OpencartEx - Opencart extensions
Opencart rady a návody česky | Podpora Opencart


Active Member

Posts

Joined
Sun Apr 25, 2010 12:10 am
Location - Olomouc, Czech Republic, Europe

Post by kamii » Fri May 22, 2015 10:27 pm

Bohužel stále nefunguje. Zřejmě problém mezi počítačem a židlí :)) už fakt nevím.

Newbie

Posts

Joined
Mon Mar 02, 2015 8:19 pm

Post by hawkey » Sat May 23, 2015 8:49 pm

Problémy mezi počítačem a židlí musí řešit jiní :)

Mimochodem, kam přesně to dáváš? Pokud řádek před // Admin Alert Mail tak tam je ti to úplně k ničemu :)

Visit OpencartEx - Opencart extensions
Opencart rady a návody česky | Podpora Opencart


Active Member

Posts

Joined
Sun Apr 25, 2010 12:10 am
Location - Olomouc, Czech Republic, Europe

Post by whisk » Sun May 24, 2015 11:24 pm

Code: Select all

		// Admin Alert Mail
				if ($this->config->get('config_order_mail')) {
					$subject = sprintf($language->get('text_new_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $order_id);

					// HTML Mail
					$data['text_greeting'] = $language->get('text_new_received');
					
					if ($comment) {
						if ($order_info['comment']) {
							$data['comment'] = nl2br($comment) . '<br/><br/>' . $order_info['comment'];
						} else {
							$data['comment'] = nl2br($comment);
						}
					} else {
						if ($order_info['comment']) {
							$data['comment'] = $order_info['comment'];
						} else {
							$data['comment'] = '';
						}
					}
					$data['text_download'] = '';

					$data['text_footer'] = '';

					$data['text_link'] = '';
					$data['link'] = '';
					$data['download'] = '';

					if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/order.tpl')) {
						$html = $this->load->view($this->config->get('config_template') . '/template/mail/order.tpl', $data);
					} else {
						$html = $this->load->view('default/template/mail/order.tpl', $data);
					}

					// Text
					$text  = $language->get('text_new_received') . "\n\n";
					$text .= $language->get('text_new_order_id') . ' ' . $order_id . "\n";
					$text .= $language->get('text_new_date_added') . ' ' . date($language->get('date_format_short'), strtotime($order_info['date_added'])) . "\n";
					$text .= $language->get('text_new_order_status') . ' ' . $order_status . "\n\n";
					$text .= $language->get('text_new_products') . "\n";

					foreach ($order_product_query->rows as $product) {
						$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";

						$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'] . "'");

						foreach ($order_option_query->rows as $option) {
							if ($option['type'] != 'file') {
								$value = $option['value'];
							} else {
								$value = utf8_substr($option['value'], 0, utf8_strrpos($option['value'], '.'));
							}

							$text .= chr(9) . '-' . $option['name'] . ' ' . (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value) . "\n";
						}
					}

					foreach ($order_voucher_query->rows as $voucher) {
						$text .= '1x ' . $voucher['description'] . ' ' . $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']);
					}

					$text .= "\n";

					$text .= $language->get('text_new_order_total') . "\n";

					foreach ($order_total_query->rows as $total) {
						$text .= $total['title'] . ': ' . html_entity_decode($this->currency->format($total['value'], $order_info['currency_code'], $order_info['currency_value']), ENT_NOQUOTES, 'UTF-8') . "\n";
					}

					$text .= "\n";

					if ($order_info['comment']) {
						$text .= $language->get('text_new_comment') . "\n\n";
						$text .= $order_info['comment'] . "\n\n";
					}

					$mail = new Mail($this->config->get('config_mail'));
					$mail->setTo($this->config->get('config_email'));
					$mail->setFrom($this->config->get('config_email'));
					$mail->setReplyTo($order_info['email']);
					$mail->setSender($order_info['store_name']);
					$mail->setSubject($subject);
					$mail->setHtml($html);
					$mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
					$mail->addAttachment(DIR_SYSTEM . 'podminky.docx');
					$mail->send();

					// Send to additional alert emails
					$emails = explode(',', $this->config->get('config_mail_alert'));

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

řádek 773, stále nic :// zkoušela jsem umístit i jinam, ale bez výsledku

Newbie

Posts

Joined
Fri May 22, 2015 4:10 pm

Post by hawkey » Sun May 24, 2015 11:42 pm

Tohle totiž není sekce kde se posílá zákaznický mail. Ten se posílá před tím...

Visit OpencartEx - Opencart extensions
Opencart rady a návody česky | Podpora Opencart


Active Member

Posts

Joined
Sun Apr 25, 2010 12:10 am
Location - Olomouc, Czech Republic, Europe
Who is online

Users browsing this forum: No registered users and 25 guests