All Questions
1,419 questions
4
votes
1
answer
2k
views
Magento 2: Fatal error: Uncaught Error: Call to a member function getId()
After adding custom module on Server. It's giving below error
Fatal error: Uncaught Error: Call to a member function getId() on null
in
/var/www/html/magento/vendor/magento/module-backend/Block/...
4
votes
1
answer
4k
views
Magento 2: How to add a browse button to upload file in admin section?
Working on Magento 2 custom module implementation and want to add a browse button to upload a file in admin form.
I have gone through the
Magento2 : Admin module Image upload code to display form
...
4
votes
2
answers
3k
views
Magento 2 custom module not loading and it throws error
I am using windows 7.
app\etc\config.php
<?php
return array (
'modules' =>
array (
'Test_Module1' => 1,
),
);
?>
When I add My Test_Module1 in app\etc\config.php admin all ...
3
votes
3
answers
10k
views
Magento2 - override 3rd party module layout file in custom theme
We have a custom theme with some layout / template overrides
Now we have installed a 3rd party module, which is overriding one of layout files in our custom theme. So, only module's override is being ...
3
votes
1
answer
8k
views
MySQL error and possible duplicates running bin/magento setup:upgrade after renaming module
I've renamed a custom module from MagicPack_magicheader to MagicPack_Magicheader and trying to now update by running setup:upgrade. I get the following error:
[Zend_Db_Statement_Exception] ...
3
votes
3
answers
3k
views
Magento 2: Dependency Injection: Optional class as parameter
We are developing a Magento 2 extension and we need to inject a class from a third party extension that the user may or may not have installed.
We thought about injecting the class via the di.xml ...
3
votes
2
answers
5k
views
Extending Third Party Modules in Magento 2
In Magento 2 for themes, it's incredibly easy to extend from a parent. This follows a nice logical hierarchy when inheriting theme .xml and .phtml files. This is clearly defined in the theme.xml.
...
3
votes
2
answers
15k
views
Magento2: Add a new page layout
On the page layouts 1 column, 2 columns, 3 columns, there is always a div called "columns" in it. I would like to create a page layout, where that div does not exist. How can I do that? Where is that ...
3
votes
3
answers
2k
views
Magento2 Delete config row while Extension Uninstall
I have created a custom module which is being installed via composer.
When I run the command - php bin/magento module:uninstall Vendor_Faq
It is removing all the corresponding tables which I wrote ...
3
votes
1
answer
6k
views
Custom module cron job not running
I'm working on a custom module to export any new orders periodically throughout the day. I've read through countless descriptions of how to set up cron with for a custom module and it seems like I'm ...
3
votes
2
answers
14k
views
Setup version for module 'Namespace_Modulename' is not specified : Magento 2 [duplicate]
I am creating an module in Magento 2 ( ver. 2.0.0). I have registered my module in app/etc/config.xml
'Namespace_Modulename => 1,
My module.xml file under app/code/Namespace/Modulename/etc/module....
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 ...
3
votes
1
answer
1k
views
How to deploy public PHP files in Magento 2 extension?
I need to deploy a publicly accessible PHP file as part of a Magento 2 extension. Obviously this is not intended, as usually all requests should be routed through index.php, but in this case it's ...
3
votes
1
answer
2k
views
Magento 2.3.5 Custom Module "Invalid security or form key. Please refresh the page"
I have created a custom module that for the most part works great, it's frontend routes work flawlessly and it hasn't had issues.
Recently I attempted to create a custom admin grid by following https:/...
3
votes
3
answers
1k
views
Magento 2: Required files to create a module
I'm aware that the only required files for creating a module are registration.php and module.xml. But I'm seeing some of the popular blogs mentioning composer.json file in addition to the above. Any ...
3
votes
3
answers
8k
views
Magento 2: store selector for custom module in admin form
Stuck in a new issue regarding adding store selector for my custom module in admin form -
I need to add a store selector and to add the values of a store in a different table as it is working with ...
3
votes
1
answer
4k
views
Magento 2 - Check login for page in custom module
I'm developing a custom module. How to check if a user is logged in or not? If not logged in, redirect the user to login page.
3
votes
2
answers
547
views
Using Enterprise core modules in Community Edition
I have been working with Magento for quite a while now. This is not a question related to coding.
I was just wondering, if one copies a module from EE to CE, will it work?
For example, the ...
3
votes
4
answers
309
views
Translating an Extension
Are there any tools for generating a csv file for translations of a module? I.e. detecting calls to __() within a module and outputting the information into a csv ready to be used as a translation ...
3
votes
3
answers
3k
views
How to overwrite authentication-popup.html in Magento 2
I need to overwrite authentication-popup.html. I need to add some extra html.
I just duplicated the authentication-popup.html file inside my module in the same folder from the default Magento module, ...
3
votes
1
answer
2k
views
Magento 2: Stable way to Get a the Base Directory of a Module
In Magento 1, the static getModuleDir method of the Mage class
Mage::getModuleDir('', 'Mage_Core')
provided a stable, "works across versions" way of getting the base folder of a Magento module.
...
3
votes
2
answers
14k
views
Fatal error: Call to a member function create() on null in Magento 2
I got this error while saving image
Fatal error: Call to a member function create() on null in
/opt/lampp/htdocs/magento/2.1/app/code/Contact/Modules/Controller/Contact/Index.php
on line 85
...
3
votes
2
answers
2k
views
Magento ver. 2.1.0 - Index Management without SSH/Shell Access?
Is it possible to do Index Management without SSH/Shell Access in Magento ver. 2.1.0 ?
3
votes
3
answers
1k
views
Magento 2 Images from one .phtml to another .phtml
In a module I have installed I am trying to create a phtml page but can't work out how to pull through information(Like an image) to my new custom .phtml
File containing information:
view.phtml
<...
3
votes
3
answers
96
views
How to retrieve custom fileld values from magento 2
I have added some custom fields to the admin->configurations->sales->payment section using the following method.
created config.xml inside etc folder of my module dir.
<config xmlns:xsi="http://...
3
votes
2
answers
982
views
Controller URL does not work
I have the problem that i always get the error 404 not found, if I want to get the url of my controller. This is my filestructure:
And this is the URL I am trying to get loaded: http://localhost/...
3
votes
2
answers
998
views
Magento2: Custom module not working
I have created new module but it is not working.Please Help me on this.
registration
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\...
3
votes
2
answers
4k
views
Magento 2: Run a uninstall script when module is uninstalled via command line?
I am creating a module and I am progressing it. I am new to Magento 2 so there are a lot of things that I am not yet familiar too. As a module creator, I am curious how to run an uninstall script when ...
3
votes
4
answers
3k
views
How can I create a new order status / state in my module on Magento 2?
I'd like to create a new order state like processing, complete and etc.. Using my custom module (without using the admin panel).
How can I do that?
Thanks
3
votes
1
answer
5k
views
Checkout page phone number validation
I am trying to give US format phone number validation in onepage checkout page
This is the layout checkout_index_index.xml that i created in my custom module. I know how to make i work by editing the ...
3
votes
1
answer
4k
views
My Custom controller not executing in magento 2
Controller is calling, but .phtml file is not calling. Even though I have debugging both controller and .phtml files controller is accessing through debugging but .phtml file is not accessing.
...
3
votes
4
answers
2k
views
Magento 2.3.5 we found conflicting component dependencies
I have tried every possible solution I could find on the internet.
From increasing the MEMLIMIT in the php.ini to 2G to removing the required tags in composer.json and so on.
This is a Vanilla ...
3
votes
1
answer
2k
views
Magento 2: After adding products to cart programmatically, cart is not refreshing until reloading page
Hello Magento 2 Friends.
I have an ajax call to an controller, which adds some new products to the cart programmatically. This works fine, but the problem is that the cart and the mini cart are only ...
3
votes
1
answer
9k
views
Interceptor does not Exist
Hello guys , I am currently on magento version 2.3.0 and I am getting this error whenever I try adding a product in my admin panel.
Can someone kindly assist me .
After running php bin/magento setup:...
3
votes
2
answers
2k
views
Constr is not a constructor on layout.js line 137 error custom module
I have gone through this posts and tried to implement the answers and suggestions
Magento2 getting 'Constr is not a constructor' error for custom theme && Error in layout.js, cart ...
3
votes
1
answer
1k
views
Create Link Dynamically By Customer Group in Customer Account Navigation - Magento 2
I am attempting to add links to certain customer groups that will show on Customer Dashboard. I'm having trouble figuring this out! Help!
3
votes
1
answer
58
views
Can we create single composer file for more then 1 module
I am creating one module which will contain more then 1 module in it. Is it possible to create single composer file for more then 1 module?
Please let me know is it possible or not. If yes, then it ...
3
votes
2
answers
1k
views
Magento 2 module not working. Override fails
I am trying to write a module that filters products in a product collection. For that I have tried to override Magento\Catalog\Model\Layer. These are the files in the module:
/Viking/FilterProducts/...
3
votes
2
answers
9k
views
Magento 2 - Element with same id already exists
I'm trying to set the Magento 2 pager on my custom module, my custom module get the product collection and makes some special filters on the collection. I'm able to filter my products, but when I try ...
3
votes
2
answers
2k
views
Check if all module dependencies are met
I recently disabled some modules and after an upgrade I feel that new dependencies got introduced (when disabling and re-enabling a custom module I got errors).
Is there a command to check if the ...
3
votes
1
answer
65
views
what folders and files in module is reason for creating tables in database?
I saw one module folders and files in magento connect. in that only etc, Helper, & Module folder is present.
but there is no sql folder. but still that module created a text box in backend , so ...
3
votes
2
answers
553
views
How to access products in custom module
<?php
namespace Queueapp\Queueapp\Controller\Query;
// Mage::app();
class Products extends \Magento\Framework\App\Action\Action {
/** @var \Magento\Framework\View\Result\Page */
protected ...
3
votes
3
answers
109
views
Is it possible to execute code for every fired event without too much boilerplate code?
This is mostly out of curiousity, as I think it would be very useful in some situations. Is there are a way in Magento to execute a piece of code every time an event is fired, regardless of the event?
...
3
votes
2
answers
150
views
Include en_US translation file in extension
When developing an extension is there an reason other than simply "Best Practice" to include a en_US or extension base language translation file?
Example
I write an extension with some text where ...
3
votes
3
answers
552
views
Is it necessary to disable the cache before creating a module?
I am newbie to Magento. I'm learning to create my first module but I'm confused whether it's necessary to disable the cache or not.
If yes, please tell me how? Thanks,
3
votes
1
answer
114
views
Examples of well written modules
Can anyone point me in the direction (github or magento connect) of any well written modules in terms of code/architecture and not functionality?
Preferably also using unit tests or magespec.
It ...
3
votes
5
answers
7k
views
Custom Module Controller: Invalid security or form key. Please refresh the page
I have a custom module with an admin controller, but when I try to access from the administration page I get the following error:
My controller is in Controller/Adminhtml/Login/Index.php
class Index ...
3
votes
2
answers
359
views
Should new modules be developed in app/code or vendor/org/module?
I prefer creating a new module repo in git, adding that via composer, and letting composer check it out to vendor so that I can develop in <magento-root>/vendor/[org]/[module] from start to ...
3
votes
2
answers
2k
views
Magento 2 - Generate css dynamically
I have an observer and i need to generate a css file dynamically - using my admin theme setting configuration - calling my observer function.
3
votes
2
answers
2k
views
M2 Change title of Orders and Returns page
I have tried to change the title of the Orders and Returns page with XML with the following code.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:...