Questions tagged [variables]
The variables tag has no usage guidance.
111
questions
7
votes
3
answers
8k
views
Magento 2 : How to call block file in order email with order variable?
Want to add some text/content in order email which is dependent on order data.
For this I want to call a template file, where I can get the order data and based on that I want to perform my ...
6
votes
1
answer
2k
views
Getting at variables from CMS block insertions
Magento 1.9
I am trying to add a form several times onto a CMS page with code similar to:
{{block type="core/template" template="page/html/jobappform.phtml"}}
But I want to pass a variable thru to ...
6
votes
2
answers
5k
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">
...
5
votes
2
answers
4k
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 ...
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 ...
4
votes
1
answer
498
views
CE 1.9.2 - Store custom data temporarily in the order object during checkout
I am trying to build a feature into an existing site that allows customers to earn loyalty points with a 3rd-party loyalty and rewards programme that they will need to be already registered with. The ...
4
votes
1
answer
847
views
Use store variables in checkout agreement links
Does anyone know the way to access the store variables in checkout agreement links? I want to use something like:
I confirm that I read the <a href="{{store url='agb'}}">terms and conditions<...
3
votes
1
answer
411
views
product ids separate with # on success page
I'm facing problem, need to show product ids separated with # on Magento success page
like:
shop_product_ids =‘#234#w475xk#5402#’;
How to handle it on Magento 1.9 success page.
Can anybody let me ...
3
votes
1
answer
3k
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 ...
3
votes
1
answer
274
views
Add current url as variable in CMS content
Is there a way to add current url in CMS content? Just like when I add the store name, something like this {{config path="general/store_information/name"}}
2
votes
1
answer
431
views
How to get value of a variable when variable has been sending through layout handle in Magento 2
Layout handle in email_template.phtml
{{layout handle="email_product_list" order=$order product=$product check=$check area="frontend"}}
I need to know how can i get the value of $check variable in ...
2
votes
3
answers
6k
views
How to add new Template Variable in magento
I want to add new template variable and use it in transactional email template from backend. Same as "Confirmation URL". Please refer to screen shot:
Thanks!!!
2
votes
2
answers
459
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: "...
2
votes
3
answers
4k
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 ...
2
votes
1
answer
460
views
Show review count outside of review template
I have a review.phtml template that shows the review count of the current product using this code:
if($this->getReviews()):
$rc = $this->getReviewCount();
if($this->getReviewCount() == 1):
...
2
votes
1
answer
849
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
1
answer
818
views
Magento 2 : Can we pass multiple variables in layout handle?
Can we pass multiple variables in layout handle.
like below code :
{{layout handle="email_product_list" order=$order product=$product area="frontend"}}
2
votes
1
answer
138
views
Math in email/CMS template variables
We have the following two attributes that are used in our transactional emails:
{{supplier_qty}}
{{qty}}
We would like to output the result of: {{supplier_qty * qty}}
For example, 5 * 1 = 5 (so 5 ...
2
votes
1
answer
502
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!
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 ?>/...
2
votes
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 ...
2
votes
1
answer
571
views
Current base_url (secure/unsecure?) in block
I want to make some links in a CMS static block. I use one of the base_url variables... for example:
<a href="{{config path="web/unsecure/base_url"}}customer/account">Account</a>
I can ...
2
votes
1
answer
396
views
Grabbing values from cart variables
I've just installed Livechat onto our site running Magento Community. There is an option to add custom variables into the livechat javascript so that I can obtain information about the visitors ...
2
votes
0
answers
151
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 ...
2
votes
0
answers
116
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 ...
2
votes
0
answers
55
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
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
1
answer
756
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 "...
2
votes
0
answers
38
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
0
answers
6k
views
How to Use Custom Variable in Email Template?
I'm following below post & able to send email.
how to send custom email no template in magento2?
I have created 1 custom variable named Custome Footer.
app\code\Custom\Module\view\frontend\...
1
vote
3
answers
6k
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
2
answers
2k
views
updating custom variable value programatically
I want to update the value of a custom variable programmatically, I am using magento 1.9.2
I have tried the solution given at programmatically create a custom variable but this is for creating custom ...
1
vote
3
answers
2k
views
How to use custom variables in Product descriptions?
Many products need to have the same or partly the same description, in order to be able to edit them all at once it would come in handy to make use of the magento custom variables. They work in CMS ...
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>
...
1
vote
1
answer
2k
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 ...
1
vote
1
answer
4k
views
Add a variable for current URL to static block/page CMS
I see that I can insert base url but how can I extend this list to include current URL?
So instead of {{config path="web/secure/base_url"}} something that pulled in the current page URL and I could ...
1
vote
1
answer
964
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 {{...
1
vote
1
answer
189
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="...
1
vote
1
answer
2k
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
2
answers
4k
views
How to use a variable in a href link?
How can I use a variable in the follow href element:
Example, instead of https://mag.outdoorequipped.com/ I like to use a variable. But I do not know how to get it in Magento.
Kindly Simon
1
vote
2
answers
1k
views
Adding custom generated coupon code from observer to New Account email template
I have written a custom observer during customer save after event to generate unique coupon codes and append in welcome email during that is sent during Customer Registration.
The coupon code ...
1
vote
1
answer
362
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
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 ...
1
vote
1
answer
189
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
1
answer
90
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 ...
1
vote
2
answers
850
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 ...
1
vote
1
answer
805
views
How to retrieve variable from CMS page
If I have the following code in a CMS page to call a template:
{{block class="Magento\Framework\View\Element\Template" name="gifts" template="Magento_Theme::html/gifts.phtml" product_id="68"}}'
How ...
1
vote
1
answer
182
views
Shipping Address variable (line 1)
am trying to insert a variable (?) into an email template that only includes Shipping Line 1, so the text will say something like:
Your order has been shipped to 123 Smith Street
which is sufficient,...
1
vote
0
answers
94
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 ...
1
vote
1
answer
328
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.