17

Your error comes from the fact that you're injecting \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig in the constructor whereas this class is already part of the parent Magento\Framework\App\Helper\AbstractHelper class. See the following from the parent class: protected $scopeConfig; public function __construct(Context $context) { $this-...


12

The Compilation feature of Magento will allow you to compile all files of a Magento installation in order to create a single include path to increase performance. In order to use this tool, the directory includes and the file includes/config.php must both be writable. Note that before you make any changes to your Magento installation you should always ...


12

You don't need to inject \Magento\Store\Model\StoreManagerInterface in your constructor because the parent class already does that. I assume your block extends Magento\Framework\View\Element\Template which already has the following code: protected $_storeManager; public function __construct(Template\Context $context, array $data = []) { $this->...


10

First of all, compilation need only in production mode. If you develop, you do not need to run compilation It's hard to improve compilation, because in this process build tree of all classes in system. For example change in 'di.xml' can affect half of classes. In developer mode, if you modify/create constructor you still need to delete generated/code/ ...


10

1) Well its not mandatory to run setup:di:compile command everytime but if you have done any code change specially with factory methods ,proxy, js changes or any code compilation then you must need to run this command. 2) Right now problem is in your SocialLogin MODULE which you have configure and located in app/code as have installed it for social login ...


8

First you need to know that even though we call both features compilers they are very different: Magento 1 compiler : It makes a copy of every class in a Magento system and places them in a single folder. The class’s full name is used for the filename to ensure uniqueness. Then, when Magento is configured to use the compiler classes, its autoload will ...


7

This is because your parent constructor has redundant arguments or not correct . In your case, need to remove arguments: $storeManager and $metadataPool. app\code\Custom\Module\Model\ResourceModel\Posts\Grid\Collection.php parent::__construct( $entityFactory, $logger, $fetchStrategy, $eventManager, //$storeManager, &...


6

What is the Magento Compiler? Very simply put, the Magento compiler is just a tool that organizes all the .php files within Magento to make things faster. It takes many .php files out of their directories and sticks everything into 1 directory to make searching for files faster. Magento consists of thousands of .php files for all the different features and ...


5

Following methods are available in Context object(\Magento\Framework\View\Element\Template\Context) print_r(get_class_methods($context)) Array ( [0] => __construct [1] => getResolver [2] => getValidator [3] => getFilesystem [4] => getLogger [5] => getViewFileSystem [6] => getEnginePool [7] => ...


5

you don't need to add \Magento\Store\Model\StoreManagerInterface $storeManager as a dependency to your class. You already have access to an inplementation of StoreManagerInterface in the Magento\Framework\View\Element\Template\Context class. See this. So you can make your constructor look like this: public function __construct( \Magento\Framework\...


5

Try with below code, Remove var folder and run command of compile, class BuyingListIndex extends \Magento\Framework\View\Element\Template { public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Custom\Module\Model\ResourceModel\Posts\CollectionFactory $collectionFactory, \Custom\Module\Model\Posts $posts, ...


5

Compilation in Magento 2 is mandatory, in production mode at least. It is something completely different to the compilation in Magento 1: The Magento 1 compiler was built to reduce I/O operations by merging the source files. With current technology this does not make sense anymore, see: When should I use the Magento Compiler The Magento 2 compiler creates ...


5

Depending upon how you installed the different PHP versions (e.g. using ondrej's PPA to install 5.6/7.0/7.1 or compiling from source) you should have two separate "php" executables under /usr/bin or /usr/local/bin. I use the PPA and it provides the following executables for me: /usr/bin/php5.6 /usr/bin/php7.0 /usr/bin/php7.1 To run the bin/magento command ...


4

please follow below step to compile "gallery.less" create "mage" folder under your theme copy "gallery" folder from "root/lib/web/mage/gallery/" and put under "app/design/frontend/vendor(packagename)/your-theme(custom theme)/web/mage/" open "root/dev/tools/grunt/configs/theme.js" and put below code in it (configure your theme in "theme.js") theme: { area: ...


4

The workaround for now is to use composer 1.2.4 and avoid using composer 1.3.x. I have done some tests to verify my comment from 27 January. In comparison with composer 1.2.4, the Magento 2.0.10 code has these changed files when installed with composer 1.3.0: modified: composer.lock modified: vendor/composer/ClassLoader.php modified: vendor/...


3

Resolved Error, It occurs due to a plugin CSS which I included in my project having a shorthand property font:0/0 a which is not supported in Magento 2 less compilation causes a warning "Division by zero".


3

That's the beauty of dependency injection that you don't end up using same class multiple times :) Look at the following two classes and you will find all the functions you need vendor/magento/framework/View/Element/Template/Context.php vendor/magento/framework/View/Element/Context.php For example you can call the followings in your constructor $...


3

The \Magento\Customer\Api\CustomerRepositoryInterface not injected properly. It should be as shown below: Injection patter is wrong.You should inject class as parameter of __construct(). <?php namespace Supravat\Customer\Helper; class Customer extends \Magento\Framework\App\Helper\AbstractHelper { protected $customerRepositoryInterface; ...


3

I think if you change public function imagePreprocessing($data) to public function imagePreprocessing(array $data) it won't give you the error. There could be more wrong with the theme though.


3

Backup and delete the file /vendor/magento/module-quote-graph-ql/Model/Cart/SetShippingAddressOnCart.php


2

You have to follow below simple steps to do working: First You have to remove magento2/pub/static/frontend and magento2/pub/static/adminhtml folder. Set developer mode using command, php bin/magento php bin/magento deploy:mode:set developer php bin/magento setup:static-content:deploy mode for deployment. Remove var folder and check again.


2

The Compilation feature of Magento will allow you to compile all files of a Magento installation in order to create a single include path to increase performance. The performance increase is between 25%-50% on page loads. In order to use this tool, the directory includes and the file includes/config.php must both be writable. You can temporary disable it ...


2

In your Magento directory issue command : rm -rf var/view_preprocessed/\*; rm -rf pub/static/\* reload page


2

Tested on 2.1.6 and 2.1.8 works just fine. I injected the helper into a footer copyright plugin for proof of concept. File Structure app/code/Supravat/ └── Customer ├── Helper │   └── Customer.php ├── Plugin │   └── Magento │   └── Theme │   └── Block │   └── Html │   └── Footer.php ...


2

Magento typically stores catalog data in multiple tables, based on the Entity-Attribute-Value (EAV) model. Because product attributes are stored in many tables, SQL queries are sometimes long and complex. In contrast, a flat catalog creates new tables on the fly, where each row contains all the necessary data about a product or category. A flat catalog is ...


2

If you upgrade Magento older version to Magento 2.2.3 and you fetching same error in compile then below step you should follow to resolve this error. Magento older version have 2 directories and 2 files in this path vendor\magento\module-backend\Model\View\Layout Filter Reader Builder.php GeneratorPool.php And Magento version 2.2.3 have 1 ...


2

you can follow these steps to compile files with Gulp: 1.In magento root directory, create an empty package.json and copy-paste the following code: { "author": "Magento Commerce Inc.", "description": "Magento node modules dependencies for local development", "version": "1.0.0", "main": "gulpfile.js", "dependencies": { "path": "^0.12.7" }, "...


2

Just check if you have "CSS Settings" -> "Merge CSS Files" set to No, and then try switching to Client side Use this command to set css minification to NO php bin/magento config:set dev/css/merge_css_files 0 Thanks for this @s-adamson answer it saved many times.


1

You can modify the path variable to match to version of php that you want to run. php -v set PATH="/usr/bin/php7.0:$PATH" php -v Note that I assume you php7.0 is under /usr/bin/php7.0 but that can easily be changed base on where your system stores it's files. Also on some systems you will be able to find php, php7.0 and php7.1 commands on the CLI


1

Server-Side compilation Server-side compilation is the default choice, used for first time compilation after setup and for production mode. Cons: Slow Global recompile Need to delete static files before each run Pros: No additional setup required Works on server side Client-Side compilation Client-side compilation with Javascript is optional and is ...


Only top voted, non community-wiki answers of a minimum length are eligible