Post by hermes23 » Fri Oct 11, 2019 6:56 am

In OC 1.5.6.4 there was a long list of variables in setting.php and store.php under admin/controller/setting/. e.g.:
$this->data['entry_logo'] = $this->language->get('entry_logo');
$this->data['entry_icon'] = $this->language->get('entry_icon');

Where did these variables get moved to in OC 3.x?

Newbie

Posts

Joined
Mon Apr 16, 2018 8:29 am

Post by grgr » Fri Oct 11, 2019 11:43 am

They got removed, not moved.

The language variables are automatically loaded.

So now all you have to do is call $this->load->language('whatever') and all the language variables will be available.

Image Image Image Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by hermes23 » Fri Oct 11, 2019 11:30 pm

I just upgraded my site from 1.5 to 3.0.3.2 and I'm trying to update a custom vqmod I had made for OC 2.x to allow using a different logo for email since my theme is dark and there are transparent elements in my logo which look really bad on a white background. Everything looks good so far, the option is showing up in store settings and I'm able to set a separate logo for email but when I place a test order it still shows the original logo in the confirmation email. I was thinking this is because of the following variables in admin/controller/setting/ setting.php and store.php need to be declared elsewhere:

Code: Select all

$data['entry_logo_email'] = $this->language->get('entry_logo_email');
$data['help_logo_email'] = $this->language->get('help_logo_email');
If I understand your reply correctly this should still work or do I need to change those lines or move to another file?
Last edited by hermes23 on Sat Oct 12, 2019 5:45 am, edited 1 time in total.

Newbie

Posts

Joined
Mon Apr 16, 2018 8:29 am

Post by hermes23 » Fri Oct 11, 2019 11:36 pm

This is the code that I suspect isn't working:

Code: Select all

<file name="catalog/view/theme/*/template/mail/order_add.twig">
   
   <operation>
		<search position="replace"><![CDATA[
		<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
	  ]]></search>
		<add><![CDATA[
		<?php if ($logo_email_check) { ?>	
		<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo_email }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
		<?php } else { ?>
		<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
		<?php } ?>
		]]></add>
    </operation>
	
</file>
I think the if statement for $logo_email_check is not evaluating for some reason. Can I even use php in a twig file?

Newbie

Posts

Joined
Mon Apr 16, 2018 8:29 am

Post by by mona » Fri Oct 11, 2019 11:55 pm

<?php if ($logo_email_check) { ?>
<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo_email }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
<?php } else { ?>
<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
<?php } ?>
would be written in twig
{% if logo_email_check %}
<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo_email }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
{% else %}
<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>
{% endif %}
https://twig.symfony.com/doc/2.x/intro.html

Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by hermes23 » Sat Oct 12, 2019 6:29 am

Thank you very much Mona, that helps a lot! Just one more thing I need to figure out and it's all done.
In previous opencart versions catalog/model/checkout/order.php contained the line:

Code: Select all

$template->data['logo'] = HTTP_IMAGE . $this->config->get('config_logo');
I need to put the code below in the same location but I'm not sure where it needs to be in 3.0.

Code: Select all

$template->data['logo_email'] = $this->config->get('config_url') . 'image/' . $this->config->get('config_logo_email');
$template->data['logo_email_check'] = $this->config->get('config_logo_email');

Newbie

Posts

Joined
Mon Apr 16, 2018 8:29 am

Post by by mona » Sat Oct 12, 2019 7:04 am

you are welcome
catalog/controller/mail/order.php

Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am
Who is online

Users browsing this forum: No registered users and 32 guests