Page 5 - Ihor Vansach
- 1 min read
If you need to update by Magefan, please follow the steps below.
Note: the updating instructions depend on the method the Login As Customer extension was installed with.
If you use Magento 2.4.x or greater please .
Update using composer
If the login as customer module was installed via the composer (check if vendor/magefan/module-login-as-customer folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-login-as-customercomposer require magefan/module-login-as-customer ^x.x.x# replace x.x.x with the version you want to usephp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Update using archive and FTP
If the login as customer module was installed via FTP (check if app/code/Magefan/LoginAsCustomer folder exists), then follow these commands:
1. Download the latest version of login as customerihor
- 1 min read
If you need to update by Magefan, please follow the steps below.
Note: the updating instructions depend on the method the Auto Currency Switcher extension was installed with.
Update using composer
If the auto currency switcher module was installed via the composer (check if vendor/magefan/module-auto-currency-switcher folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-auto-currency-switchercomposer require magefan/module-auto-currency-switcher ^x.x.x# replace x.x.x with the version you want to usephp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Update using archive and FTP
If the auto currency switcher module was installed via FTP (check if app/code/Magefan/AutoCurrencySwitcher folder exists), then follow these commands:
1. Download the latest version of auto currency switcherihor
- 1 min read
If you need to update by Magefan, please follow the steps below.
Note: the updating instructions depend on the method the Auto Language Switcher extension was installed with.
Update using composer
If the auto language switcher module was installed via the composer (check if vendor/magefan/module-auto-language-switcher folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-auto-language-switchercomposer require magefan/module-auto-language-switcher ^x.x.x# replace x.x.x with the version you want to usephp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Update using archive and FTP
If the auto language switcher module was installed via FTP (check if app/code/Magefan/AutoLanguageSwitcher folder exists), then follow these commands:
1. Download the latest version of auto languageihor
- 1 min read
If you need to update by Magefan, please follow the steps below.
Note: the updating instructions depend on the method the Open Graph extension was installed with.
Update using composer
If the open graph module was installed via the composer (check if vendor/magefan/module-og-tags folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-og-tagscomposer require magefan/module-og-tags ^x.x.x# replace x.x.x with the version you want to usephp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Update using archive and FTP
If the open graph module was installed via FTP (check if app/code/Magefan/OgTags folder exists), then follow these commands:
1. Download the latest version of open graph extension archive from magefan.com.
2. Extract archive.
3. Make the backup copy of the app/code/Magefan/OgTagsihor
- 1 min read
If you need to update by Magefan, please follow the steps below.
Note: the updating instructions depend on the method the Convert Guest to Customer extension was installed with.
Update using composer
If the convert guest to customer module was installed via the composer (check if vendor/magefan/module-convert-guest-to-customer folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-convert-guest-to-customercomposer require magefan/module-convert-guest-to-customer ^x.x.x# replace x.x.x with the version you want to usephp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Update using archive and FTP
If the convert guest to customer module was installed via FTP (check if app/code/Magefan/GuestToCustomer folder exists), then follow these commands:
1. Download the latest version of convertihor
- 1 min read
When you run Magento 2 CLI command "bin/magento ..." and get the error:
Allowed memory size of xxxx bytes exhausted (tried to allocate xxx bytes)
You can easily fix it using this command instead of bin/magento:
php -dmemory_limit=-1 bin/magento ....
Examples:
php -dmemory_limit=-1 bin/magento setup:upgrade
php -dmemory_limit=-1 bin/magento setup:di:compile
This error is related to the memory limit configuration in PHP. Parameter -dmemory_limit=-1 allows to run PHP in the CLI without memory limits.
You can also change memory_limit configurations (php.ini file).
- 1 min read
If you have a product attribute and want to assign it to a single attribute set, it's easy to do via Magento 2 Admin Panel > Stores > Attributes > Attribute Set.But what if you need to assign it to all your attribute sets? What if you have 50+ or ever 100+ attribute sets? It can be time costly.
So what you can do, is to create a simple script that will do all job for you.
1. Create a PHP file "myscript.php" in your Magento 2 root directory.
2. Insert the code:
<?phperror_reporting(E_ALL);ini_set('display_errors', 1);
$ATTRIBUTE_CODE = 'my_attribute';$ATTRIBUTE_GROUP = 'General';
use Magento\Framework\App\Bootstrap;require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();$state = $objectManager->get(Magento\Framework\App\State::class);$state->setAreaCode('adminhtml');/* Attribute assign logic */
$eavSetup = $objectManager->create(\Magento\Eav\Setup\EavSetup::class);$config = $objectManager->get(\Magento\Catalog\Model\Config::class);$attributeManagementihor
- 1 min read
You can install by Magefan, using composer or archive installation methods.
Note: if you want to install the or please navigate to your Magefan Account > Downloads > Install via Composer to get the composer installation instructions.
Installation via composer (recommended)
Important: this method works only for Blog Basic versions lower than 2.13.0. If you want to install the Blog Basic version starting from 2.13.0 you need to and get a product key.
Open command line.
Using command "cd" navigate to your Magento 2 root directory.
Run CLI commands:
composer require magefan/module-blog ^x.x.x# replace x.x.x with the version you want to install
# Authentication required (repo.magento.com)# Get your Magento Marketplace authentication keys or use these: # Username: 7c018006799466c681ad507e27904677# Password: 289077c86e811661a8f7751828485d3aphp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be downihor
- 1 min read
You can install by Magefan, using composer or archive installation methods.
Installation via composer (recommended)
Please navigate to your Magefan Account > Downloads > Install via Composer to get the composer installation instructions.
Installation using archive and FTP
Download Auto Currency Switcher Extension ZIP-Archive from magefan.com website (not GitHub or other sources).
Extract files.
Copy app and lib folder from the archive to your Magento 2 folder.
In a command line, using "cd", navigate to your Magento 2 root directory.
Run CLI commands:
php bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Once you install the extension, you might need to update the Geo IP database:
mkdir var/magefanmkdir var/magefan/geoipwget -O var/magefan/geoip/GeoLite2-Country.mmdb https://magefan.com/pub/media/geoip/GeoLite2-Country.mmdb
Once you have installed the Magentoihor
- 1 min read
You can install by Magefan, using composer or archive installation methods.
Installation via composer (recommended)
Please navigate to your Magefan Account > Downloads > Install via Composer to get the composer installation instructions.
Installation using archive and FTP
Download Open Graph Extension ZIP-Archive from magefan.com website (not GitHub or other sources).
Extract files.
Copy app folder from the archive to your Magento 2 folder.
In a command line, using "cd", navigate to your Magento 2 root directory.
Run CLI commands:
php bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Once you have installed the Magento 2 Open Graph extension you can start the .
- 1 min read
You can install by Magefan, using composer or archive installation methods.
Installation via composer (recommended)
Please navigate to your Magefan Account > Downloads > Install via Composer to get the composer installation instructions.
Installation using archive and FTP
Download Convert Guest to Customer Extension ZIP-Archive from magefan.com website (not GitHub or other sources).
Extract files.
Copy app folder from the archive to your Magento 2 folder.
In a command line, using "cd", navigate to your Magento 2 root directory.
Run CLI commands:
php bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Once you have installed the Magento 2 Convert Guest to Customer extension you can start the .
- 1 min read
You can install by Magefan, using composer or archive installation methods.
If you use Magento 2.4.x or greater please .
Installation via composer (recommended)
Open command line.
Using command "cd" navigate to your Magento 2 root directory.
Run CLI commands:
composer require magefan/module-login-as-customer# Authentication required (repo.magento.com)# Get your Magento Marketplace authentication keys or use these: # Username: 7c018006799466c681ad507e27904677# Password: 289077c86e811661a8f7751828485d3aphp bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Installation using archive and FTP
Download Login As Customer Extension ZIP-Archive from magefan.com website (not GitHub or other sources).
Extract files.
Copy app folder from the archive to your Magento 2 folder.
In a command line, using "cd", navigate to your Magento 2 root directory.
Run CLI commands:
php bin/magentoihor
- 1 min read
You can install by Magefan, using composer or archive installation methods.
Installation via composer (recommended)
Please navigate to your Magefan Account > Downloads > Install via Composer to get the composer installation instructions.
Installation using archive and FTP
Download Auto Language Switcher Extension ZIP-Archive from magefan.com website (not GitHub or other sources).
Extract files.
Copy app and lib folder from the archive to your Magento 2 folder.
In a command line, using "cd", navigate to your Magento 2 root directory.
Run CLI commands:
php bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these .
Once you have installed the Magento 2 Auto Language Switcher extension you can start the .
- 1 min read
Sometimes you can see notifications in Magento 2 panel that are displayed over and over again. This is Magento 2 admin notifications.
To stop showing these messages you need to mark them as read.
For this please navigate to Noficiations Manage page. Click on the bell icon in the top right corner in the admin panel and then press the "See All (X unread)" link.
Select the messages you want and mark them as read.
Tha's all.
However, there are some notifications that are useful for you, as the admin, to receive.
e.g. new review, disabled cache and low stock notifications
Check out to receive emails about changes on your store directly to your email box.
- 1 min read
If you have installed or updated Magento 2 extension and received the error message e.g.:
Module 'Company_Module' from 'app/code/Company/Module' has been already defined in 'vendor/company/module'.
this means that you have 2 versions of the extension:
1) in the folder app/code/Company/Module2) in the folder vendor/company/module
In vendor folder Magento stores all components (extensions, themes, language packages) that have been installed using Composer.
As installing or updating extensions via Composer is preferred, you need to remove the extension folder app/code/Company/Module (please don't forget about a backup before removal) and run installation commands.
Example:
If you get the error:
Module 'Foo_Bar' from 'app/code/Foo/Bar' has been already defined in 'vendor/foo/module-bar'.
You need to:
1. Make a backup of "app/code/Foo/Bar" folder
2. Remove "app/code/Foo/Bar".
3. Run commands
php bin/magento setup:upgradephp bin/magento setup:di:compilephp bin/magento setup:static-content:deployihor
- 1 min read
Originally you cannot reindex Magento from admin panel. To perform you need to use PuTTY or another terminal application to run the CLI commands, e.g. command for reindexing:
php bin/magento indexer:reindex
So, most often developers use . However, wiith FREE Magento 2 Command Line (CLI) Extension by Magefan you can run CLI commands directly from Magento 2 admin panel.
To reindex Magento 2 from admin panel:
1. Install the Magefan CLI extension to see a new menu item "System > Command Line" to be added to the admin menu.
2. Enter your current admin user password (for security reasons) On the "Comand Line" page and enter the Magento 2 reindex command.
3. Press ENTER to start the reindexing after you have entered the "php bin/magento indexer:reindex" command.
Result:
With the Magefan CLI module, you can run any other Magento 2 commands.
Check out the video to see how easy it actually is:
- 1 min read
If you use Magento 2.2.x or greater and receive the error message:
1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'class': [facet 'pattern'] The value '\Magento\Framework\View\Element\Text\ListText' is not accepted by the pattern '[A-Z][_a-zA-Z\d]*(\\[A-Z][_a-zA-Z\d]*)*'.
Line: 982
Element 'block', attribute 'class': '\Magento\Framework\View\Element\Text\ListText' is not a valid value of the atomic type 'blockClassType'.
Line: 982
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'block', attribute 'class': [facet 'pattern'] The value '\Magento\Framework\View\Element\Text\ListText' is not accepted by the pattern '[A-Z][_a-zA-Z\d]*(\\[A-Z][_a-zA-Z\d]*)*'.
Line: 982
Element 'block', attribute 'class': '\Magento\Framework\View\Element\Text\ListText' is not a valid value of the atomic type 'blockClassType'.
Line: 982
You need to check all layout files in your theme and custom extensions, they may have aihor
- 2 min read
If you need to extend Magento 2 Blog Module by Magefan and add a new custom text field to Blog Post edit page in Magento 2 Admin panel (Content > Blog > Posts) you must to create a simple custom Magento 2 Extension.
You can download a sample extension from our GitHub page or you can create it manually using the steps below:
1. Create composer.json file
app/code/Magefan/BlogCustomField/composer.json
{ "name": "magefan/module-blog-custom-field", "description": "Implements Blog functionality on Magento 2 store", "require": { "magefan/module-blog" : ">=2.8.0" }, "type": "magento2-module", "version": "2.0.0", "license": [ "OSL-3.0", "AFL-3.0" ], "autoload": { "files": [ "registration.php" ], "psr-4": { "Magefan\\BlogCustomField\\": "" } }}
2. Create registration.php file
app/code/Magefan/BlogCustomField/registration.php
<?php/*** Copyright © Magefan (support@magefan.com). All rights reserved.* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).*/
\Magento\Framework\Component\ComponentRegistrar::register(ihor
- 1 min read
If you receive the error message "No such entity.", "No such entity with" or "No such entity with customerId" in Magento 2, the issue usually occurred when you try to load not existing object via Magento 2 Repository Class.
To debug this , please open the following file:
vendor/magento/framework/Exception/NoSuchEntityException.php
and at the beginning of the __construct method temporary add debug backtrace code:
foreach (debug_backtrace() as $_stack) { echo ($_stack["file"] ? $_stack["file"] : '') . ':' . ($_stack["line"] ? $_stack["line"] : '') . ' - ' . ($_stack["function"] ? $_stack["function"] : '');}exit();
example:
public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0) {
foreach (debug_backtrace() as $_stack) { echo ($_stack["file"] ? $_stack["file"] : '') . ':' . ($_stack["line"] ? $_stack["line"] : '') . ' - ' . ($_stack["function"] ? $_stack["function"] : ''); } exit();ihor
- 2 min read
Have you ever wondered how easy it is to check the quality of your own code, your colleagues' code, or a third-party module you want to use on a Magento project?
The Magento development team has created the Magento Extension Quality Program Coding Standard (Magento EQP), which allows you to check the code compliance with the standard, as well as identify the following shortcomings:
- SQL queries execution in the loop;- use of dangerous functions;- use of super-global variables;- excessive code complexity;- Unjustified collections loads.
Installation
You can install the Magento EQP via Composer, running this CLI command:
git clone https://github.com/magento/magento-coding-standard.gitcd magento-coding-standardcomposer install
In case you don't have the composer, you can download it here.
Checking
To check the code (which is, for example, in the /path/to/your/extension folder), go to the Magento EQP folder:
cd /path/to/magento-coding-standard
and run the followingihor
- 1 min read
When you update Magento 2, or switching git branches on your dev environment, sometimes you can get the error:
The following modules are outdated: Vendor_Module schema: current version - x.x.x, required version - z.z.z
To solve this issue, please do next:
1. Try to get the latest extension code. Run CLI command in the Magento root directory:
composer install
If you get troubles with running this command, then just skip it, and move to step 2.
2. Try to upgrade your database. Run CLI command:
php bin/magento setup:upgrade
3. If step 1 and 2 didn't help, then navigate to your database and run this SQL Query (don't forget to change the text in bold):
UPDATE `table_prfix_setup_module` SET schema_version="z.z.z", data_version="z.z.z" WHERE module="Vendor_Module";
"table_prfix_" can be found in app/etc/env.php, note that it can be empty.

