Page 1 of 1

Email template edit and ID reset

Posted: Tue Sep 10, 2019 9:50 pm
by paja93
Hi everyone, i really did my best to find it by my self and i was looking online, but no luck.
I want to edit email templates. For example, to resize that huge logo image that comes with newsletter subscribe email and order email and i would like to remove order ID number from the subject.

Also how can i reset those IDs? So the new registrations and orders start from 0 again. I thought that would be in a database but i guess i was wrong.
Anyway, i hope someone can help me out, thanks! :)

Re: Email template edit and ID reset

Posted: Tue Sep 10, 2019 10:26 pm
by Johnathan
In OpenCart 3.0, the template file for the order e-mail is located here, along with other e-mail templates:

/catalog/view/theme/YOURTHEME/template/mail/order_add.twig

To reset the order_id, you want to reset the "autoincrement" value for the "order" table. Keep in mind if you don't also clear out the table, then you'll "DUPLICATE PRIMARY KEY" errors, so make sure you're not going to double up on order_id's after resetting the autoincrement.

Re: Email template edit and ID reset

Posted: Tue Sep 10, 2019 11:00 pm
by paja93
Johnathan wrote:
Tue Sep 10, 2019 10:26 pm
In OpenCart 3.0, the template file for the order e-mail is located here, along with other e-mail templates:

/catalog/view/theme/YOURTHEME/template/mail/order_add.twig

To reset the order_id, you want to reset the "autoincrement" value for the "order" table. Keep in mind if you don't also clear out the table, then you'll "DUPLICATE PRIMARY KEY" errors, so make sure you're not going to double up on order_id's after resetting the autoincrement.
Wow, thanks for quick answer. I managed to find and edit email template, and i found that autoincrement. Now, the order id is 22 but autoincrement is 11, i just noticed that for every order, 2 identical rows are created and when i remove the order from the opencart admin panel, second one stays in database. Is that normal or? I mean, i just can't see a reason for that.

Re: Email template edit and ID reset

Posted: Tue Sep 10, 2019 11:06 pm
by paja93
paja93 wrote:
Tue Sep 10, 2019 11:00 pm
Johnathan wrote:
Tue Sep 10, 2019 10:26 pm
In OpenCart 3.0, the template file for the order e-mail is located here, along with other e-mail templates:

/catalog/view/theme/YOURTHEME/template/mail/order_add.twig

To reset the order_id, you want to reset the "autoincrement" value for the "order" table. Keep in mind if you don't also clear out the table, then you'll "DUPLICATE PRIMARY KEY" errors, so make sure you're not going to double up on order_id's after resetting the autoincrement.
Wow, thanks for quick answer. I managed to find and edit email template, and i found that autoincrement. Now, the order id is 22 but autoincrement is 11, i just noticed that for every order, 2 identical rows are created and when i remove the order from the opencart admin panel, second one stays in database. Is that normal or? I mean, i just can't see a reason for that.
Oh god, that "11" is not what i meant it is. Still question stands about duplicated rows and new one, how do i reset autoincrement exactly?
Sorry if it is not allowed to ask multiple questions in the same thread :)

Re: Email template edit and ID reset

Posted: Wed Sep 11, 2019 10:45 pm
by Johnathan
Duplicate rows should not be created, so that would be a bug (probably due to a mod you've installed). Finding and fixing that could be difficult, but you could start by uninstalling/disabling any mods you have that affect the order process. That may show you what was related. If it doesn't, you could hire someone to look at it for you. If you need to find a developer, you can post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.

For resetting the autoincrement value, you need to use phpMyAdmin or something similar. You can read more about that here, where #1 is probably the one you want:

https://www.viralpatel.net/reseting-mys ... nt-column/

Re: Email template edit and ID reset

Posted: Fri Oct 04, 2019 8:02 am
by paja93
Johnathan wrote:
Wed Sep 11, 2019 10:45 pm
Duplicate rows should not be created, so that would be a bug (probably due to a mod you've installed). Finding and fixing that could be difficult, but you could start by uninstalling/disabling any mods you have that affect the order process. That may show you what was related. If it doesn't, you could hire someone to look at it for you. If you need to find a developer, you can post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.

For resetting the autoincrement value, you need to use phpMyAdmin or something similar. You can read more about that here, where #1 is probably the one you want:

https://www.viralpatel.net/reseting-mys ... nt-column/
I found the solution and fixed it. I got much more comfortable with opencart and files but i still have troubles with changing something in the email. By default, order add email have a huge logo... now i understand what i have to edit and i did, but logo in the email just got smaller for some reason(i removed whole line in the code). I don't understand why is logo still there in the email and how is that possible, i tried to restart server and refresh opencart but it's still the same. Now if i add this line again, logo still remains smaller than it was by default. Makes no sense at all.

I edited /catalog/view/theme/default/template/mail/order_add.twig and removed this

Code: Select all

<a href="{{ store_url }}" title="{{ store_name }}"><img src="{{ logo }}" alt="{{ store_name }}" style="margin-bottom: 20px; border: none;" /></a>

Re: Email template edit and ID reset

Posted: Fri Oct 04, 2019 10:42 pm
by Johnathan
It could just have been your browser caching the image, try and do a hard refresh so that it reloads all images/js/css files. Also, keep in mind that not all e-mail clients will display images the same --- some have a max-width value set, so it will show the image smaller than it may be originally, while others will show the whole image at its original size. You might want to test a few different e-mail clients to see how it looks, unless you're fine with the smaller logo for all situations.

Re: Email template edit and ID reset

Posted: Fri Oct 04, 2019 11:22 pm
by paja93
Johnathan wrote:
Fri Oct 04, 2019 10:42 pm
It could just have been your browser caching the image, try and do a hard refresh so that it reloads all images/js/css files. Also, keep in mind that not all e-mail clients will display images the same --- some have a max-width value set, so it will show the image smaller than it may be originally, while others will show the whole image at its original size. You might want to test a few different e-mail clients to see how it looks, unless you're fine with the smaller logo for all situations.
I just want to remove it from the email but it's still there even if i removed it from the code. Is there maybe something else i need to change or?

Re: Email template edit and ID reset

Posted: Sat Oct 05, 2019 2:24 am
by paja93
Okay, so i found the trick. For some reason, when you make changes in twig files, opencart still doesn't detect the change.
Basically what i did is made a change in a code and then went on admin panel theme editor and just clicked "save". After that new settings were applied. Doesn't make any sense to me, but it works.

Thanks for help!