Questions tagged [variables]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6
votes
2answers
632 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
1answer
1k 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 ...
5
votes
3answers
6k 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 ...
4
votes
2answers
3k 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 ...
4
votes
2answers
974 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
1answer
472 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 ...
3
votes
1answer
351 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
1answer
733 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
1answer
222 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
1answer
280 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
3answers
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
1answer
424 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
2answers
2k 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 ...
2
votes
1answer
507 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
1answer
94 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
4answers
1k 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
1answer
100 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
1answer
564 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
1answer
389 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
0answers
26 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
3answers
531 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
1answer
511 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
0answers
35 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
0answers
5k 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
3answers
4k 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

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
2answers
194 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
2answers
509 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
3answers
3k 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
1answer
3k 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
1answer
226 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
1answer
798 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
1answer
167 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
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
2answers
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
1answer
36 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
1answer
51 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!
1
vote
2answers
830 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
1answer
38 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
72 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
2answers
736 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
1answer
726 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
1answer
155 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
0answers
24 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 ...
1
vote
0answers
27 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
0answers
21 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 ...
1
vote
1answer
258 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, ...
1
vote
0answers
23 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.
1
vote
1answer
73 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 ...
1
vote
1answer
2k 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 ...