Monthly Archives: September 2020
If you face an unexpected 301 or 302 redirect in Magento 2 and you don't know why it happens or what code causes it, you can easily find this out by temporarily editing the following files:
/vendor/magento/framework/HTTP/PhpEnvironment/Response.php /vendor/magento/framework/Controller/Result/Redirect.php
Open Response.php and add the following line to the beginning of the setRedirect function:
var_dump($url); \Magento\Framework\Debug::backtrace(false, true, false); exit();
Example:
public function setRedirect($url, $code = 302)
{ var_dump($url); \Magento\Framework\Debug::backtrace(false, true, false); exit();
$this->setHeader('Location', $url, true)
->setHttpResponseCode($code);
return $this;
}
Now open the second Redirect.php file and add this:
var_dump($this->url); \Magento\Framework\Debug::backtrace(false, true, false); exit();
after each line containing:
$this->url =
Example:
public function setRefererUrl()
{
$this->url = $this->redirect->getRefererUrl();
If you decided to remove contact our team for a free consultation in case you have any issues with Magefan's extension.
, please follow the steps below. You canRemove Extension Files
Removing files instruction depends on the way the Extended Product Grid has been installed in.
1. If you can find the extension files in the folder
app/code/Magefan/ProductGridInline
then remove this folder.
2. If the extension was installed via the composer and its files are located in the folder
vendor/magefan/module-product-grid-inline
then run composer CLI command to remove it
composer remove magefan/module-product-grid-inline
Once extension files have been removed, run these Magento CLI commands:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these zero downtime deployment commands for Magento 2.
Remove Extension Data (optional)
Attention!
If you need to update Magento 2 Extended Product Grid by Magefan, please follow the steps below.
Note: the updating instructions depend on the method the Extended Product Grid extension was installed with.
Update using composer
If the Extended Product Grid was installed via the composer (check if vendor/magefan/module-product-grid-inline
folder exists), then you need to run these simple CLI commands in Magento 2 directory:
composer remove magefan/module-product-grid-inline
composer require magefan/module-product-grid-inline
^x.x.x
# replace x.x.x with the version you want to use
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these zero downtime deployment commands for Magento 2.
Update using archive and FTP
If the Extended Product Grid was installed via FTP (check if app/code/Magefan/ProductGridInline
folder exists), then follow these commands:
1.
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 Extended Product Grid 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:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
Note: if you don't want your website to be down during deployment, try these zero downtime deployment commands for Magento 2.
Once you have installed the Magento 2 Extended Product Grid extension you can start the extension configuration.
There are situations in Magento 2 when page keeps loading and then you get 500 fatal error, memory limit, or timeout error. This is an infinite loop in the PHP code, when the same code is executed over and over again. It is related to some core Magento issues or, most likely, third party extension.
To debug an infinite loop and find the loop entrance, please follow the steps below:
1. Open the app/bootstrap.php file and add this code right after PHP open tag <?php in the next line
$_SERVER['MAGE_PROFILER'] = 'html';
2. Open the vendor/magento/framework/Profiler.php file and add this code to the beginning of "public static function start($timerName, array $tags = null)" function, e.g.
In case you work with a lot of different Magento instances as a temporary project you might want to have a nice method to check debug backtrace of some function execution in Magento 2 quickly without installing or enabling additional software on the server, e.g. Xdebug.
In this case, you can use the native Magento backtrace function from \Magento\Framework\Debug class and call it whenever you need:
\Magento\Framework\Debug::backtrace(false, true, false);
As a result, you will get this nice HTML debug-backtrace: