Questions tagged [variables]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
2answers
65 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
1answer
24 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
1answer
12 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
1answer
21 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 template, ...
0
votes
1answer
50 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
0answers
23 views

when creating trying to insert variable in email template I receive [object Object]

I'm experiencing an issue when trying to insert variables in email templates. Instead of receiving a list with variables I'm receiving [object Object] I'm using Magento 2.3 and I migrated from 1.7 ...
0
votes
1answer
38 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
1answer
31 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
0answers
19 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
1answer
28 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 ...
1
vote
0answers
17 views

in 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\...
1
vote
3answers
274 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
3answers
183 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 ...
0
votes
1answer
224 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
1answer
40 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 ...
1
vote
2answers
131 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: "...
0
votes
2answers
261 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
1answer
37 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
1answer
122 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
2answers
358 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
2answers
106 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
1answer
579 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
0answers
32 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
1answer
47 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’; ...
1
vote
1answer
28 views

Source location for variables that can be change e.g background-color - Magento 2

Sorry for the simply question, I've seen in several posts that people have made a new theme and changed say the background of the homepage and would like to know where these variables are located. I ...
1
vote
1answer
58 views

{{store url=“ ”}} or {{base_secure_url}} or {{base_unsecure_url}} for my situation?

Which one of these is best if I am running one store and the test environment is running unsecure where as production is running secure and we're only planning to have one store in the Magento ...
0
votes
1answer
391 views

Magento 2: format var invoice.created_at

I'm using EaDesgin/magento2-pdf-generator2 to format the customer's invoice. This works nice. But in this template I use the magento 2 variable {{var invoice.created_at}}, what gives me the ugly ...
2
votes
1answer
334 views

is there a way to add custom variables to product description (using the editor) in magento 2?

I am using magento 2.2.2 and I want to add custom variables to the products description. for now, I can do that with the pages but not for the products (in the page editor there's a button called "...
0
votes
2answers
307 views

Magento 1 Variable to check if customer is subscribed to newletter

Is there a variable I can include in the transactional emails to show whether the customer has subscribed to the Newsletter or not?
0
votes
1answer
1k views

Sending variable to a bootstrap modal

I have seen this asked before but a lot of the answers I found where people looking to get a variable into a modal to query a database. However thats not what I want. I just want to send a variable ...
0
votes
1answer
294 views

Magento2 : third party js file including issue

I am using three.js (source code) in a module page: requirejs-config.js var config = { map: { "*": { three: "Vendor_Module/js/three/build/three", and in the phtml file : ...
0
votes
1answer
1k views

Magento 2 : How to pass variable to controller from observer

I am not able to pass variables to controller from my observer file. Below is the code for observer: class Sendtogateway implements \Magento\Framework\Event\ObserverInterface { ...
2
votes
0answers
33 views

Passing variable into head.phtml

I want to generate dynamic meta title categories, based on category level. In view.phtml category this is my code: <?php $category = Mage::getSingleton('catalog/layer')->getCurrentCategory(...
2
votes
2answers
941 views

Getting the shipping method code in transactional emails

We’re currently calling the variable "{{var shippingMethod}}” but it’s retrieving the description “fedex_STANDARD_OVERNIGHT”. Is there a way to grab the code in place of the description. For the ...
1
vote
1answer
144 views

How can I use my own custom system settings in e-mail templates?

I have this custom configuration in my system.xml: <system> <section id="general"> <group id="store_information"> <field id="support_phone" translate="...
4
votes
2answers
2k views

How to retrieve variable from CMS page in Magento 2

In Magento 1.9.x, we can do it like below In CMS page, add content: {{block type="core/template" name="..." my_vars="123,456" template="path-to/test.phtml"}} Create path-to/test.phtml: <?php ...
1
vote
1answer
430 views

Display Polls with a custom template shows only empty results

Meta Magento 1.9.2.1 Custom Template Poll works fine when in sidebar Poll works fine when loaded by layout xml History Based on this information: http://inchoo.net/magento/magento-frontend/...
0
votes
0answers
401 views

create custom variable for custom module in magento 2

Is it impossible to create a custom variable, such as {{var customer.getName()}} in a custom module and use it?
0
votes
1answer
487 views

Where can I change the value for direct_url privacy-policy-cookie-restriction-mode?

Although I can edit the cookie_restriction_notice_block to change the link to the relevant Privacy Policy page I would like to be able to change the value of {{store direct_url="privacy-policy-cookie-...
1
vote
1answer
1k views

Magento 1.9 {{var payment_html}} alternative

I'm writing my own function for sending emails. In the Magento email template, there's a variable {{var payment_html}} which I need to convert to $order object. The question is how can I get the ...
1
vote
1answer
318 views

Magento 1.9 sendTransactional doesn't show value from {{var payment_html}}

I'm using sendTransactional() to send emails programmatically. All working fine beside the variable {{var payment_html}} is empty. How to pass this value? below is the code I'm using now. private ...
0
votes
2answers
209 views

I have send custom mail and set the custom variable but. When I access the variable in transaction mail template then it will not work

This is my email sending code if (isset($_POST['send'])) { $templateId = 9; $sendername = 'Call To Order'; $senderemail = $_POST['email']; $sendermobile = $_POST['mobile']; $...
0
votes
4answers
2k views

Magento2 variable in transactional email

I would like to add customer email to order confirmation email, but can't figure out how to do that. Is there any predefined variable that i can use in Transactional email templates or what does it ...
0
votes
1answer
402 views

Hide {{var comment}} when field empty in email

I'm creating new order emails for my company and need some help with the variables. I want to include an order comment in the email, but only if there actually is one. When the field is left empty at ...
1
vote
2answers
582 views

Magento : Is It Possible to Call Model From Another Extension

I want to create custom module, but I need to acquire variable from another module. I've looked into their code and this variable is result of many different functions in different Models, which I ...
0
votes
1answer
75 views

Empty getAddToCompareUrl only in guest mode

I have this variable $_compareUrl=$this->getAddToCompareUrl($_product) to get compare url but this is empty in guest mode, only when i signed in magento it's not empty. I recently migrate from ...
1
vote
3answers
3k views

Magento 2 - How can I define constants or variables once and reuse them in a custom module?

I have a few constants that I'd like to define once and reuse many times within various files throughout my custom module. For example, I write log entries to a custom file. I'd like to add its pre-...
1
vote
3answers
2k views

Where do we store persistent single variables in Magento 2 (module settings)?

I've read through the Magento 2 dev docs, and I can't seem to find were we store persistent variables, if at all. I'm trying to store a token value for a custom module. I've searched a fair amount ...
1
vote
0answers
113 views

Magento 2: How to get JSON API Variable in Model

Below is the REST API called on Checkout Page, when you have multiple address & u click on "Ship here" magento/rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id It passes ...
1
vote
0answers
678 views

how to pass a custom variable from phtml file to email template [closed]

I am stuck in my custom code. I want to pass a custom variable from phtml file to template. I have added my template in email template: {{block type='core/template' area='frontend' template='order-...