Questions tagged [helper]
Denotes question regarding Magento Module Helper
262 questions
0
votes
0
answers
29
views
Creating a Custom Helper Class with Coding Best Practices ? Code Review Request
Adobe Commerce ver. 2.4.6-p2, multi-site instance
Inheriting code base with numerous custom modules that are not scoped - but need to scope them as individual sites are migrated to new frontend stack
...
0
votes
1
answer
903
views
Magento 2 - Best practices - Helper vs Model : Which one to get config values?
I cannot seem to find an official information about what is the recommended way to retrieve configuration values in Magento 2.
I am searching for the recommended way to retrieve values from the ...
0
votes
1
answer
265
views
How to remove Magento Help Center?
The under the section of Backend Page is displayed Magento Help Center.
I am going to try for adding a category.
But it seems Magento Help Center interrupted it. As you look at the image, the loading ...
0
votes
2
answers
37
views
I am trying to send email using helper class but show the error
Send email using helper class but getting below error
TypeError: Magento\Email\Model\Template::setVars(): Argument #1
($vars) must be of type array, null given
My code is,
<?php
namespace Custom\...
1
vote
0
answers
278
views
Help for the installation of "stripe-php" library manually for stripe extension?
Can anyone help me please? I have installed Stripe module but not showing at the frontend.
1
vote
1
answer
200
views
How to instantiate an helper class from my custom module in a test program in the directory at the same level as the root of Magento?
With the code below, I'm trying to instantiate an helper class from my custom module.
// Sanitize the $_GET[] value
// Create an object of the order loaded with the $order_id passed as query string.
$...
0
votes
2
answers
24
views
Why use custom helper folder in magento?
i know so much about it
It is a singleton
It is use for injecting class and method.
So please explain me more detail.
Advance thank you for answer
1
vote
2
answers
72
views
exclude some other product in the cart from receiving discount
How to get product value ( product price) if attribute "logitech" is set to yes [attribute is Boolean].
I'm new here, still learning magneto. below code, calculate all items in the cart but ...
0
votes
0
answers
294
views
magento 2: type differences for scopeConfig and _logger in AbstractHelper class
This is probably a very stupid question but I'll ask anyway since I don't know the answer.
This is an example of a custom module helper class that extends magento helper class:
<?php
namespace ...
0
votes
1
answer
25
views
Magento Module - PHTML
I need some help with a problem I have with a module, I know this is a newbie question but here i go.
<div class="field company <?= $block->isrequiered() ? 'required' : '' ?>">...
4
votes
2
answers
780
views
Magento 2 - Load values in di.xml from a helper class
Currently the template is defined like this:
Company/PdfDesign/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
2
answers
40
views
How to extend this file app/code/Magedelight/SMSNotification/Helper/Data.php in Magento 2
I want to extend app/code/Magedelight/SMSNotification/Helper/Data.php this file in my custom module.
I have created a module.
My di.xml file app/code/Hl/Smsnotification/etc/di.xml
<?xml version=&...
0
votes
1
answer
509
views
How to get value for Number of Lines in a Street Address that have been set in magento 2 configuration
I am using Magento 2.3.5-p2
I know that in Magento 2, the Street address configuration is not able to be changed through admin by going to
Stores > Settings > Configuration > Customers > ...
0
votes
2
answers
125
views
Magento 2.3 to 2.3.6 - help - urgent
I just updated my Magento instalation from 2.3.3 to 2.3.6.
PHP version 7.3
Everything seamed to fine except when I do reindex. I get this error:
PHP Fatal error: Uncaught Error: Cannot instantiate ...
0
votes
2
answers
2k
views
How to add country code dynamically in telephone field on Checkout in Magento 2
I want to develop custom module that is used for adding country code field before telephone field on checkout page in magento 2.3.4.
0
votes
0
answers
86
views
How to write google business review API in custom module and call into phtml file
What is the best approach to write google business review API in custom module and call inside the custom phtml file,
Eg Code:
<?php
$accountId = 'your_account_id';
$locationId = 'your_location_id'...
0
votes
2
answers
188
views
How to used same code in helper data in magento 2?
Here is my object manager code can any one guide me how can i used same code in my helper data
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customOptions = $objectManager
...
0
votes
1
answer
56
views
Get dropdown value in helper file?
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
/** @var \Magento\Eav\Api\AttributeOptionManagementInterface $attributeOptions */
$attributeOptionsManagement = $...
2
votes
2
answers
1k
views
Get current page title in observer (Magento 2)
Is their any way we can get current page title in magento 2 ?
0
votes
1
answer
2k
views
How To Pass data from Helper Data to Knockout JS file Magento 2
How i can pass helper data to Knockout JS to show it on my html file. Actually i am working on minicart and i want to show the product Qty as Dropdown and get value from Helperdata.
Any help would be ...
3
votes
1
answer
1k
views
Is it okay to use $this->helper(...) in phtml files?
A question on using $this->helper(...) in phtml files:
It returns something like this: ObjectManager->get(...) (Singleton)
I'm aware it's bad practice to use Object Manager phtml, but ...
0
votes
1
answer
332
views
Override a helper using Plugin
I have been trying to use plugin to override Magento\Sales\Helper\Reorder.php. I have added a comment inside the code what I would like to change.
/**
* Check is it possible to reorder
*
...
1
vote
0
answers
19
views
fatal error: bms_class_helper_data not found
I created a custom module and its gives a error "fatal error: bms_class_helper_data not found " after that i removed the complete module, layout file and data enabler file and database, but ...
1
vote
2
answers
184
views
"Fatal error: Class 'Mage_Outgoing_Form_Helper_Data' not found in /var/www/html/app/Mage.php on line 547"
I am getting error "Fatal error: Class 'Mage_Outgoing_Form_Helper_Data' not found in /var/www/html/app/Mage.php on line 547" Even i removed module,layout file and module enabler file and i ...
0
votes
1
answer
953
views
Uncaught Error: Using $this when not in object context
I am going through an older module created in PHP 5.x.x and we have just moved the website to the php 7.2.x so we suddenly got the error in a helper class
Uncaught Error: Using $this when not in ...
1
vote
1
answer
1k
views
Get userid of the admin logged in magento 2 helper
Trying to get admin user id in Magento 2 helper,
in new at magento 2 any help will be appreciated.
0
votes
2
answers
162
views
Issue in extending a model magento 2
I want to extend the Magento\ConfigurableProduct\Helper\Product\Options\Loader as per this github issue https://github.com/magento/magento2/issues/21663#issuecomment-477966963
My di.xml file is
<?...
0
votes
3
answers
897
views
Magento 2 - "Undefined constant 'Product\SizeChart\Helper\Data'" while using helper
If anyone have idea then please share with me.
I am going to stuck in this error:
Uncaught Error: Undefined constant 'Product\SizeChart\Helper\Data' in
/opt/lampp/htdocs/M2/app/code/Product/SizeChart/...
1
vote
0
answers
67
views
Magento 2.3 extra whitespace and lines
done a ton of searching, found some similar issues but nothing that could lead me to a solution. I'm running the Magetique theme on Magento 2.3. On my homepage, I have 2 of the Featured Products ...
0
votes
1
answer
67
views
Best method to use helper in any template
It seems to be impossible to use a helper in the template Magento_Catalog\templates\product\list\items.phtml.
I have tried it via argument injection:
app\design\frontend\company\base\Magento_Catalog\...
0
votes
2
answers
1k
views
Magento 2 - product passed to helper parameter is NULL
I created this helper method:
app\code\Company\Base\Helper\Product.php
public function test($product = null)
{
if (!empty($product)) { exit("TRUE, product is not empty!"); } else { return false; ...
0
votes
2
answers
30
views
Can't load current product
I try to load the current product in gallery.phtml
Helper (app\code\Company\Base\Helper\Data.php):
...
use \Magento\Catalog\Helper\Data as CatalogHelper;
class Data extends \Magento\Framework\App\...
0
votes
1
answer
54
views
when iam paasing arugment to helper from controller iam getting error magento 2.3
Iam Getting the below error
Recoverable Error: Object of class Magento\Framework\App\ObjectManager
could not be converted to string in
/var/www/html/development/amt/app/code/vendor/...
0
votes
2
answers
362
views
In magento2,How to inject helper in collection
I have created a custom grid, in this grid collection I have to inject helper .while injecting helper in the collection it throws error like this
Type Error occurred when creating object:
My ...
0
votes
2
answers
711
views
Unable to override Helper Class in Magento2
I have used below code to override helper class.
Vendor/Module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=...
0
votes
3
answers
367
views
How can i get phtml file in helper magento 2?
I have tried this solution but it is not working
$this->_layout->createBlock('Vendor\Module\Block\Productdesigner');
$response = $layout->setData(array("customer_data" => $result))...
1
vote
1
answer
660
views
Magento 2.3 - Swatches Helper override
I'm trying to override a function in the Helper of the Swatches module of Magento 2. The function resides in the Data.php file. As some of you may know in specific versions of Magento 2 the text ...
1
vote
1
answer
747
views
How to add handler to \Magento\Catalog\Helper\Output
I'd like to display the unit of measurement after each product attribute with some dimension (mm, g, …).
To prevent duplicated code in each PHTML template file that probably displays a product with ...
0
votes
1
answer
1k
views
Fatal error: Class Helper_Data not found in app\Mage.php
Fatal error: Class 'Mage_Category_Password_Helper_Data' not found in /home/pypub/public_html/app/Mage.php on line 547
I've read this: Fatal error: Class Helper_Data' not found in app\Mage.php but ...
0
votes
1
answer
2k
views
Override Helper in Magento2 - Vendor\Module\Helper\Data doesn't extends Magento\Framework\App\Helper\AbstractHelper
May be i'm missing something really small.
Here is a class Class1
namespace Vendor\Module\Helper;
class Class1 extends AbstractHelper
{
/** @var Client */
private $client;
/** @var ...
0
votes
1
answer
634
views
Injecting Helper causes "Undefined constant" and "'generated' directory permission is read-only"
When I inject the helper class it gives me the below errors.
If I remove the reference to the Helper class in the constructor then everything works perfectly.
controller file: /var/www/html/app/code/[...
0
votes
1
answer
447
views
Helpers are singleton classes?
Given this code
<?php
class Vendor_Module_Helper_Data extends Mage_Core_Helper_Abstract
{
protected $_currentCustomer = null;
protected $_settingsHelper = null;
public function ...
3
votes
3
answers
2k
views
Magneto 2 How to call Helper function in observer file
I am new to Magento development and I am using a custom MySQL query in some places like in observer/plugin etc.
These codes are repeating for all these files. so I want to make a new reusable ...
1
vote
1
answer
2k
views
How to implement a method retrieving config value both at store and default scope: Magento 2
In Magento 1, a call to Mage::getStoreConfig('section/group/field') was able to retrieve a config of the current store. Indeed, if we called it from a front block for example, it retrieved the config ...
0
votes
1
answer
333
views
Magento 2.3.1 Fatal Error when overriding Helper in Magento Bundle module
In order to override the function getBundleOptions from magento2/vendor/magento/module-bundle/Helper/Catalog/Product/Configuration.php i have implemented the following module:
MySpace/MyModule3/etc/...
1
vote
1
answer
126
views
Class function not working
I tried to call the class using construct method.
<?php
namespace Vendor\Module\Helper;
class Data extends AbstractHelper
{
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*...
2
votes
0
answers
159
views
Take value of a field in a block and place it in another field
I have a problem taking values from a system.xml field to show them in another field.
This is the system.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
4
votes
1
answer
312
views
Is it good practice to get product collections in helper function and calling in phtml file custom module Magento 2
Hi all, i wanted to know either is it good practice to get product
collections in helper function and calling that function in phtml file
within custom module Magento 2
Because in my case ...
0
votes
2
answers
2k
views
Uncaught Error: Call to a member function getId() on null in [closed]
I have some problem about this error, who can tell me why? Thank you!!
Fatal error: Uncaught Error: Call to a member function getId() on null in
1
vote
1
answer
140
views
Captcha Helper method override not working in Magento2
Need to override method getImgUrl() from vendor\magento\module-captcha\Helper\Data.php but not success
app/code/YourCompany/YourModule/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/...