Would you like to update your old Magento 2 DHL Shipping extension (https://github.com/netresearch/dhl-module-shipping-m2) but are unsure how to proceed? This step-by-step guide should help you move to the latest version of the DHL Shipping extension, now called Post & DHL…
Unable to add products to an order in the admin (Magento 2)
If you cannot add products to an order from the Magento 2 admin area, run the following command in your Magento 2 root directory:
|
1 |
php bin/magento config:set system/security/max_session_size_admin 0 |
That should resolve the issue.
Fixing Session size exceeded allowed session max size (Magento 2)
Do you receive the message main.WARNING: Session size of … exceeded allowed session max size of …when adding products to an order from the Magento 2 admin area? There is a simple fix: run the following command from your Magento…
Pager missing after updating to Magento 2.4.3?
If the pager disappears from your Magento category page after upgrading to version 2.4.3, you may have overridden templates/product/list.phtml in your theme. Open the file and replace the following code:
|
1 |
<?= $block->getToolbarHtml() ?> |
with
|
1 |
<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?> |
That should resolve the problem.
Running PHP Mess Detector and checking Magento coding standards
To check the quality of Magento 2 code or an extension against the Magento coding standard, you can use PHP Mess Detector. The following command analyzes any directory or individual file:
|
1 |
vendor/bin/phpmd Ihr/Verzeichnis text dev/tests/static/testsuite/Magento/Test/Php/_files/phpmd/ruleset.xml |
Run the command from the Magento 2 root…
Using jQuery in a template (phtml) (Magento 2)
The following code shows how to load and use jQuery in a Magento 2 .phtml template.
|
1 2 3 4 5 6 7 8 9 |
<script> // Separate additional libraries with commas // In this example, jQuery UI require(['jquery', 'jquery/ui'], function($){ $(document).ready( function() { alert("fertig :-)"); }); }); </script> |
Contact form message content appears as a single line (Magento 2)
Are comments submitted through the Magento 2 contact form displayed as a single line, losing the sender’s line breaks? A small change to your email template can solve that. Change the following line in your email template:
|
1 |
{{var data.comment}} |
to
|
1 |
{{var data.comment|nl2br}} |
…
Mage_Catalog_Block_Product::getPriceHtml causes errors with PHP 7 (Magento 1)
The following Magento 1 code no longer works with PHP 7 or later:
|
1 |
echo Mage_Catalog_Block_Product::getPriceHtml($_product, true); |
With PHP 7, you need to create an instance of Mage_Catalog_Block_Product and call getPriceHtml on that instance.
|
1 2 |
$productBlock = new Mage_Catalog_Block_Product; echo $productBlock->getPriceHtml($_product, true); |
Installing Magento 2.4 using the CLI
Starting with Magento 2.4.0, the installation wizard was removed. Magento must now be installed through the command line (CLI). The following command installs Magento 2.4.x on your server:
|
1 |
bin/magento setup:install --base-url="https://yoururl.com/" --db-host="localhost" --db-name="yourdb" --db-user="yourdbuser" --db-password="yourdbpassword" --admin-firstname="Firstname" --admin-lastname="Lastname" --admin-email="you@whatever.com" --admin-user="youruser" --admin-password="youradminpassword" --language="en_US" --currency="EUR" --timezone="Europe/Berlin" --use-rewrites="1" --backend-frontname="admin_whatever" |
After the command completes, you should find a standard Magento 2.4…