In the emails of the Magento 2 orders, all the details of the purchased product arrive, but I would also be interested in placing the image. Someone has implemented it so they can help me, I've tried to find the magento email templates to edit them, but it's all a mess.
I appreciate your help!
Someone has implemented it so they can help me, I've tried to find the magento email templates to edit them, but it's all a mess.
For this you have to override below file from "vendor" folder
vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml
To your theme's design folder
app/design/frontend/[VENDOR]/[TEMPLATE]/Magento_Sales/templates/email/items/order/default.phtml
And then fetch product image using below code.
$_item = $block->getItem();
$_order = $_item->getOrder();
$_store = $_order->getStore();
$_imageHelper = \Magento\Framework\App\ObjectManager::getInstance()->get('Magento\Catalog\Helper\Image');
$_baseImageUrl = $_store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA).'catalog/product';
And add below Image tag inside first <td> above <p class="product-name">
<img src="<?= $_imageHelper->init($_item->getProduct(), 'small_image', ['type'=>'small_image'])->keepAspectRatio(true)->resize('65','65')->getUrl();?>" alt="<?= __('Product Image');?>">
you can add Image as separate column as well. But for that you have to override below file as well.
vendor/magento/module-sales/view/frontend/templates/email/items.phtml
And need to add extra <th> In <table class="email-items">
Please try this solution and let me know if you face any issue.
Related
Situation:
I am a HTML newbie who gets by through Google-fu and I am in charge of a tool which sends HTML email to customers.
I have been asked by our customers (Because pressing reply and typing a single word is really difficult) if I can create buttons on the emails I send which allows them a 1-click reply.
Conditions:
The reply has to come from their own email address
It needs to go back to the email address that sent the email (We have one template email which can be sent from several addresses)
It needs to maintain the same subject line (It contains a reference number to ensure the email is processed correctly when received)
Must be created using inline HTML(4 or 5) only (Restrictions of the system that generates the email)
Ideally will send the reply immediately (And show them as much in some manner), but opening up a new email already pre-populated is an acceptable alternative
I have struggled to find much at all on this, which leads me to think that it is not possible.
If using tiny bit of pure javascript, that does not need any external library on your website.
This code goes to your website where you want your check to be made.
<script>
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
}
document.addEventListener("DOMContentLoaded", function(event) {
if(getURLParameter('answ') == 0) document.getElementById('answered_yes').remove();
else if(getURLParameter('answ') == 1) document.getElementById('answered_no').remove();
else {
document.getElementById('answered_yes').remove(); document.getElementById('answered_no').remove();
}
});
</script>
<div id="answered_yes">
THIS IS HOLDER FOR YES ANSWERER //Put your wanted info hare if he answered yes
</div>
<div id="answered_no">
THIS IS HOLDER FOR NO ANSWERER //Put your wanted info hare if he answered no
</div>
Now on email links put these type of links.
<a href="yourwebsite.com/index.php?answ=0" target="_blank" >ANSWER NO</a>
<a href="yourwebsite.com/index.php?answ=1" target="_blank" >ANSWER YES</a>
What this does is simply puts a parameter on a link called answ that has 0 or 1 by my setting and once your website gets a request it checks which parameter is it 0 or 1. If its 0 that means we remove the div that says yes, otherwise do the same with no div.
with only html it is not possible unless you would give him different links as in.
<a href="yoursite.com/he_answered_no.html" >No</a>
<a href="yoursite.com/he_answered_yes.html" >Yes</a>
And put your contents inside there.
However if you are going to use this script in your website, put that code somewhere in the body, its not perfect, but it will do the job. Then put your information on yes div and on no div, its going to remove whatever div he answers too.
But like I mentioned, with purely HTML it is not possible only adding some bits with other languages, pure javascript should work on any HTML site, unless you are trying to add the code to some kind of platform that blocks any ongoing scripts.
You can just use a "mailto:" link similar to this:
Email Us
Here's the link with more info: https://css-tricks.com/snippets/html/mailto-links/
It will open up a prepopulated email with the "to" address, subject line, and body text already inserted. People will be able to modify the text if they want or just click send. You would need to some way to dynamically change the subject line to the one the customer received, but your email tool probably has that capability.
I use magento 2, when submit contact form then issue on mail, when receive successfully but problem is apostrophe character.
Suppose any Customer write comment like: Can't able to login then in mail
display like: Can ' ; t able to login
I use 4-5 latest version all version this common issue,
Please help to resolve if you know
Go to this path "/vendor/magento/module-contact/view/adminhtml/email" and open "submitted_form.html" and replace 19th line code with the below-mentioned code
{{trans "Comment: %comment" comment=$data.comment|raw}}
Adding to the comment of Abhinav Kumar Singh, there's another way for those who are working with copies of the default e-mail templates in admin backend: MARKETING > COMMUNICATIONS > E-MAIL TEMPLATES.
No need to override original Magento files.
After you have imported the Contact-Form Template, you will find the same syntax in the Template Content field. Just add the "|raw" tag there.
{{trans "Comment: %comment" comment=$data.comment|raw}}
or
{{var data.comment|raw}}
We are a dating application that wants to engage our users and thereby we want the ones in a week to send to our users report email about their activity, And of course the activity of every use should be unique.
Here is the example of the report, we want to deliver:
Hi, `User`,
You are receiving this notice because you have unread messages!
Do not miss your chance, maybe one of these messages were sent by your significant other!
Unread messages from these users:
Maria, 39, Rostov, link to profile of Maria, link to image of Maria
MIA, 33, Minsk, link to profile of MIA, link to image of MIA
Elena, 33, Kiev,link to profile of Elena, link to image of Elena
Click here to see all messages
I would like to use the one of leading Transactional or Marketing Email Services, but I don't know which one of them could give us solution to this need.
I've used MailJet email transactional service for this matter. They support possibility to add unlimited number of custom properties.
So far I advanced very well with the task doing the following:
Added custom properties for all needed properties
I've uploaded contact list details with all data via a CSV file
I've written a raw html template and bounded the template's placeholders to the custom properties of list details
For example:
<div class="new__faces__img"><img src='[[data:visitor1.photo]]'></div>
<div class="new__faces__name">
<span>[[data:visitor1.name]]</span>, [[data:visitor1.age]]
</div>
> other visitors ...
<div class="new__faces__img"><img src='[[data:visitor12.photo]]'></div>
<div class="new__faces__name">
<span>[[data:visitor12.name]]</span>, [[data:visitor12.age]]
</div>
I`m trying to add link to order review in order confirmation email:
<a href="{{store url="sales/order/view/order_id/}}"{{var order.id}}" style="color:#1E7EC8;">
But when customer get the email it links just to http://mysite/sales/order/view/
Hi,
<a href="{{store url="sales/order/view/order_id/"}}{{var order.id}}" style="color:#1E7EC8;">
This is okay but it still not shows full link. It shows only sales/order/view/.
To show **order_id/**, you have to create Custom Variable.
Go to **System >> Custom Variables**.
Check Image below.
**http://imagizer.imageshack.com/img922/1470/tI8BGv.png**
Now create custom variable shown in image with any name.
Now revise the code and change the line.
<a href="{{store url="sales/order/view/"}}{{customVar code=static_url}}{{var order.id}}" style="color:#1E7EC8;">
It's working fine for me.
Thanks & Regards.
Move your quotes.
<a href="{{store url="sales/order/view/order_id/"}}{{var order.id}}" style="color:#1E7EC8;">
I need to add a checkbox with text "Send a copy of this email to yourself" to Contact Form 7 in WordPress, so the sender can receive a copy of the message he sents.
I can't find anything on google, so your help would be really appreciated.
Thank you.
In the solutions above you can have two recipients, but you asked about a mail copy, so a carbon copy perhaps. The best practice is to use the "additional headers" functionality of the "contact form 7" wp plugin.
Good luck! :)
P.S.: But with checkbox it is more complicated, you need to use JS validation in "Form" box.
I am not using Contact Form 7 anymore but as far as I remember on the settings page of your form, there are two areas called Mail. The first one is for receipment and you can enable the other one by checking the checkbox Mail(2). That one is for copies.
http://s.wordpress.org/extend/plugins/contact-form-7/screenshot-1.png?r=561651
By the way, I recommend using: http://www.gravityforms.com/
Very easy to use and lots of options to play with.
add this code to your theme's functions.php
add_filter( 'wpcf7_additional_mail', 'my_wpcf7_use_mail_2_or_not', 10, 2 );
function my_wpcf7_use_mail_2_or_not( $additional_mail, $cf ) {
if ( 'yes' != $cf->posted_data['sendcopy'] )
$additional_mail = array();
return $additional_mail;
}
and alter the select tag to this:
[select sendcopy "no" "yes"]
Copy email form the one with mail tags that you receive and place it to the mail(2) field. and
ticke the Mail(2). then your Mail(2) will be active only when they select "yes".
In the mailing address input field you can just add additional email addresses separated by a comma.
+1 for Gravity Forms too. It's developer licence is well worth the money a brilliant plugin.