Questions tagged [helper]

Denotes question regarding Magento Module Helper

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Get configValue in _prepareToRender function of a block

I want to get the configValue of system.xml in this block <?php namespace Module\Vendor\Block\Adminhtml\Menu\Field; use Magento\Config\Block\System\Config\Form\Field\FieldArray\...
2
votes
0answers
32 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
1answer
26 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
2answers
55 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
0
votes
0answers
27 views

Magento 2.3 - Custom Payment Method error on install - Type Error occurred when creating object: Magento\Framework\Communication\Config\Data

I want to install a payment module, but i got this error. Magento clean instal. When i run setup:upgrade i got: Running schema recurring...Type Error occurred when creating object: Magento\Framework\...
1
vote
1answer
26 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
0answers
41 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 ...
2
votes
0answers
30 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
2answers
44 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($...
1
vote
2answers
80 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 ...
2
votes
2answers
42 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
1answer
54 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\...
0
votes
0answers
33 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 ...
2
votes
2answers
35 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
1answer
43 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
2answers
39 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" ...
2
votes
1answer
102 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
0answers
25 views

Magento 2.2 - Session not working on Helper Class

public function add($productId, $data) { $this->_customerSession->setData('customData', $data); } private function hasData($productId, $side) { return $engraving = $this->...
0
votes
0answers
16 views

Magento 2 I cant able to get the session in Helper function

<?php namespace Sdi\Orders\Helper; use Sdi\Orders\Model\StubFactory; use \Magento\Framework\Module\Dir\Reader; use Magento\Framework\View\Asset\Repository; use Sdi\Orders\Model\EngravingFactory; ...
0
votes
0answers
19 views

How to set the coupon on the specific product using SKU. Magento 2

I followed this code $price = 100; $sku = '24-WG085'; $discount = ($price - (($price + 1) / 2)); $shoppingCartPriceRule = $this->_objectManager->create('Magento\SalesRule\Model\Rule'); $...
0
votes
1answer
43 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
1answer
55 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
1answer
23 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'); ...
1
vote
0answers
23 views

Magento 2.3.0 - Class MailCampaigns\Connector\Helper\MailCampaigns_API does not exist [closed]

I installed the module (https://github.com/mailcampaigns/Magento2Connector) On my Magento (2.3.0 version) application. It installed successfully but when I try to add a product to the cart. It's ...
5
votes
4answers
353 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....
2
votes
1answer
49 views

Call to helper of module not change the Mage_ prexif by my module prefix

I have changed my etc/system.xml and my etc/config.xml with the structure which should replace the Mage_JaviNewListProductController_Helper_Data by Lecasa_JaviNewListProductController_Helper_Data. I ...
0
votes
1answer
322 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 ...
0
votes
0answers
22 views

How to run query subdate(now(), INTERVAL 1 DAY) in Magento Helper

in Magento 1.9 Community, I have this query created_at >= subdate(now(), INTERVAL 1 DAY) Group By product_id order By sum(qty_ordered) desc How do I do this in Helper/Data.php? Currently this is ...
0
votes
0answers
30 views

getting error after run compilation magento 1!

I am getting below error after run compilation process on the website: Fatal error: Uncaught Error: Class 'Mage_ThemeOptionsBizarre_Helper_Data' not found in /var/www/example/app/Mage.php:547 ...
1
vote
1answer
104 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\...
0
votes
0answers
146 views

Display notification/error message in frontend from a helper override

I have created a custom module for restrct one cms page access in few conditions. If the page is restricted, then I want to redirect the page to home page and display one message. My code is ...
0
votes
2answers
75 views

Solving helper rewrite conflict. Three modules conflicted on payment/data helper.

I have a problem where a newly installed module is not working due to a conflict. The result of n98-magerun dev:module:rewrite:conflicts: How would I solve this problem? Is there any particular way ...
0
votes
1answer
23 views

Where and what is the best way to create utility function in Magento?

I would like to ask for example I have a function doSomething() which will be used by one or more other files, where is the best place to put it? As of now, I put everything in Data.php (helper class)...
0
votes
1answer
37 views

Does initializing a helper variable before using it multiple times benefits performance?

I wonder if it is better to write: $lesser2000 = Mage::helper('wr_epo')->getFensterbankTill2000mm($quote); $higher2000 = Mage::helper('wr_epo')->getFensterbankHigherThen2000mm($quote); ...
2
votes
1answer
445 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
0
votes
1answer
196 views

Calling helper functions from within cron job file

I am trying to run tests on helper functions, so I created a cron job to test them. I have already verified that the cronjob itself is set up correctly (it is running when I have simple logging ...
2
votes
1answer
35 views

Translator not working on helper class

I try to translate a text in a function inside sales_helper_data with this code $this->__('TEXT') but it just returns the same input string. I Also tried Mage::helper('sales')->__("TEXT"), Mage:...
0
votes
3answers
359 views

Magento 1.9 problem call Helper

My Config.xml <?xml version="1.0"?> <config> <modules> <MyCompany_MyModule> <version>1.0.0</version> </MyCompany_MyModule&...
0
votes
2answers
44 views

Get current customer collection in custom account navigation link

I have created the custom link in customer account left navigation. I am successfully created it. I am trying to get current customer Data in template file. I am getting 500 server error. Below is ...
1
vote
2answers
219 views

Magento2 - accessing helper in controller

I have helper class that has constructor that takes following parameters: Context, Cart, Session, CollectionFactory. It derives from \Magento\Framework\App\Helper\AbstractHelper. I would like to use ...
0
votes
1answer
287 views

How to call controller action from helper?

Is it possible to call my controller action from a helper? I have a controller action in app\code\local\Fekete\Newsletter2Go\controllers\IndexController.php public function apiAction() { echo "...
0
votes
1answer
61 views

Constant return null (2.2.4)

I'm trying to define constant in an helper of my module : here's my Data.php : class Data extends AbstractHelper { const base = "my/url"; public function getBase(){ return $...
1
vote
1answer
70 views

Calling custom constant issue

I have defined a constant in a custom helper in module A. I want to call it an admin method from a custom controller from a custom module B. This is my custom helper class from module A: ...
1
vote
4answers
965 views

Magento 2: call helper function in ui component form

In my form.xml, I have used below code to show input field <field name="price"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> ...
0
votes
1answer
203 views

Store Specific string from Html Page into PHP variable [duplicate]

i have complete html page, i need to store a specific string value in php variable. specific value i can only select by css selector. but i have to store it in php variable. however i can do ...
0
votes
1answer
81 views

Magento 1.9: Fatal error: Class 'FANCourier_Ship_Helper_Data' not found

Need some help with an error. I've installed a third party module, it is a shipping module. After I've installed it and I go the shipping methods in the backend, I get this: Fatal error: Class '...
1
vote
2answers
27 views

Magento 1.8 - Class 'Mage_Helloworld_Helper_Data' not found

I can't access System -> Configuration in the backend anymore. I get the message Class 'Mage_Helloworld_Helper_Data' not found. How can I debug this, I am new to magento. I found a Module named "...
0
votes
1answer
25 views

Account Link label generated by helper returns escaped html

In a link block I am calling a helper function to return a label with a piece of svg: <block class="Magento\Customer\Block\Account\Link" name="my-account-link" after="top.links.right.search"> ...
0
votes
1answer
767 views

Fatal error: Call to a member function getConfigTimezone() on null Magento 2.2

I'm trying to create a helper class that will help me determine If I should present some labels like new/sale etc. I'd like to inject to it a TimezoneInterface via the constructor however $_localeDate ...
0
votes
3answers
644 views

How to call helper class in controller magento 2?

I have a helper class with parameter as shown below. I need this function to work on a specific controller. But returns this error. My helper Code below <?php namespace Rk\Wallet\Helper; class ...