Questions tagged [global-variable]
The global-variable tag has no usage guidance.
19 questions
0
votes
1
answer
242
views
How to handle Global style sheet for my custom theme?
I have created custom theme then creating _extend.less file under
app\design\frontend\My_vendor\mytheme\web\css\source_extend.less
and did some customization.
Where can I declare global style sheet (...
1
vote
2
answers
2k
views
M2 | How to create global variable that can be used only in the same class?
The scenario is I have multiple if-conditions to create product programmatically or load at controller action. I need a single variable who's value should be updating through different functions.
I ...
0
votes
1
answer
1k
views
How to define constants or environment variables in Magento 2.2.6?
I want to define constants to use in all my project. How to define constant or environment variables to access all over the project without any special declaration ?
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
...
0
votes
1
answer
800
views
How to fix "Direct use of $_SERVER Superglobal detected' in Magento 1
Using the $_SERVER super global in an extension causes the following guideline error
Direct use of $_SERVER Superglobal detected
I know the alternative for Magento 2 but how do you solve this for ...
1
vote
3
answers
4k
views
How can I set a global variable in Magento 2?
The scenario is I want to set my variable to a global variable from a phtml file and call in a module file or block file.
So what would be some code or tutorial link that I set my variable to global ...
3
votes
1
answer
4k
views
Magento 2 - Set global variable
I want to know if it's possible to add a global variable all through the site (so that if I need to change it, I would only need to do it once).
It's for an URL.
0
votes
1
answer
2k
views
Magento 2: Global variable doesn't work with RequireJS
I'd create a HTML document with a script tag and add this URL
<script src ="https://assets.pagar.me/pagarme-js/3.0/pagarme.min.js"></script>
so, call the global variable pagarme in ...
1
vote
2
answers
650
views
Magento global variables appear empty
I have a custom module that subscribes to an event called catalog_product_collection_apply_limitations_after. In the observer I am setting a variable (E.g $_GET['test'] = true)
Then later in my ....
2
votes
1
answer
309
views
Refactoring Mage::registry('current_shipment')
I'm working on refactoring a backend extension which uses the global Mage::registry('current_shipment') to retrieve the current shipment for printing. I'd like to change this line to something that ...
5
votes
1
answer
4k
views
how to fix "Direct use of $_SERVER Superglobal detected' in Magento 2
I am having problem with module approval. and magento connect validation report generates following message
Direct use of $_SERVER Superglobal detected
how can i use alternate for
$_SERVER['...
2
votes
3
answers
2k
views
Use a custom variable in a category description
I recently created a custom variable named storecount - which I'll be programatically increasing for every store that is added to my store locator plugin.
I'd like to show this in various locations ...
0
votes
2
answers
926
views
How to use a variable set in "view.phtml" in a controller file?
I'm using Magento 1.4.1.1.
The following contains a useful URL when run in "template/catalog/product/view.phtml".
$this->helper('core/url')->getCurrentUrl();
When I try to get the same URL by ...
1
vote
1
answer
64
views
assigning model variable from cms
I'm attempting to assign some variable used in a custom modules model. This variable will be defined in the CMS page. How can I pass this variable in such a way as it will be used in the model? I'm ...
0
votes
1
answer
2k
views
Custom text in mail template depending on shipping description
I want to insert custom text in email template, if shipping title = 'Pickup'.
I have followed this guide to make if statement work in mail template.
https://stackoverflow.com/questions/4797394/magento-...
0
votes
1
answer
417
views
Store email variable for insertion in block?
I want something like this in a CMS block:
<a href="mailto:{{url:store1-general-email}}">Send an email</a>
...which should result with a proper insertion of the General Email account for ...
1
vote
3
answers
4k
views
customer name is not visible in newsletter conformation mail
We want to contact our registered customers in the newsletter confirmation mail with their names. Every template we tried to configure the names weren't shown in the mails. Anybody out there who's ...
0
votes
1
answer
483
views
Initializing and updating vars used in a phtml. What is the proper way?
I am implementing a quotation form. I then declared a module in which I defined a phtml template containing the form, the computed price display and the javascript/ajax script.
I also have defined a ...
2
votes
1
answer
843
views
Why I can't access global variable in my observer?
I have a custom module. In its controller I set a global variable as shown below
public function someAction()
{
if (<some_condition_met>) {
$id = 12;
$item = Mage::getModel(...