Post by enduroforum » Sun Jan 07, 2018 8:32 am

Hi there

Two issues:
1) How can I receive an exact copy of the order confirmation email that is sent to the customer?
2) The order alert sent to the shop owner does not even contain customer name or email address. I tried to alter order_alert.twig but have not been successfull so far. I went to the controler file "order.php" to see how data is passed into the twig-file and found the $data-array. For instance:
$data['order_id'] = ...;
$data['email'] = ... ;
Within the twig-file {{ order_id }} prints the order id.
Copying {{ order_id }} within the twig-file will simply print me the same order id again. BUT: {{ email }} (not used within the order_alert.twig so far) will print nothing. In fact, I can copy any field within the twig-file that is already available in the code and it will print the respective value again but I cannot add any new field.
I access the twig-file via a FTP-connection (tried the template editow: same issue). Once done editing, I clear the server cache within opencart through the button provided on the dashboard.

???

By the way: I just installed a fresh version of OC and tried the above: Same issue!
Hopefully someone can help me here.

Cheerz!
Mike

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Sun Jan 07, 2018 8:49 pm

No OC version posted.
$data['email'] = ... ;
What does this explain to forum posters in order to gather the proper solution exactly?

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 enduroforum » Mon Jan 08, 2018 12:04 am

Sorry, I wanted to keep it brief and the content of the variable does not really matter. I am running version 3.0.2.0.
Here you go:
As I said, I was checking "order.php" to see which variables (apart from those already used in "order_alert.twig") are available.
I found "$data['order_id'] = $order_info['order_id'];" in "order.php" and I found {{ order_id }} in "order_alert.twig". Thus, I tried to use another simple varibale and went for "$data['email'] = $order_info['email'];". I inserted {{ email }} into "order_alert.twig" but the respective mail sent to my account did not contain the email address. In fact, it contained nothing new. So I simply copy/pasted {{ order_id }} to see if changes to the "order_alert.twig" file are noted/processed at all. And they are: The email I received contained the respective order ID twice.
If I copy/paste variables which are already used in "order_alert.twig", everything works as expected.
Using any other varible available within the $data-array in "order.php" and putting {{ VAR_NAME }} into the twig file does not work, though.

Does this help?
If not, I can elaborate even more.

Thanks for your time!

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by adamharrisuk » Mon Jan 08, 2018 5:50 pm

I'm also looking to change the admin confirmation email! The standard one is pretty useless.

Newbie

Posts

Joined
Sat Jan 09, 2016 2:44 am

Post by straightlight » Tue Jan 09, 2018 7:43 am

adamharrisuk wrote:
Mon Jan 08, 2018 5:50 pm
I'm also looking to change the admin confirmation email! The standard one is pretty useless.
More information would be needed.

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 enduroforum » Fri Jan 12, 2018 5:50 am

I think an answer to my original issues would also be helpful for what adamharrisuk is looking for.

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Fri Jan 12, 2018 6:12 am

enduroforum wrote:
Fri Jan 12, 2018 5:50 am
I think an answer to my original issues would also be helpful for what adamharrisuk is looking for.
Then, you would also need to provide more information based on this inquiry.

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 enduroforum » Fri Jan 12, 2018 8:01 am

See my post #9: What kind of additional information are you looking for with respect to my initial question/enquery/problem?

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Fri Jan 12, 2018 9:48 am

enduroforum wrote:
Fri Jan 12, 2018 8:01 am
See my post #9: What kind of additional information are you looking for with respect to my initial question/enquery/problem?
The exact variables of your codes with their values or the attachment file that shows your modifications.

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 enduroforum » Fri Jan 12, 2018 8:37 pm

Original \opencart\catalog\view\theme\default\template\mail\order_alert.twig
{{ text_received }}

{{ text_order_id }} {{ order_id }}
{{ text_date_added }} {{ date_added }}
{{ text_order_status }} {{ order_status }}

Code found in \opencart\catalog\controller\mail\order.php
Line 101: $data['order_id'] = $order_info['order_id'];
Line 105: $data['email'] = $order_info['email'];

Edited \opencart\catalog\view\theme\default\template\mail\order_alert.twig
{{ text_received }}

{{ text_order_id }} {{ order_id }}
{{ text_order_id }} {{ order_id }}
{{ email }}
{{ text_date_added }} {{ date_added }}
{{ text_order_status }} {{ order_status }}

The edited "order_alert.twig" returns the order ID twice but does not give the email address.
Thus, as I said before: If I copy/paste variables which are already used in "order_alert.twig", everything works as expected.
Using any other varible available within the $data-array in "order.php" and putting {{ VAR_NAME }} into the twig file does not work.

Please let me know if you need more Information to help me with this.

Thanks.

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Sat Jan 13, 2018 6:34 am

Code found in \opencart\catalog\controller\mail\order.php
At this lines did you added these entries in the controllers and under which method name?

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 enduroforum » Sun Jan 14, 2018 7:32 pm

All I did is described in the above posts.
If there is anything else I need to do in order to add additonal fields to the order confirmation mail, kindly let me know.

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Sun Jan 14, 2018 7:47 pm

Code found in \opencart\catalog\controller\mail\order.php
Line 101: $data['order_id'] = $order_info['order_id'];
Line 105: $data['email'] = $order_info['email'];
What you did is also indicating this portion of the code but did not mentioned where exactly in the mail/order.php file you did added those lines.

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 enduroforum » Sun Jan 14, 2018 11:57 pm

As I stated: "Coude FOUND in ..."
It's nothing I added. Opencart contains this code within order.php.

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Mon Jan 15, 2018 12:04 am

Now, I understand. Ok, the reason why that's the case it's because you are attempting to use the email within the order alert TWIG files but the core only uses it in the order add TWIG file of the catalog/view/theme/<your_theme>/template/mail folder.

To rectify this, in your catalog/controller/mail/order.php file, in the alert(&$route, &$args) { method,

find:

Code: Select all

$data['order_id'] = $order_info['order_id'];
add below:

Code: Select all

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

$data['email'] = $order_info['email'];
Then, in your order_alert.twig file, you can then replicate the {{ text_email }} and the {{ email }} of the order add 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 enduroforum » Tue Jan 16, 2018 4:17 am

Hi

Adding these lines does not change a thing. :-(
I cleared all cashed afterwards.

See my other problem with the shopping cart: viewtopic.php?f=202&t=200989

Seems to be the same issue: No matter what I change, issues remain.

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Tue Jan 16, 2018 5:59 am

As a test, in your admin/controller/common/dashboard.php file,

after:

Code: Select all

<?php
add:

Code: Select all

echo 'test123';
Then, go to your admin dashboard. Do you see the test123 on the top of the page?

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 enduroforum » Wed Jan 17, 2018 4:20 pm

Hi (and thanks for staying with me!)

Yes, that worked!

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am

Post by straightlight » Thu Jan 18, 2018 5:39 am

Is your storage folder located outside of your public_html folder? If not, it has to be by also configuring your config.php and admin/config.php files for the modified DIR_STORAGE as well as removing the entire line in your .htaccess file where the ^system/storage folder is specified.

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 enduroforum » Tue Jan 23, 2018 5:48 am

I am about to give up...
Editing these files should be so freaking easy!?

I removed OC 3.0.2.0 since no code adjustments within any PHP file were reflected. I even tried this on a freshly installed instance: Same issues. Not even the "your cart is empty"-bug could be remediated.
So, I am now runing on OC 3.0.1.1. At least this version does not have the "your cart is empty"-bug (hurray!).

Still, though, changes to the PHP files seem to be ignored:
- I went to "\catalog\controller\mail\order.php" and inserted:

Code: Select all

$data['text_email'] = $language->get('text_email');
$data['email'] = $order_info['email'];
- I went to "\catalog\view\theme\default\template\mail\order_alert.twig" and inserted:

Code: Select all

{{ text_email }} {{ email }}
The result was that within the alert email, there was an additional line break where I expected the email address.

In addition, I went to "\catalog\controller\account\account.php" and removed:

Code: Select all

$data['newsletter'] = $this->url->link('account/newsletter', '', true);
From my understanding, this should remove the newsletter link from the right column on the "my account" page of the front end user.
Guess what!? Nothing changed!

Am I really the only one who is having such problems?

I generally agree that the root cause of errors sits mostly between the keyboard and the chair... but as I said: I am running a fresh version of OC.

Could this be a caching problem? Something else I noted just today:
- I add an item to my cart
- The button on the top right side of the page instantly changes and reflects the respective amount
- I click on this button, a box opens and click on the cross behind the item in order to remove this item from the cart.
- The box closes and the button does not show any amount.
- I click on the button, a box opens and I DO SEE the item I actually removed.
- Actually going to my cart reveales that the cart is empty.
Image

Sounds like a caching issue to me.

Newbie

Posts

Joined
Thu Nov 23, 2017 12:15 am
Who is online

Users browsing this forum: No registered users and 220 guests