Questions tagged [variables]
The variables tag has no usage guidance.
112 questions
0
votes
0
answers
19
views
How to reference dynamic product info in a category text
I want to be able to reference the price of a certain product in a category text, but this price will change over time, so I want to reference it dynamically.
Is this natively achievable?
If no, how ...
0
votes
1
answer
88
views
Magento 2 email template - click to send email
I am including a variable email in my template. But it does not format to be clicked and open in the recipients email app (specifically gmail). I have figured out how to do this with a hardcoded ...
1
vote
0
answers
144
views
List of custom variables that can be accessed inside a static block
What I want to do is inject variables into static blocks. I know this can be achieved in System -> Custom Variables but it wouldn't be any quicker than opening up every static block to change the ...
0
votes
2
answers
1k
views
Display product attributes in cms block or page builder
I need to be able to reference product attributes inside a cms block or page builder, I am not wanting to create any template files I am wanting to call it like you can call a variable.
So here is one ...
0
votes
1
answer
164
views
How to get the Order Id, Name and Email variables for a Shopper Approved survey?
Magento 2.4.2-p1
Smartwave Porto theme
extensions from Amasty
subscribed to a Review service from Shopper Approved
We have been subscribed to the service from Shopper Approved for a long time. This ...
0
votes
1
answer
47
views
Issue with get product attribute value in other place than list.phtml
Currently via below code I can get in list.phtml
From this I get brand name dropdown value in list.phtml correct:
<div class="brand-name"> <?php
$optionText = '';
...
0
votes
1
answer
462
views
Magento 2 : How to Override Core Template Magento_Review::helper/summary.phtml
How to change the template in a custom module.
Original path = vendor/magento/module-review/view/frontend/templates/helper/summary.phtml
I want to change this template to my own when my module is ...
1
vote
1
answer
507
views
Magento 2: How to include auto-generated coupon code in Newsletter Subscribe email template
I want to include auto-generated coupon code that expires in 1 usage in newsletter subscribe email template.
Any help will be appreciated.
1
vote
0
answers
280
views
Magento 2: Credit Memo refund amount in transactional email
So, I have a custom email setup for credit memo and I am using {{var creditmemo.grand_total}} variable to display refunded amount in my transactional email. Everything is fine except I want to show ...
0
votes
1
answer
124
views
Migrated Magento 1 Customer address does not show (shows variables as output instead)
First off, I have searched for a solution here, and on Github, this has never been answered specifically from what I can see, none of the answered items work.
Migrated Magento 1 address information ...
0
votes
1
answer
231
views
Convert Magento 1 (migrated) email templates to Magento 2 (variables)
Migrated Magento 1 into Magento 2 does not seem to contain any 'default' Magento 2 email templates (using the Magento 2 migration tool). It only contains the Magento 1 email templates that were ...
1
vote
0
answers
99
views
Magento 2 common css variables not applied for third party modules
I am using a custom theme, declared common variables under,
app\design\frontend\Zero\my_theme\web\css\source\components
1) _variables.less
Eg:
@h1__font-size: 48px !important;
2) common.less
Eg:
h1 {
...
0
votes
1
answer
32
views
Other Method for call a custom customer attribute
I am doing an internship in a company, and my internship supervisor wants me to display customer data.
More precisely, on the back office in the customer information there is a custom attribute that I ...
0
votes
1
answer
391
views
Magento 2 Notice: Undefined variable: images
I use custom variable in Mirasvit Extension for export parent images also from variants.
For test I export single product and working correct. Now I set filter with export all configurable products in ...
0
votes
1
answer
439
views
Magento 2 - How to add customer name in CMS page/block?
I need to add the name of the customer into a CMS Site or Block. I tried to insert {{var customer.name}} as seen in the documentation, but it does not work.
0
votes
1
answer
165
views
Global variable override by Bootstrap style
I have declare h1 tag font size in global variable,
app\design\frontend\zero_theme\theme\web\css\source\components_variables.less
@h1__font-size: 48px !important;
Declare inside the custom less file,
...
0
votes
1
answer
183
views
How to input these variables in a magento 2.3.4 mail template
We would like to display these variables in a new email template (which is currently assigned to a orderstate):
Ordernumber, Customername, Order Status & Invoicenumber.
The following code does not ...
0
votes
1
answer
152
views
Custom variable access using 'var' on working on product detail page in magento 2
I am trying to access custom product attributes value in product description on product detail page using 'var' Like for e.g {{var waz_origin}}
But i am not getting its value on frontend. See https://...
2
votes
0
answers
221
views
How to use product name variable in product description - Magento 2.3.5
I would like to create one product description that I can copy and paste into multiple products. Is there a way to pull the product name and other product attributes with a custom variable into the ...
0
votes
2
answers
458
views
Can i import theme variables to custom less file?
I want to add a variable that located in "web/css/source/_theme.less" to my custom less file, that I created specialy for home page. I added my less file in "Magento_CMS/layout/cms_index_index.xml"
&...
2
votes
0
answers
184
views
Adding Predefined Variables to New Email Template?
I am creating a new email template and am trying to attach predefined variables (specifically Order Id) to the new template. I would like the option of clicking on the "Insert Variable" button and ...
1
vote
1
answer
527
views
Display Customer Email, Customer Phone, Product Name, Product SKU in email template in magento 1.9
I need to display Customer Email, Customer Phone, Product Name, Product SKU in order email.
{{template config_path="design/email/header"}}
{{inlinecss file="email-inline.css"}}
<p><...
1
vote
0
answers
37
views
M2 - Variables empty in CMS Pages
No matter if System Variable or from the STORES > CONFIGURATION > Store Information fields, I can not output variables in cms pages. It feels like I'm missing something so basic, that I can not even ...
0
votes
0
answers
366
views
Magento2 Back End is working fine but front end is not working and showing This page isn’t working error
I am working on a Magento 2 project, and it was working fine until today, but now when I try to open it, the page is not working.
The following error is coming in error log:
PHP Fatal error: ...
6
votes
2
answers
9k
views
Magento 2: Pass variable from phtml to js
here is my layout
<referenceContainer name="minicart.addons">
<block class="Vendor\Mymodule\Block\Cart\Sidebar" name="shipping_bar" template="Vendor_Mymodule::cart/minicart.phtml">
...
0
votes
2
answers
632
views
Email variable order.getShippingAddress().getStreet1() returns null
I have created custom order email template and placed some order shipping address variables inside it.
Most variables work ok, but the following are always returning no value:
{{var order....
2
votes
1
answer
625
views
Variable for invoice date - Magento 2.2.6
Is there a variable for the invoice date (invoice created on...) in Magento 2? I would like to add this to the standard template for invoice pdfs.
Thanks in advance!
5
votes
3
answers
4k
views
Magento2.3 : Email template address variable not displays the value
The email template doesn't get a shipping method variable.
As you can see $billing.getName not works.
Shipping and Billing information is empty.
Maybe something wrong with forms or submitting ...
1
vote
1
answer
1k
views
Dynamically add year variable to meta title / description in Magento 2
I am trying to automatically add the current year to the meta title and description in for example category-pages. I want to achieve something like this:
Meta title: "The best category items for {{...
0
votes
1
answer
33
views
get querystring variables to display on static page
How to get querystring information and display on a landingpage?
This is a link created on another website with variables to pass to magento2.3.1 website.
www.mymagentowebsite.com/staticpage.html?w=...
1
vote
1
answer
653
views
M 2.3.1: Imprint variables are not showing up in E-Mail templates
I have the following problem.
I have populated the bank and imprint data as per Configuration -> General -> Imprint for all my store views under Magento 2.3.1
Now I am populating my e-mail ...
0
votes
1
answer
3k
views
Add email variable to all transactional emails
Is there any way to add one email variable to all transactional emails?
My idea is to create a custom variable, put some code in it and display it in all transactional emails.
0
votes
1
answer
339
views
how to validate custom fields using variables in magento 2
here have two fields
1)Fields_1
2)Fileds_2
here i want to validate Field_2 < Filed_1 (less than )
how i do this in magenot 2???
Field_2 Tag
<div class="field">
...
0
votes
1
answer
410
views
How to convert template variables to custom data in magento 2
I have configured a back-end screen where I will enter a string as
{{price}} for guest user. click here {{sign_up}}.
So after I fetch the field value I want to dynamically replace the {{price}} ...
1
vote
0
answers
244
views
Email templates - variables names get translated instead of showing the value
I'm using magento 2.2.6.
My email templates are displaying the translation of the variable used and not their value.
I have installed a translation pack for Romanian.
0
votes
1
answer
359
views
Magento variable for access token
currently I have hardcoded my API token in my controller, Need to make it configurable so that it can be configured when the code is deployed in production.
So how can I store it on Magento variable ...
2
votes
0
answers
63
views
magento 2 I want to write the dynamic {{var shipping_company}} into the xml file
Helllo,
i want to set the the dynamic value of variable into xml file
try {
$om = \Magento\Framework\App\ObjectManager::getInstance();
$filesystem = $om->get('Magento\Framework\...
2
votes
4
answers
4k
views
how to pass a variable from one phtml to another?
I have two phtml which have its own unique block file. I need to pass variable from one phtml to another.
PHTML 1
<?php
$option_id = 20;
?>
<a href="<?php echo $baseUrl ?>/...
2
votes
3
answers
1k
views
Magento 2 add customer group as Email Template variable
In magento 2 it is possible to create Email Template variables, however, those variables are html or plain text.
I'd like to create a variable containing the user group, so i can use this variable to ...
2
votes
2
answers
4k
views
Magento 2 system variable for "Order Created at" for email templates
What is the email template system variable for "Order Created at" for Magento ver. 2.2.6?
Using the variable name: {{var order.getCreatedAtFormated('long')}} doesn't work for me. This is a variable ...
2
votes
1
answer
1k
views
How to get value in function that is retrieved and stored in a variable of another function in same class | Magento 2
I want to use $orderId value in other functions.
Here is class
<?php
namespace vendor\module\Observer;
use Magento\Framework\Event\ObserverInterface;
class Observer implements ObserverInterface
...
2
votes
2
answers
602
views
Passing magento username and email variables into js script (Magento ver. 2.1.8)
<!-- Head -->
<script src="https://wchat.freshchat.com/js/widget.js"></script>
<!-- Head -->
<script>
window.fcWidget.init({
token: "WEB_CHAT_TOKEN",
host: "...
1
vote
2
answers
2k
views
Getting the Store Name in a Block
Is it possible to output the store name using double curly brace syntax?
For example, I know I can output the contact page's URL using:
<a href="{{store url="contact"}}">Contact Luma</a>
...
1
vote
1
answer
222
views
How to remove first few digits from order id using order id variable in email template
I am using a 3rd party plugin for order number customization and the format I am using is- {order id}-{counter}AB
e.g. 1234-30000AB
In the email template when I include order id variable it ...
0
votes
1
answer
439
views
Magento 2: Parsing Item information through block
I want to create a phtml file and create a dynamic block with that one to put on CMS pages - Take it as product information blocks where i want to display the product name, the price, the URL - ...
1
vote
2
answers
2k
views
How can we pass table to an html variable in php code? Magento2 TCPDF
I am using TCPDF Library to get PDF Downloadable. I have to pass retrieved data through loops to single vaiable as:
$tcpdf->writeHTML($html, true, false, true, false, '');
I have to pass these ...
0
votes
2
answers
2k
views
Magento 2 | Variable with StoreViewCode
I want to get the BaseURL with the StoreViewCode via Magento 2 Variables but with no success. I have the "add Storeview to URL" enabled at the Backend and using the following variable only shows the ...
0
votes
1
answer
5k
views
How to set session variable
I need to set a variable session in Magento, do I do just procedural PHP or is there a proper way in Magento 2 ?
Example :
$_SESSION['myKey'] = "00001";
@AnsarHunsain code help me, but I can't get ...
0
votes
0
answers
85
views
Customising email variables
Is it possible to customer email variables? For example, there is a variable for Shipping description: {{var order.getShippingDescription()}}
In the email I want to change new lines (\n) to be line ...
0
votes
1
answer
237
views
Magento2: variables
I need to configure a script that sends a survey to clients to fill in for trusted reviews.
<script type="text/javascript">
client_email = ‘here I want display: CUSTOMER EMAIL ADDRESS’;
...