Post by dm5400 » Wed Apr 15, 2020 5:12 am

Now that I finally got my contact form working, I realize my logo is too large in the emails. How/where do I change the size so it's a lot smaller or can I disable it? I don't want it smaller on my website, only in the emails. I found a solution for the logo size in an order: Catalog > View> theme> default> template> mail> order and changed the code for that but that does not change it with a contact form email.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by letxobnav » Wed Apr 15, 2020 10:20 am

the contact email is an email from a user to you, there is no logo on that and why would you want to.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by paulfeakins » Wed Apr 15, 2020 7:47 pm

letxobnav wrote:
Wed Apr 15, 2020 10:20 am
the contact email is an email from a user to you, there is no logo on that and why would you want to.
Sounds like an extension, please tell us which one?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by dm5400 » Wed Apr 15, 2020 11:40 pm

It's automatically there. I'm not using any email extensions.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by straightlight » Wed Apr 15, 2020 11:43 pm

dm5400 wrote:
Wed Apr 15, 2020 5:12 am
Now that I finally got my contact form working, I realize my logo is too large in the emails. How/where do I change the size so it's a lot smaller or can I disable it? I don't want it smaller on my website, only in the emails. I found a solution for the logo size in an order: Catalog > View> theme> default> template> mail> order and changed the code for that but that does not change it with a contact form email.
While the OC version has not been provided, the contact us email is sent by text with default installation, not HTML.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dm5400 » Thu Apr 16, 2020 1:52 am

OpenCart 3.0.3.2. Each email from the contact form has a large logo with a link back to my website at the top. I need to change it. I've contacted Journal 3 support to see how I change it if it's on their end.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by straightlight » Thu Apr 16, 2020 2:25 am

dm5400 wrote:
Thu Apr 16, 2020 1:52 am
OpenCart 3.0.3.2. Each email from the contact form has a large logo with a link back to my website at the top. I need to change it. I've contacted Journal 3 support to see how I change it if it's on their end.
The contact us email format from the core is text. If you want to make the modifications, you'd need to switch from catalog/controller/information/contact.php file from: setText to setHtml method pointing to your new TWIG file. Then, to modify your catalog/view/theme/journalx/template/mail/contact.twig file (you'd need to create this new TWIG file).

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dm5400 » Thu Apr 16, 2020 3:05 am

Sorry, I have no idea what a TWIG file is.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by straightlight » Thu Apr 16, 2020 3:07 am

dm5400 wrote:
Thu Apr 16, 2020 3:05 am
Sorry, I have no idea what a TWIG file is.
Google:
Twig is a template engine for the PHP programming language. Its syntax originates from Jinja and Django templates. It's an open source product licensed under a BSD License and maintained by Fabien Potencier. The initial version was created by Armin Ronacher.
As an alternative, you could also look on the Marketplace for an extension to send HTML emails either from the contact page and even for the entire platform.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dm5400 » Thu Apr 16, 2020 3:27 am

Thanks

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by dm5400 » Fri Apr 17, 2020 12:28 am

Two more questions. I posted on the Journal 3 discussion page and they told me where to change the email subject line and take out the logo but not what to change. Here's my twig file for the logo. The highlighted text is what I took out. However, when I deleted and saved it, the linked logo still appears in my emails. Can anyone tell me what I am doing wrong?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>{{ title }}</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000;">
[highlight]<div style="width: 680px;"><a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;"/></a>[/highlight]
  <p style="margin-top: 0px; margin-bottom: 20px;">{{ data.sentEmailTitle }}</p>
  <table style="border-collapse: collapse; width: 100%; border-top: 1px solid #DDDDDD; border-left: 1px solid #DDDDDD; margin-bottom: 20px;">
    <thead>
    <tr>
      <td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">{{ data.sentEmailField }}</td>
      <td style="font-size: 12px; border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; background-color: #EFEFEF; font-weight: bold; text-align: left; padding: 7px; color: #222222;">{{ data.sentEmailValue }}</td>
    </tr>
    </thead>
    <tbody>
    {% for item in data.items %}
      <tr>
        <td style="font-size: 12px;	border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: right; padding: 7px;"><b>{{ item.label }}:</b></td>
        <td style="font-size: 12px;	border-right: 1px solid #DDDDDD; border-bottom: 1px solid #DDDDDD; text-align: left; padding: 7px;">
          {% if item.type == 'file' %}
            <a href="{{ item.url }}">{{ item.value }}</a>
          {% else %}
            {{ item.value is iterable ? item.value|join(', ') : item.value }}
          {% endif %}
        </td>
      </tr>
    {% endfor %}
    </tbody>
  </table>
  {% if data.title %}
  <p style="margin-top: 10px; margin-bottom: 20px;">{{ data.sentEmailUsingModule }} <b>{{ data.title }}</b></p>
  {% endif %}
  {% if data.url %}
  <p style="margin-top: 10px; margin-bottom: 20px;">{{ data.sentEmailFrom }} <a href="{{ data.url }}">{{ data.url }}</a></p>
  {% endif %}
  {% if data.ip %}
    <p style="margin-top: 10px; margin-bottom: 20px;">{{ data.sentEmailIPAddress }} <b>{{ data.ip }}</b></p>
  {% endif %}
</div>
</body>
</html>
Second, I'm not sure how to change the email subject field. Currently, it shows my website name but I want to change it to "Enquiry". I've highlighted the only "subject" I can find, Here's the code:

Code: Select all

<?php

use Journal3\Opencart\ModuleController;
use Journal3\Options\Parser;
use Journal3\Utils\Arr;
use Journal3\Utils\Request;

class ControllerJournal3Form extends ModuleController {

	public function __construct($registry) {
		parent::__construct($registry);

		$this->load->model('tool/upload');
	}

	public function index($args) {
		$data = parent::index($args);

		if (!$data) {
			return null;
		}

		foreach ($this->settings['items'] as $index => $item) {
			if (in_array($item['type'], array('date', 'time', 'datetime'))) {
				if ($this->journal3->isOC2()) {
					$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment.js');
					$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js');
					$this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');
				} else {
					$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment/moment.min.js');
//					$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment/moment-with-locales.min.js');
					$this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js');
					$this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css');
				}
				break;
			}
		}

		return $data;
	}

	/**
	 * @param Parser $parser
	 * @param $index
	 * @return array
	 */
	protected function parseGeneralSettings($parser, $index) {
		$data['text_select'] = $this->language->get('text_select');
		$data['text_loading'] = $this->language->get('text_loading');
		$data['button_submit'] = $this->language->get('button_submit');
		$data['button_upload'] = $this->language->get('button_upload');
		$data['datepicker'] = $this->language->get('datepicker');

		$data['action'] = $this->model_journal3_links->url('journal3/form/send', 'module_id=' . $this->module_id, true);

		$data['agree_data'] = $this->model_journal3_links->getInformation($parser->getSetting('agree'));

		return $data;
	}

	/**
	 * @param Parser $parser
	 * @param $index
	 * @return array
	 */
	protected function parseItemSettings($parser, $index) {
		return array();
	}

	/**
	 * @param Parser $parser
	 * @param $index
	 * @return array
	 */
	protected function parseSubitemSettings($parser, $index) {
		return array();
	}

	protected function beforeRender() {
		if (!isset($this->request->get['route'])) {
			$this->request->get['route'] = 'common/home';
		}

		if ($this->journal3->isOC2()) {
			if ($this->config->get($this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
				$this->settings['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha'));
			} else {
				$this->settings['captcha'] = '';
			}
		} else {
			if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
				$this->settings['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha'));
			} else {
				$this->settings['captcha'] = '';
			}
		}

		foreach ($this->settings['items'] as &$item) {
			if (!$item['placeholder']) {
				if ($item['type'] === 'select') {
					$item['placeholder'] = $this->settings['text_select'];
				} else {
					$item['placeholder'] = $item['label'];
				}
			}
		}
	}

	public function send() {
		try {
			$module_id = (int)$this->input('GET', 'module_id');
			$agree = $this->input('POST', 'agree', '');

			if (!$this->index(array('module_id' => $module_id, 'module_type' => 'form',))) {
				throw new \Exception('Invalid module id!');
			}

			$this->load->language('account/register');

			$errors = array();
			$data = array();

			$data['title'] = $this->settings['title'];
			$data['sentEmailTitle'] = $this->settings['sentEmailTitle'];
			$data['sentEmailField'] = $this->settings['sentEmailField'];
			$data['sentEmailValue'] = $this->settings['sentEmailValue'];
			$data['sentEmailUsingModule'] = $this->settings['sentEmailUsingModule'];
			$data['sentEmailFrom'] = $this->settings['sentEmailFrom'];
			$data['sentEmailIPAddress'] = $this->settings['sentEmailIPAddress'];

			$data['url'] = htmlspecialchars_decode($this->input('POST', 'url', ''));

			$data['ip'] = $this->request->server['REMOTE_ADDR'];

			if (isset($this->settings['agree'])) {
				$agree_data = $this->model_journal3_links->getInformation($this->settings['agree']);

				if ($agree_data && !$agree) {
					$errors['agree'] = $agree_data['error'];
				}
			}

			foreach ($this->settings['items'] as $index => $item) {
				$value = Arr::get($this->request->post, 'item.' . $index);

				if ($item['required'] && empty($value)) {
					$errors['item[' . $index . ']'] = sprintf($this->language->get('error_custom_field'), $item['label']);
				}

				if ($item['type'] === 'name') {
					$data['name'] = $value;
				} else if ($item['type'] === 'email') {
					$data['email'] = $value;

					if ($value && !isset($errors['item[' . $index . ']']) && ((utf8_strlen($value) > 96) || !filter_var($value, FILTER_VALIDATE_EMAIL))) {
						$errors['item[' . $index . ']'] = $this->language->get('error_email');
					}
				}

				$data['items'][$index] = array(
					'type'  => $item['type'],
					'label' => $item['label'],
					'value' => $value,
				);

				if ($item['type'] === 'file') {
					$upload_info = $this->model_tool_upload->getUploadByCode($value);

					if ($upload_info) {
						$data['items'][$index]['value'] = $upload_info['name'];
						$data['items'][$index]['url'] = $this->url->link('journal3/form/download', 'code=' . $upload_info['code']);
					}
				}
			}

            if (!isset($this->request->post['g-recaptcha-response'])) {
                $this->request->post['g-recaptcha-response'] = '';
            }

            if (!isset($this->request->post['captcha'])) {
                $this->request->post['captcha'] = '';
            }

			if ($this->journal3->isOC2()) {
				if ($this->config->get($this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
					$captcha = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha') . '/validate');

					if ($captcha) {
						$errors['captcha'] = $captcha;
					}
				}
			} else {
				if ($this->config->get('captcha_' . $this->config->get('config_captcha') . '_status') && in_array('contact', (array)$this->config->get('config_captcha_page'))) {
					$captcha = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha') . '/validate');

					if ($captcha) {
						$errors['captcha'] = $captcha;
					}
				}
			}

			if ($errors) {
				$this->renderJson(self::ERROR, array('errors' => $errors));
			} else {
				unset($this->session->data['gcapcha']);

				$this->load->model('journal3/message');
				$this->load->model('journal3/image');

				$email_data = array(
					'title'      => $this->config->get('config_name'),
					'logo'       => $this->model_journal3_image->resize($this->config->get('config_logo')),
					'store_name' => $this->config->get('config_name'),
					'store_url'  => $this->config->get(Request::isHttps() ? 'config_ssl' : 'config_url'),
					'data'       => $data,
				);

				$this->model_journal3_message->addMessage($data);

				$params = array(
					'to'      => $this->config->get('config_email'),
				[highlight]	'subject' => $this->config->get('config_name')[/highlight],
					'message' => $this->load->view('journal3/module/form_email', $email_data),
				);

				if (Arr::get($data, 'email')) {
					$params['reply_to'] = $data['email'];
				}

				$this->load->controller('journal3/mail/send', $params);

				$this->renderJson(self::SUCCESS, array('message' => $this->settings['sentText']));
			}
		} catch (Exception $e) {
			$this->renderJson(self::ERROR, $e->getMessage());
		}
	}

	public function download() {
		if (isset($this->request->get['code'])) {
			$code = $this->request->get['code'];
		} else {
			$code = 0;
		}

		$upload_info = $this->model_tool_upload->getUploadByCode($code);

		if ($upload_info) {
			$file = DIR_UPLOAD . $upload_info['filename'];
			$mask = basename($upload_info['name']);

			if (!headers_sent()) {
				if (is_file($file)) {
					header('Content-Type: application/octet-stream');
					header('Content-Description: File Transfer');
					header('Content-Disposition: attachment; filename="' . ($mask ? $mask : basename($file)) . '"');
					header('Content-Transfer-Encoding: binary');
					header('Expires: 0');
					header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
					header('Pragma: public');
					header('Content-Length: ' . filesize($file));

					readfile($file, 'rb');
					exit;
				} else {
					exit('Error: Could not find file ' . $file . '!');
				}
			} else {
				exit('Error: Headers already sent out!');
			}
		} else {
			$this->load->language('error/not_found');

			$this->document->setTitle($this->language->get('heading_title'));

			$data['heading_title'] = $this->language->get('heading_title');

			$data['text_not_found'] = $this->language->get('text_not_found');

			$data['breadcrumbs'] = array();

			$data['breadcrumbs'][] = array(
				'text' => $this->language->get('text_home'),
				'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], true)
			);

			$data['breadcrumbs'][] = array(
				'text' => $this->language->get('heading_title'),
				'href' => $this->url->link('error/not_found', 'token=' . $this->session->data['token'], true)
			);

			$data['header'] = $this->load->controller('common/header');
			$data['column_left'] = $this->load->controller('common/column_left');
			$data['footer'] = $this->load->controller('common/footer');

			$this->response->setOutput($this->load->view('error/not_found', $data));
		}
	}

}

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by straightlight » Fri Apr 17, 2020 12:29 am

This forum does not support Journal. FAQ: viewtopic.php?f=134&t=215776&start=20#p783502

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dm5400 » Fri Apr 17, 2020 12:33 am

I realize that and did not expect help with the Journal theme. Since my question isn't about the Journal theme but coding, I thought someone would be kind enough to help me with the code since I know nothing about it. I guess I was mistaken.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by straightlight » Fri Apr 17, 2020 12:36 am

dm5400 wrote:
Fri Apr 17, 2020 12:33 am
I realize that and did not expect help with the Journal theme. Since my question isn't about the Journal theme but coding, I thought someone would be kind enough to help me with the code since I know nothing about it. I guess I was mistaken.
use Journal3\Opencart\ModuleController;
use Journal3\Options\Parser;
use Journal3\Utils\Arr;
use Journal3\Utils\Request;

class ControllerJournal3Form extends ModuleController {
Your question is still about an extension.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by dm5400 » Fri Apr 17, 2020 12:45 am

My question is about coding. I'll find someone else who is willing to help.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by straightlight » Fri Apr 17, 2020 12:49 am

dm5400 wrote:
Fri Apr 17, 2020 12:45 am
My question is about coding. I'll find someone else who is willing to help.
No problem, good luck!

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by cyclops12 » Fri Apr 17, 2020 1:25 am

Not sure about journal but in default theme you could try in admin/extensions/extensions/
Choose themes from the dropdown
Edit your theme and scroll down to Store Image Size
This is the image that shows up on contact page

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by dm5400 » Fri Apr 17, 2020 11:59 pm

Thanks, cyclops12. A very helpful Journal 3 response told me to refresh modifications and clear the OpenCart cache after I made the changes to the coding. Once that was done, the linked logo that was showing up in the contact emails was gone. Since I am not familiar with coding, I did not know I was supposed to do that.

New member

Posts

Joined
Wed Feb 04, 2015 5:42 am

Post by cyclops12 » Sat Apr 18, 2020 12:01 am

Yes mate version 3 is very cachey and each time you edit/ammend/add code you need to refresh all caches to see the changes
Good luck

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am
Who is online

Users browsing this forum: No registered users and 12 guests