5

How to install custom extension in Magento2? I have Tier Price extension for last beta version of Magento. It was working well but for testing in stable version, not sure how to install it as there is no app/code folder now in the root of the magento.

3

You can install Magento 2 extensions with Composer: add an extension's package to the root composer.json and then do composer update and bin/magento setup:upgrade.

  • I do have file structure of the extension CompanyName/ModuleName/{all the folders of the extension like Block,Controller,etc,Helper,Model,view} Do I need to make entry in composer.json file something? If so can you please tell me in detail? – Gaurav Jain Nov 20 '15 at 12:07
  • Loading composer repositories with package information Authentication required (repo.magento.com): Username: What is the username and pwd to update composer now? – Gaurav Jain Nov 20 '15 at 12:20
  • 1
    Should use your credentials from magentocommerce.com – Alex Paliarush Nov 20 '15 at 13:09
  • Thanks :) Can you also answer for the question i asked? What do i need to do to install the custom extension? I tried to make an entry in composor.json and run the composor update command, but getting this Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package magecomp/tierprice could not be found in any version, there may be a typo in the package name. – Gaurav Jain Nov 20 '15 at 13:22
3

Once the magento extension gets downloaded in below format

< namespace_modulename-version.zip>

then follow these installation steps-

  1. Unzip the Downloaded folder

  2. Check for the unzipped folder whether it contains app folder or module name

    a)for app folder, overwrite the unzipped folder parallel to the app

    b) if you are getting the folder with the module name, create a new folder under the app code directory and rename it with the module's namespace then paste the folder under the module namespace folder created initially.

  3. Navigate to the Magento root directory path where the module is to be installed, via terminal (cmd) and run the following commands sequentially:

    a) php bin\magento setup:upgrade

    b) php bin\magento setup:static-content:deploy

    c) clear the Magento cache from the Magento admin panel

2

It is simple to install a custom module:

Via Composer:

composer require mageplaza/magento-2-blog-extension php bin/magento setup:upgrade php bin/magento setup:static-content:deploy

Ref: https://www.mageplaza.com/install-magento-2-extension/

1

app/code is missing because all Magento modules are put to vendor directory for 3rd-party developers convenience, so they do not have to mix their own code with the core. Now it is easy to develop custom modules without committing the whole Magento core to your git repository (unlike in Magento 1). This can be done as follows:

  1. Download this Magento 2 project https://github.com/magento/magento2-community-edition (if you do it via git clone make sure to execute rm -rf .git just after that)
  2. Run composer update in the Magento root
  3. Initialize new git repository in the root of Magento
  4. Almost all core files/directories are already added to the root .gitignore, but it is better to add the following 2 as well /update and /phpserver (just add these 2 lines to .gitignore)
  5. Add all untracked files to git and commit them (should be only 3 files, all other are already added to .gitignore in the root of Magento.)
  6. Start development of your modules as usual (put them under app/code/YourCompanyName/YourModuleName), now you will have only your custom code in your git repository

Credit :- https://magento.stackexchange.com/a/90503/5514

  • I am trying to use this module github.com/cadencelabs/urldedup, which does not have composer file. Basically all of my modules are under vendor as you mentioned. I followed their instruction and added the file under app/code/ and ran the upgrade & compile command and flush cache. But the module is not showing up. Do you know how this can be solved? – Korbin Sep 6 '18 at 9:25
  • @k185 use this in your command prompt to install this module mkdir -p app/code/Cadence/UrlDedup && git clone github.com/cadencelabs/urldedup app/code/Cadence/UrlDedup and then php bin/magento setup:upgrade – Vishwas Bhatnagar Sep 6 '18 at 9:36
  • I did follow their instruction, but for some reasons it is not working, After running the command and then upgrade, di:compile and flush:cache, the module is not showing with bin/magento module:status. It is not also showing in admin ->store->configuration->Advanced->Advanced – Korbin Sep 6 '18 at 9:42
1

Connect your FTP and paste your Magento 2 extenstion inside directory:

app/code/

Connect the ssh and run the below commonds in root directory:

rm -rf var/*
rm -rf pub/static/*
php bin/magento setup:upgrade   //(only for new extension)
php bin/magento setup:static-content:deploy 
chmod -R 777 var pub/static

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.