All Questions
200 questions
5
votes
1
answer
14k
views
Magento 2: Creating a custom layout
I'm having trouble creating a custom layout. I have successfully created a layout called home_page.xml which is a copy of the default 1column layout.
I have selected this layout for my home page, ...
5
votes
1
answer
4k
views
Magento 2 - editing module structure and functions
in Magento 1.x you could duplicate the extensions to app/design/frontend/themeName/default/template/or/layout and then modify it's layout or functionality via xml or phtml files.
How do we duplicate ...
4
votes
1
answer
10k
views
Magento 2: Check condition on Click of "Proceed to Checkout"
May be I need to create Event Observer. I would like to check Product's Type Condition & Display Message Accordingly on Shopping Cart Page.
<event name="...
4
votes
3
answers
6k
views
Add module Enable/disable functionality in Magento 2
I want to add Enable/disable functionality in my custom module by which the module can be enabled or disable directly form admin-panel for just selecting.
I want to add something like this in my ...
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
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
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
2
answers
3k
views
How to add catalog price rule condition in magento2 [duplicate]
I have added to custom module to add catalog price rule condition. how to
Add Rule Condition in My custom module, I have also added Rule file and Condition.
$renderer = $this->_rendererFieldset-&...
2
votes
4
answers
11k
views
Include external PHP library in Magento 2 module
I am trying to include an external PHP library inside my Magento 2 module, specifically the eKomi PHP library (https://github.com/ekomi-dev/ekomi-api).
I have added the PHP files into the module so ...
2
votes
1
answer
1k
views
Magento2 custom/different flat shipping charge for few products
I want to charge custom shipping charge for few product available in store is it possible? i.e currently i am charging flat shipping chargefor all product how to charge custom/different price few ...
2
votes
2
answers
9k
views
Module JS - Mismatched anonymous define module
I've tried adding my module JS file to Magento2 but for whatever reason it seems to return this error:
Error: Mismatched anonymous define() module: function($)
My view/frontend file structure:
|-...
2
votes
5
answers
13k
views
Magento 2: Convert HTML code into PDF file and Download?
In my custom module, I have HTML code and I want to convert HTML code into PDF and after conversion download PDF.
Please suggest me Magento-2 default functions or classes for Create PDF and Download.
2
votes
1
answer
930
views
Create New Module get 404 error(How to debug code)
Hello,
I have create new custom module and run frontend get 404 Page error.
How to debug module what problem in code ?
Please Help me.
THANKS.
2
votes
1
answer
891
views
Magento 2 : Eav module record can't save in custom module table
I create custom EAV module.
app/code/VendorName/ModuleName/Model/ResourceModel/Mainpage/Collection.php
<?php
namespace VendorName\ModuleName\Model\ResourceModel\Mainpage;
class Collection ...
2
votes
4
answers
5k
views
How to override Magento 2 framework file?
I try to override this file :
vendor/magento/framework/View/Element/Html/Link/Current.php
I create a module.xml, registration.php and di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
2
votes
3
answers
1k
views
Magento Custom module phtml file call selected page only in system configuration
I am using Magento 2 I want to display phtml some page only that i need to select backend. How to display selected page only?
class Selectpage implements \Magento\Framework\Option\ArrayInterface{
...
2
votes
3
answers
3k
views
Magento 2: Adding JS from module
I have a module, and I want to add a javascript generated in the module at the frontend footer.
The javascript has to be built dynamically because it depends on server variables. I've thought of a ...
2
votes
2
answers
2k
views
How do i add product grid in customer admin section and save the checkbox values to database
I want to add product grid in Magento 2 admin customer section with a separate tab, that I got completed, but when I select the checkbox values from grid and hit save.
It does not get the values of ...
2
votes
1
answer
2k
views
Magento 2: Server side validation not showing filled up data while error [SOLVED]
I have below code
app\code\Custom\Module\Controller\MyModule\PostForm.php
namespace Custom\Module\Controller\MyModule;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\...
2
votes
1
answer
1k
views
Magento 2 - Plugin to run only when function is called from specific module
Is there any way that I can specify that a Plugin X only runs when the class is called from Module Y?
So that if same function is called from other modules the Plugin is not called.
2
votes
1
answer
3k
views
magento2: how to use product uploader in custom module
<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<...
1
vote
2
answers
8k
views
How to change the price in quote while adding product to cart?
I want to apply a custom price for the current order. I read that I should use sales_quote_add_item, But its looks like I am doing something wrong. I found some tutorials for magento1 but not for ...
1
vote
2
answers
3k
views
Magento 2: How to Override File in Vendor Folder
I installed a 3rd party PHP sdk via composer and need to override a couple files in my own module. However, I'm not quite sure what the best practice is to override these files from the vendor folder.
...
1
vote
2
answers
3k
views
Magento 2: Calling Restful Web service GET and POST
Any one knows how to call restful web service from Magento 2?
Please guide me with a format how it can be done.
Any links to guide me with examples of POST or GET etc.
I want to Call below URL in ...
1
vote
0
answers
288
views
Magento 2 Remove Add to Cart button and Add New Custom Button
I am creating a module. I have create one custom product attribute which value is YES/NO.
if product attribute value is Yes then Add to Cart Button hide And Show Custom Button
if product attribute ...
1
vote
1
answer
2k
views
Show terms and conditions on static page
Is there a way to show the terms and conditions on a page via .phtml?
I have made a page via a module and now want to show the terms and conditions on that page.
1
vote
1
answer
9k
views
Magento 2: New Checkout step – Shipping Method prices not showing
I would like to add a new Checkout step to the Checkout page but would like to place it between the customer's shipping details (name, address, email) and the shipping methods radio buttons. To do ...
1
vote
2
answers
3k
views
Magento 2 - display html content in system.xml configuration
i want to show some htmlContent in configuration. System.xml. how it could be?
1
vote
1
answer
948
views
Magento 2: How to define Scope For Router.php
I have created Custom Module. As it requires some front-end routing, have to create Router.php
Whenever I'm accessing Magento eCommece Frontend other pages, say Category/Product Page. It will call my ...
1
vote
3
answers
2k
views
Get Store Information Magento 2.3.0
Using Magento 2.3.0 with php7.1
I'm trying to use this module to get store information.
I have modified the folder names as such
app/code/Vendor/SiteInfo/Block/SiteInfo.php
And used the following ...
0
votes
1
answer
1k
views
How to install an extension on a private Github using Composer?
I'd like to know how to install extensions on my Magento 2.1 using Github / Bitbucket / Gitlab with public and private repositories.
Thanks.
0
votes
0
answers
607
views
Magento 2: How to redirect on custom phtml file from a module within module
I want to redirect to Success.phtml file from this controller
This is my controller code:
<?php
namespace Softadroit\Prescription\Controller\Index;
use Magento\Framework\Controller\ResultFactory;
...
25
votes
3
answers
5k
views
List of not-used core modules that can be turn off with no harm
Reffering to this this topic for Magento 1, maybe it would be useful to prepare a list of core Magento 2 modules that can be turn off or completely removed with no harm for our store, because they are ...
23
votes
2
answers
2k
views
Magento 2: what are the benefits of using UI grid components over the standard Grid.php?
So Magento 2 introduced the UI Components.
One of them is the UI Component Grid (you can find more information about it here: Explanation of UI Component Grid in Magento 2)
When creating a custom ...
19
votes
2
answers
53k
views
When exactly to use php bin/magento setup:upgrade
There are lots of situations in which I change some files in my module in the developer mode but the changes didn't take place in frontend until I run php bin/magento setup:upgrade
Just wanted to know ...
16
votes
5
answers
14k
views
Magento 2: How to set custom template for core block
I'm trying to override the register.phtml in my module, but it seems there are some config problem that make Magento unable to use my custom template to override the one in core module. I've checked ...
16
votes
4
answers
26k
views
Less files in custom modules
How do you use less inside custom module
having created code/Vendor/module/view/frontend/web/css/source/custom.less
how do I include and compile?
15
votes
2
answers
9k
views
How can I set configuration values in Magento 2?
Previously (in Magento 1, that is) we created a module called Setup which contained setting for the site. The upgrade scripts looks something like this:
$installer = $this;
$installer->startSetup()...
12
votes
2
answers
4k
views
What and why is the proper way to load a model
I have quite a lot of experience with Magento but I realized that I don't understand which way of loading a model is the correct one and why. I've read everything that I could, about the topic but ...
11
votes
3
answers
11k
views
Magento 2: Disable all custom and Third Party Module in single Command
Is there is any way that we can disable all custom and third party Module in a single command? Currently, I am using below command to disable multiple modules
php bin/magento module:disable module1 ...
11
votes
5
answers
3k
views
Uninstalling a module
I'm trying to uninstall a module (my own) that I've installed via composer using CLI with this command:
bin/magento module:uninstall -r [Namespace]_[Module]
Based on the answer provided here by @...
10
votes
2
answers
9k
views
Magento 2: how to create your own custom cache type?
In Magento 1, it was possible to create your own cache type by declaring the following in your config.xml:
<global>
<cache>
<types>
<custom translate="...
10
votes
5
answers
4k
views
Magento2: Setup Script not loaded
I've been banging my head for a few hours now. I have setup a small Magento 2 module. It is enabled everything is working except the Setup scripts never run. Actually from my diagnosis right now, they ...
10
votes
5
answers
18k
views
Magento 2 - How to disable wishlist and product review module
I want to disable the Wishlist and Product Reviews module including hiding all links in the menues (i.e. Dashboard, Top Navigation).
Is there an easy way to do this?
9
votes
6
answers
13k
views
Magento 2 - How to rearrange Customer "My Account" links
Now it looks like this:
Account Dashboard
Account Information
Address Book
My Downloadable Products
My Orders
Newsletter Subscription
Billing Agreements
My Product Reviews
My Wish List
I want to ...
9
votes
3
answers
2k
views
Magento 2: Which extension mechanism to choose?
We can extend controller in two ways: using preference and using plugin.
But I do not understand that, which one is good and advantages/disadvantages of preference vs plugin.
<preference for="...
9
votes
5
answers
10k
views
Magento 2: How to get current IP Address?
How could I get the current customer's IP address?
7
votes
3
answers
4k
views
Magento 2: update an existing backend menu item
Let's say there's a module that declares a custom admin menu item via menu.xml like this:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
7
votes
1
answer
2k
views
How to add a color picker field in Admin form?
How to add color picker in my custom module of Magento 2 admin panel form?
Not in System Configuration.
6
votes
1
answer
4k
views
Magento2 Disable All Modules of a Particular Vendor Name
I would like disable all module of a particular vendor in a single command.
I know we have php bin/magento module:disable [Vendor_ModuleName] command but as far as I know it doesnot take wild cards ...