Questions tagged [variables]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
131 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 ...
user avatar
  • 1
0 votes
1 answer
35 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 ...
user avatar
  • 256
0 votes
1 answer
34 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 = ''; ...
user avatar
  • 2,096
0 votes
0 answers
7 views

Introduction Packs/Bundled Product

I would like to sell a INTROPACK1 which consists of SKU A1, A2 and A3. When the customer adds INTROPACK1 to their basket, is there a way we can set up the product in the backend where the INTROPACK1 ...
user avatar
0 votes
1 answer
128 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 ...
user avatar
  • 45
0 votes
1 answer
187 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.
user avatar
0 votes
0 answers
11 views

declared variable correct format

I am not sure I do it right or not to declared variable in a template phtml file I have 4 variables $canadaPostCarrierCode = 'canadapost'; // Canada Post carrier code $canadaPostURL = 'https:/...
user avatar
  • 518
0 votes
0 answers
45 views

How do I pass JavaScript variables (from jsfile) in to PHPfile in magento 2

How i pass the js varible from custom js file in to my custom module php file, because i create dropdown in header and i need to use that value for adding some condtion in php file and custom js file ...
user avatar
  • 1
0 votes
0 answers
26 views

Variables for emails in M2

After migrating from Magento 1 to Magento 2, many variables stopped working - the list is not so long - but still, can someone suggest which correct variables are better to use that letters displayed ...
user avatar
  • 67
1 vote
0 answers
42 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 ...
user avatar
0 votes
1 answer
58 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 ...
user avatar
0 votes
1 answer
79 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 ...
user avatar
1 vote
0 answers
45 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 { ...
user avatar
  • 105
0 votes
1 answer
29 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 ...
user avatar
0 votes
1 answer
85 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 ...
user avatar
  • 2,096
0 votes
1 answer
190 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.
user avatar
  • 2,461
0 votes
1 answer
80 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, ...
user avatar
  • 105
0 votes
1 answer
86 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 ...
user avatar
0 votes
1 answer
52 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://...
user avatar
  • 700
2 votes
0 answers
128 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 ...
user avatar
  • 36
0 votes
2 answers
169 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" &...
user avatar
1 vote
0 answers
86 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 ...
user avatar
  • 11
1 vote
1 answer
239 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><...
user avatar
1 vote
0 answers
30 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 ...
user avatar
  • 21
0 votes
0 answers
283 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: ...
user avatar
6 votes
2 answers
4k 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"> ...
user avatar
  • 641
0 votes
2 answers
444 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....
user avatar
  • 591
2 votes
1 answer
383 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!
user avatar
  • 21
5 votes
3 answers
3k 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 ...
user avatar
  • 413
1 vote
1 answer
824 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 {{...
user avatar
  • 165
0 votes
1 answer
26 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=...
user avatar
  • 142
1 vote
1 answer
531 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 ...
user avatar
  • 47
0 votes
1 answer
2k 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.
user avatar
  • 601
0 votes
1 answer
266 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"> ...
user avatar
  • 1,047
0 votes
1 answer
315 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}} ...
user avatar
1 vote
0 answers
91 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.
user avatar
0 votes
1 answer
135 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 ...
user avatar
  • 799
2 votes
0 answers
37 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\...
user avatar
2 votes
4 answers
3k 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 ?>/...
user avatar
  • 828
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 ...
user avatar
1 vote
2 answers
3k 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 ...
user avatar
  • 2,749
2 votes
1 answer
576 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 ...
user avatar
  • 1,551
2 votes
2 answers
335 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: "...
user avatar
  • 317
1 vote
2 answers
1k 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> ...
user avatar
  • 149
1 vote
1 answer
163 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 ...
user avatar
0 votes
1 answer
359 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 - ...
user avatar
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 ...
user avatar
  • 1,551
0 votes
2 answers
1k 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 ...
user avatar
0 votes
1 answer
4k 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 ...
user avatar
0 votes
0 answers
67 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 ...
user avatar
  • 2,439