Questions tagged [helper]

Denotes question regarding Magento Module Helper

Filter by
Sorted by
Tagged with
0 votes
2 answers
35 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 ...
user avatar
0 votes
0 answers
16 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 ...
user avatar
  • 129
0 votes
1 answer
19 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' : '' ?>">...
user avatar
2 votes
1 answer
148 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:...
user avatar
  • 2,441
0 votes
2 answers
28 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=&...
user avatar
  • 526
0 votes
1 answer
72 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 > ...
user avatar
0 votes
2 answers
107 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 ...
user avatar
0 votes
1 answer
534 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.
user avatar
  • 498
0 votes
0 answers
47 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'...
user avatar
  • 95
0 votes
2 answers
42 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 ...
user avatar
0 votes
1 answer
32 views

Get dropdown value in helper file?

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); /** @var \Magento\Eav\Api\AttributeOptionManagementInterface $attributeOptions */ $attributeOptionsManagement = $...
user avatar
  • 198
2 votes
2 answers
364 views

Get current page title in observer (Magento 2)

Is their any way we can get current page title in magento 2 ?
user avatar
0 votes
1 answer
601 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 ...
user avatar
3 votes
1 answer
220 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 ...
user avatar
0 votes
1 answer
114 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 * ...
user avatar
1 vote
0 answers
18 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 ...
user avatar
1 vote
2 answers
68 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 ...
user avatar
0 votes
1 answer
571 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 ...
user avatar
1 vote
1 answer
539 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.
user avatar
0 votes
2 answers
77 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 <?...
user avatar
  • 828
0 votes
3 answers
220 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/...
user avatar
  • 498
1 vote
0 answers
43 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 ...
user avatar
0 votes
1 answer
49 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\...
user avatar
  • 2,441
0 votes
2 answers
543 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; ...
user avatar
  • 2,441
0 votes
2 answers
28 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\...
user avatar
  • 2,441
0 votes
1 answer
46 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/...
user avatar
  • 298
0 votes
2 answers
183 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 ...
user avatar
0 votes
2 answers
412 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=...
user avatar
  • 1,729
0 votes
3 answers
127 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))...
user avatar
1 vote
1 answer
496 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 ...
user avatar
1 vote
1 answer
363 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 ...
user avatar
  • 113
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 ...
user avatar
0 votes
1 answer
645 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 ...
user avatar
  • 1,177
0 votes
2 answers
381 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/[...
user avatar
0 votes
1 answer
255 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 ...
user avatar
  • 3,386
3 votes
3 answers
1k 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 ...
user avatar
1 vote
1 answer
909 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 ...
user avatar
0 votes
1 answer
251 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/...
user avatar
1 vote
1 answer
96 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 *...
user avatar
2 votes
0 answers
69 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-...
user avatar
  • 187
4 votes
1 answer
177 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 ...
user avatar
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
user avatar
1 vote
1 answer
123 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/...
user avatar
  • 81
1 vote
0 answers
161 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 ...
user avatar
  • 964
8 votes
2 answers
301 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->...
user avatar
  • 8,828
1 vote
2 answers
72 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($...
user avatar
  • 1,648
1 vote
2 answers
701 views

How to pass store code to custom URL in magento 2

I would like to add store code to a custom URL in Magento 2.3.0 Actually, I want to pass store code to a custom URL in my custom module based on relevant store order. Let's take an example: public ...
user avatar
  • 5,856
2 votes
2 answers
1k 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: $...
user avatar
  • 882
1 vote
1 answer
1k 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\...
user avatar
  • 95
1 vote
1 answer
781 views

Magento 2 cookie not set when full cache enable

I have created one helper file that get, set and delete cookie. This helper file I called in observer to set cookie. The helper file called but cookie not set when full cache enabled. <?php ...
user avatar

1
2 3 4 5 6