Questions tagged [module]

Questions about developing custom modules

Filter by
Sorted by
Tagged with
148
votes
8answers
126k views

To use or not to use the ObjectManager directly?

Ok, so yesterday we had a big talk with other people from the Magento community regarding the direct use of the ObjectManager in classes/templates. I'm already aware of the reasons why we shouldn't ...
64
votes
3answers
66k views

Adding custom attribute to Customer

We need a simple way to add an attribute to a customer record that is not editable by the customer or admin, only programatically. Essentially, we have an ExpressionEngine site coupled with Magento. ...
8
votes
8answers
8k views

How to create simple module in magento 2

I'm new to magento2. I want to create simple Hello World module in magento 2. How to create this module?
16
votes
7answers
41k views

How to override .phtml files in Magento 2

I want to customize product details page, So it required to override some .phtml files in following locations. So I want to know, how to override .phtml files in vendor\magento\module-catalog\view\...
145
votes
5answers
11k views

How to write a custom extension?

Because I had a lot of issues lately with free and commercial extension I've decided to ask this question and answer it with the steps I usually follow when writing an extension. Feel free to edit the ...
43
votes
17answers
67k views

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

I am building Magento 2.0 only to sell 2 of my products online. The compare products and wishlist module is irrelevant for me. How I safely and easily remove those modules? I dont want to hack the ...
8
votes
1answer
3k views

Magento2: How to include third pary module through composer.json in custom module

I created a custom module, this module depends on thirt party module(tecnickcom/tcpdf), I added this library in my custom module composer.json file { "name": "packagename/mymodule", "description": "N/...
37
votes
6answers
42k views

Debugging layout XML loading

TL;DR: is there a way I can debug the loading of the layout? As I believe one module's layout is conflicting with another. Related to a previous question I made: How to make a module layout to be ...
13
votes
4answers
10k views

How to show a custom attribute in the admin Shipping Address box?

I have added the drop-down custom field on the checkout page with custom values. It's working fine also save attribute values in the database but not display in the order shipping address. Any idea ...
5
votes
1answer
19k views

magento2 how to override model file? [duplicate]

I would like to override (call the below model file from my custom module called Demo_Customprice /vendor/magento/module-catalog/Model/Product/Option/Value.php How could we achieve this?
35
votes
6answers
6k views

How to create an EAV entity?

How to create an EAV entity? This is a question that pops up a lot on the web. There are some good blog articles that explain how to do that, but none of them are satisfying for me. So I decided to ...
14
votes
2answers
32k views

Adding custom layouts for CMS and Category use with custom module trouble

I have a category in my store that requires a totally different layout to the standard Magento layouts. So I created a new copy of the 1column.phtml and renamed it and made one small change to test. ...
12
votes
3answers
15k views

How do I override/rewrite a block class in Magento 1?

Note: This is intended as a canonical question that fully explains how block rewrites work and can be used as duplicate target for more specific "How do I override block X" or "Why does my rewrite not ...
24
votes
5answers
13k views

Magento2 CLI module:enable gives error “Unkown module(s)”

In Magento2 I've built a simple custom module and want to enable it by CLI: bin/magento module:enable Vendorname_Modulename But it is giving me the following error: Unknown module(s): '...
6
votes
4answers
2k views

Hide/disable standard shipping when qualified for free shipping

I have read the other suggestions for similar problems but I have not solved my issue yet. I'm using standard shipping (with tablerates.csv) and free shipping on orders over $50 plus a flat rate for ...
24
votes
2answers
32k views

Creating a custom helper class in module

I've made a new module called test_helper and I want to create a helper class in this module so that I can add custom functions to be called all over my site. I can't however seem to find any ...
6
votes
2answers
14k views

Magento 2 - Custom Page Layout

I wish to add a custom home page layout in Magento 2. In Magento 1, it's very simple, i create my module : <?xml version="1.0"?> <config> <modules> <Vendor_Custom>...
28
votes
3answers
4k views

What is the difference between an Extension and a Module?

What is the difference between an Extension and a Module? Just curious to know that what is the right term to use when we extend Magento's functionality by creating our custom code in local folder.
6
votes
1answer
19k views

Magento 2 - Send form data to Controller using AJAX and return Result to PHTML

I am working on a simple custom module, where user can input height and the weight/BMI will be shown as output on form submit. The page where user enters input is Calculation Page while output is ...
7
votes
2answers
6k views

How does translation scope work in Magento 2?

In Magento 1 different modules could provide different translations for the same string and the various __() methods in helpers and blocks always passed a module scope to the translator model, to ...
5
votes
1answer
6k views

How to add new css file for a module in Magento2?

I'm trying add custom css file for my module namely Magento_Hello in magento2. In the module I've created new page and trying to add new custom css to that page. Here is what I have done in app/code/...
7
votes
3answers
10k views

Magento 2: How to override Adminhtml “Shipping & Handling Information” Information

I'm following https://ranasohel.me/2015/10/02/how-to-overwrite-sales-view-order-phtml-file-in-magento2/ I would like to override magento\vendor\magento\module-shipping\view\adminhtml\templates\order\...
21
votes
2answers
27k views

Magento 2.1.1 How to load Order with Increment ID using OrderRepository object

What would be the latest best practice to load Order using increment ID (instead of Order ID) using OrderRepository
28
votes
4answers
8k views

Disabling modules - performance improvement?

This question has 2 parts: Does disabling core modules improve overall performance of the store and if so, do they need disabled in the admin (i.e. disable frontend output) or disabled via config.xml ...
24
votes
11answers
31k views

How to disable Magento 2 reviews

I'm trying to disable the Magento 2 product reviews feature. I tried Disabling the Module at the Magento 2 admin Stores\Advanced\Advanced\Magento_Review but the reviews tab on each product is still ...
17
votes
3answers
17k views

how to connect another database from magento

Is it possible to connect to another database from Magento and accessing data? If I need to create a module, how can I create a module to access another database? Is there any tutorial which tells ...
11
votes
2answers
11k views

How to “add to cart” a product with custom input field and save it to Database?

I had created a custom module in which I am overriding the add to cart form on the product page, and I successfully did it with catalog_product_view.xml file. Now I can see a custom input field on the ...
29
votes
2answers
26k views

Magento 2: Default Values for `system.xml` Configuration

In Magento 1, it was possible to Configuration a user interface for the System Configuration section in etc/system.xml files Set default values for those fields in the etc/config.xml files Behind ...
11
votes
5answers
6k views

Magento 2 does not allow linking Modules using symlinks

I've added a local development module (separate git repo) to Magento 2 using symbolic links and it was working fine until I hit the PHTML templates. After heavy debugging I found out that the Magento ...
8
votes
4answers
8k views

How prevent a model data save using _save_before event

I have create a model which has its own database table. For a customization I need to trigger save_before event of this model. If one field value is not matched, then the data should not be saved. ...
8
votes
2answers
13k views

How to solve the message “Character content other than whitespace”?

I've received that message below when I try to reset my admin password using the Admin panel, I've my custom module installed. I see this same message on a white screen when I try to access using the ...
11
votes
5answers
32k views

Magento2 : How to get product id to my custom module

I am new to magento2 and currently I'm building a custom module and i want to get the product ID/SKU from the catalog. I'm trying to call using a function located in the Block folder. please advise!
2
votes
1answer
944 views

Magento2 : Custom payment Module with Drop down list Is not working

Please check my Custom payment Module, I was able to display the list in drop down in Payment method, But when i select and place order it is not working as expected. Please download the complete ...
0
votes
3answers
4k views

Magento 2 - add Enable / Disable field for custom module

I want to add some fields in the Magento 2 Admin Panel for my custom module and then I want to check in the phtml file if this field is have value or not. I need to add this fields: - enable / ...
8
votes
2answers
4k views

Including generated 3rd party PHP library in Magento2

I am creating a module that connects to a SOAP service, I have generated classes for this service using wsdl2phpgenerator which uses autoload.php. Placing this in "lib/" with the correct class namings ...
3
votes
1answer
262 views

What is <fieldsets/ > stands for?

When I have gone through Mage_Bundle module in magento, I found this code snippet inside app/code/core/Mage/Bundle/etc/config.xml. <admin> <fieldsets> <...
25
votes
4answers
6k views

What Default Modules I can disable?

From this question and Sander Mangel answer: Disabling modules - performance improvement? First of all, less modules means less code to (potentially) load and process. Next to that, a lot of ...
17
votes
4answers
16k views

Why `code` folder is missing under `app` folder in magento 2 stable version?

I have downloaded Magento 2 stable from https://www.magentocommerce.com/download with sample data and installed. It's working fine in both areas i.e. frontend & backend. But I could not find app/...
13
votes
1answer
5k views

Magento 2 uninstall module

Apparently, now Magento 2 supports uninstall scripts that allow db schema modification when uninstalling a module (horay!!). As explained in here this only works for module installed via composer. (I ...
16
votes
2answers
8k views

How should I licence my module?

I have a module which I have written for my company. It takes data from our back office solution and imports it into Magento. It also takes orders from Magento and imports them into the back office ...
10
votes
1answer
21k views

Create Magento 2 Upgrade Script to add/update new field into custom module table

Anybody have any idea/suggestion about creating Magento 2(CE Stable version) Upgrade Script(in custom-module) for adding/updating new field into custom table ? I know about "InstallSchema" but is ...
6
votes
2answers
947 views

What are the first steps in exploring Magento 2? [closed]

I am planning to start out with Magento 2. Could you please advise me on the first steps of transition from Magento 1 to Magento 2? I have quite little experience with Magento 1 development, but ...
3
votes
2answers
11k views

Magento generate coupon codes programmatically

I would like to create unique coupon codes automatically. I have tried the following - when using setCouponCode() to generate coupon code, i must set static code. Example: $code = "abc"; ...
32
votes
4answers
36k views

Magento 2: How to get controller, module, action and router name?

Magento 2: How to get controller, module, action and router name?
8
votes
2answers
7k views

Magento 1 : how to override/rewrite a core controller class?

Note: This is intended as a canonical question that fully explains how controller rewrites work and can be used as duplicate target for more specific "How do I override controller X" or "Why does my ...
4
votes
1answer
7k views

Using Magento 2 custom cache in custom module

@Rakesh explains how to add custom cache in Magento 2 here. My question is how to actually work with my custom cache in Magento 2? In Magento 1 you would do something like: $cacheId = 'example_id'; ...
4
votes
1answer
4k views

How to define multiple routes in single module

I am defining two routes to be used in same module. <router id="standard"> <route frontName="hello" id="hello"> <module name="HelloWorld_Hello"/> </route> ...
3
votes
1answer
1k views

What is the order of execution of setup scripts in a module?

1) Can there be multiple install scripts in the custom module? For example: data-install-1.0.0.php data-install-1.0.1.php 2) Assuming I have the following scripts inside app/code/local/Company/...
9
votes
1answer
23k views

How to add a custom helper in my module?

How to create new Helper or override/rewrite Core Helper in Magento 2 module? I tried adding dependency into my module.xml of Custom Module, but it doesn't load Helper class at all. Below is my ...
2
votes
3answers
685 views

Installation issue in magento marketplace 'page doesn't contain HIT in cache header.'

I have developed customer module in magento. When i am trying to submit in marketplace its keep giving the same error even after trying so many solutions. Installation issue: http://magento.dev/gear....

1
2 3 4 5
7