All Questions
89 questions
0
votes
1
answer
904
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
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
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 ...
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
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
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/...
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
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
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 ...
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-...
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/...
1
vote
0
answers
306
views
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 Checkout page and i want to show the name of product owner on checkout summary.
Any help would be ...
8
votes
2
answers
397
views
Magento 2 - Call phtml in helper
I have found multiple threads related to calling helper function in .phtml.
But I have a case where I need to call phtml file in helper and return HTML.
I have used this code:
//Where $this->...
1
vote
2
answers
177
views
Get product views in Controller
If anyone could help me.
My curent value that I get is '0' in my controller:
foreach($productCollection as $product)
{
$_helper_views =$this->helper_views->getProductCount($...
2
votes
2
answers
2k
views
Get static block content by identifier in helper class?
I am trying to get the content of a static block in a helper class. So far I had no luck. So, how can I get the content of a static block by block identifier in a helper class?
I tried:
$...
1
vote
1
answer
2k
views
Get Product Image custom use Helper and Block in Magento 2
How can I put the below code into the module's files like helper/data.php or block/product.php, and how to use it to call Helper and Block into file.phtml .
$objectManager = \Magento\Framework\App\...
2
votes
2
answers
357
views
Magento 2 : Call Function From app/code to app/design
Is there any way to call function defined in the app/code/Custom/Module/helpers/HelperClass.php inside the app/design/frontend/Custom/Theme/Magento_Theme/template/html/View.phtml in Magento 2?
I'm ...
0
votes
1
answer
1k
views
'Class' not found error in Magento 2 frontend
This is a screenshot of the error.
My code is
app/code/Prayag/Module/view/frontend/layout/cms_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/...
0
votes
2
answers
166
views
Magento 2 when I click on frontend my account cannot open and it shows error
I am facing this issue.
My XML file is app/code/Prayag/Module/view/frontend/layout/cms_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
3
votes
1
answer
2k
views
Magento 2.2 - Problem with Helper class not found in custom module
I'm creating a payment module and I'm having a curious problem. I started by creating the module inside the app/code/Vendorname/Payment folder for convenience. It is not yet complete, but the system....
0
votes
1
answer
766
views
Cannot call my custom Helper Class. Magento 2
I'm trying to call my custom Helper class in Controller but when I call the function of my helper in Controller it gives me Fatal error: Uncaught Error: Call to undefined method Magento\Backend\Helper\...
1
vote
1
answer
260
views
How to apply Coupon on the Specific Products in Magento 2?
I want to apply the coupon on the specific product I tried:
use Magento\SalesRule\Model\Rule;
public function __construct(
\Magento\Framework\App\Helper\Context $helpercontext,
Rule $rule,
)...
1
vote
1
answer
43
views
Set Coupen for specific Products. Magento 2
I create the coupon function in Helper which is
public function setCoupon()
{
// $this->_state->setAreaCode('adminhtml');
// $this->_state->setAreaCode('frontend'); ...
5
votes
4
answers
2k
views
Magento 2 : Call Helper Without Using __construct in Own Module
I have created a new module and override the
\Magento\Catalog\Block\Product\View\Description
function using preference.
In this module we create new helper located in
Custom_Hello/Helper/Data....
10
votes
5
answers
12k
views
SodiumChachaIetf::decrypt() must be of the type string, boolean
I did migration Magento 1 to Magento 2.3.0 all is good but when I create customer form both of side (front and admin) I got the error related to decrypt even I can not edit the customer when I click ...
1
vote
1
answer
2k
views
How to call helper function observer in magento2
I am trying to call helper function on observer custom module in Magento2 but Unable to call helper in observer.
Please help me if anybody have this solution. I am waiting for all your positive ...
1
vote
1
answer
1k
views
Magento 2 How to add new address in 'customer_address_entity' from helper?
I am using helper data function to add the new address in customer_address_entity but it is not working. code as below :
<?php
namespace Name\Module\Helper;
use \Magento\Framework\App\Helper\...
2
votes
2
answers
2k
views
Magento 2 : How to get current product programmatically in a helper?
Could someone advise what's the best way to get the current product in a custom helper? Basically if I am a product page I need to get it's sku