Skip to main content
5 votes
Accepted

Get my custom variable into an email template

There's a simple way you can do this. Creating a custom variable for the email can be too much time consuming, so the easiest way to get this result would be using a .phtml file on your transnational ...
Arunendra's user avatar
  • 7,458
4 votes

Magento 2.4.x: How to pass custom variable from controller to phtml file?

Why would you want to use a registry ? Is there a reason beyond this ? You need to pass variables threw controller and block depending on how the templates is defined. For example : Template ...
Claims's user avatar
  • 1,191
3 votes

How to add template in Custom Variable HTML Value in magento

you can add your phtml file in email template simple add the like this and add your coding in template.phtml. {{block type='core/template' area='frontend' template='my/template.phml'}}
Qaisar Satti's user avatar
  • 32.5k
3 votes
Accepted

Magento 2: format var invoice.created_at

I solved the problem by adding a new function to Model/Order/Invoice.php: public function getInvoiceDate(){ $cdate = $this->getCreatedAt(); $invoiceDate = date('d. M. Y', strtotime(...
crrdr's user avatar
  • 46
3 votes

How to call Magento 2 custom variables in phtml file?

You can use this below way : $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface'); $storeID = $...
Rohan Hapani's user avatar
  • 17.5k
2 votes
Accepted

How to use custom variables in phtml file for email

pass a array $emailTemplateVariables['code'] = array('code12'=>'AB56FFD','code13'=>'AB5fd6FFD','code14'=>'AB56dfFFD') ; you have to pass variable to phtml file {{block type="core/...
Qaisar Satti's user avatar
  • 32.5k
2 votes
Accepted

Magento 2 - Transactional email templates

Try replacing your code with the below snippet. <li style="background: black; color:white;"> If you have any questions please feel free to contact us at <a href={{ trans config ...
mydons's user avatar
  • 491
1 vote

How to add billing Country_id from sales_order_adress in Email Template

Please try with the following code. {{var order.getShippingAddress().getCountry()}} //Get the country’s ID {{var order.getShippingAddress().getCountryModel().getName()}} //Get the country’s full name ...
Jitendra Patel's user avatar
1 vote

Magento 2.4.x: How to pass custom variable from controller to phtml file?

When you create your block with $block = $this->_view->getLayout()->createBlock('module\Block\Adminhtml\CustomBlock');, you can pass data to it using the 3rd argument to the createBlock ...
S.Shah's user avatar
  • 77
1 vote
Accepted

Control Variabile Print fron Backend

A lot of Magento modules have the ability to disable them from the backend. Choose any module with that possibility, and copy & modify the necessary files. In [yourModule]/etc/adminhtml create a ...
S.Murtadha's user avatar
1 vote
Accepted

How would it be possible to change the color for a url that is a Custom Variable inserted in a transactional e-mail?

You should create a .less file for styling the email templates. Here are the steps: On your custom variable, add a class for the anchor tag. Ex: <a class="anchor-style" href="https:...
Steven Nguyen's user avatar
1 vote

Magento 2 email_order_set_template_vars_before observer triggers only when I resend email in the admin

The described behaviour point to wrong placed the events.xml file in the directory hierarchy. If you want to catch dispatched event globally (in frontend and admin) you need to declare events.xml file ...
Adam S.'s user avatar
  • 151
1 vote

Add email variable to all transactional emails

Assume you want to add custom variable in Email main content section but not in Email Header or Footer section. To add a custom variable, please follow below admin path. 1) Login into admin. 2) go ...
Pritam Biswas's user avatar
1 vote

magento 2 dynamic value not comes in custom email template

You need to pass values in templateVars like this $this->_transportBuilder->setTemplateIdentifier($this->temp_id) ->setTemplateOptions(['area' => 'frontend', 'store' => $...
Ramkishan Suthar's user avatar
1 vote
Accepted

Magento 1 - Can Custom Variables be translated?

Yes, you can translate custom variables, but similar to product attributes, this is not per language, but per store view. When editing the variable, you can change the store view and override the ...
Fabian Schmengler's user avatar
1 vote

How to use custom variables in Magento 2?

From what I have used custom variable, it is only for passing admin manageable value to your code, you can access it as follows; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $...
Vivek Kumar's user avatar
  • 5,665
1 vote

Get plain value from custom variable in php with objectManager

Class Magento\Variable\Model\Variable offers everything - such as setStoreId(StoreId), which needs to be set case by case for my application. There is no need to dig into Magento\Variable\Model\...
rico's user avatar
  • 31
1 vote

use customer variable text in email

You need to get customer attribute label first in your code and then pass it to your email template. $marketerName = $customer->getResource()->getAttribute('marketer_name')->getFrontend()-&...
Jaimin Sutariya's user avatar
1 vote

Magento(1.6.2.0) add custom customer registration field to email template

You can customize the Transactional Email by adding additional variables. Take a look at the examples at: "/app/locale/en_US/template/email/*" If its an email template that already has defined the ...
Phil M's user avatar
  • 748
1 vote

How to add template in Custom Variable HTML Value in magento

You can do that through layout in your email template. Step 1: add this {{layout handle="customer_email_template_custom"}} in your email template. Step 2: Add handle in your theme local.xml. <...
MeenakshiSundaram R's user avatar
1 vote

How to add template in Custom Variable HTML Value in magento

You can't. Custom variables are designed to be used the other way around: you can output the value of a custom variable in your templates. They are not parsed in any way. If you want to output a ...
Mark van der Sanden's user avatar
1 vote

Get my custom variable into an email template

For this you need to first find a controller from which email is triggering. If you want to find a controller then you can get controller path by action of form if it is using any form or else you ...
Ashish Madankar M2 Professiona's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible