Magento ON-DEMAND courses are now free until June 30th, 2020

magento2 training overview magenaut blog

Update 2020-08-20 If you already added the free courses, you can still visit and learn them for free via this URL: https://cpcontents.adobe.com/public/newlearner/newlearner_1369e616.html   Today I’ve just discovered the Magento 2 courses for newbies are now free (again). It worth $2500 but it’s now free until June 30th, 2020. If you are new with Magento 2 … Read more

Environment variables from docker-compose .env to Dockerfile

1. Declare the variables in .env PHPFPM_IMAGE=php:7.2-fpm USER_ID=1000 2. Pass the variables to Dockerfile using args in docker-compose.yml version: '3' services: app: build: context: . dockerfile: Dockerfile args: PHPFPM_IMAGE: ${PHPFPM_IMAGE} USER_ID: ${USER_ID} 3. Use the keyword ARG to receive the variables in Dockerfile # ARG to use WITH "FROM" ARG PHPFPM_IMAGE FROM $PHPFPM_IMAGE # ARG … Read more

Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface

Environment: PHP 7.2 Magento 2.3.4 1. The error Fatal error: Uncaught Error: Cannot instantiate interface Magento\Framework\App\ExceptionHandlerInterface in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /var/www/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create(‘Magento\\Framewo…’) #1 /var/www/vendor/magento/framework/App/Http.php(100): Magento\Framework\ObjectManager\ObjectManager->get(‘Magento\\Framewo…’) #2 /var/www/generated/code/Magento/Framework/App/Http/Interceptor.php(14): Magento\Framework\App\Http->__construct(Object(Magento\Framework\App\ObjectManager), Object(Magento\Framework\Event\Manager), Object(Magento\Framework\App\AreaList), Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\App\Response\Http\Interceptor), Object(Magento\Framework\App\ObjectManager\ConfigLoader), Object(Magento\Framework\App\State), Object(Magento\Framework\Registry), NULL) #3 /var/www/vendor/magento/framework/ObjectManager/Factory/Abs in /var/www/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50 This error is caused by missing abstraction-implementation mapping in app/etc/di.xml. 2. Added this line … Read more

M2 development with Docker

The story Although I have tried so many docker-compose projects, I didn’t find any project that matches my requirement: Uses only Official Images. Simply enough to setup/modify. No extra deployment step from host to containers after changing the code. So I have created a docker-compose project. Below are the reasons for you to use or … Read more

Fix Error: Notice: Array to string conversion

Problem The site is using the Amasty Product Feed extension. If you set the Schedule and trying to save feed profiles: Unable to save feed with ID xx. Error: Notice: Array to string conversion in /magento_dir/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3105 My environment: PHP 7.2 Magento 2.3.3 Amasty Product Feed 2.5.1 Temporary solution Although I updated the extension … Read more

Rollbar – best freemium tool for Magento 2 error tracking

Introduction Rollbar is a freemium tool that I used to track all my Magento 2 sites. There are so many reasons that I have to use it: I don’t want to use SSH and view the exception.log on a console. The log isn’t included additional information like Browser, OS, and device type. It’s inconvenient to … Read more

Fix error after disable Temando_Shipping

1. The site is facing this error: temando.CRITICAL: “accountId” is required. Enter and try again. {“exception”:”[object] (Magento\\Framework\\Exception\\InputException(code: 0): \”accountId\” is required. Enter and try again. at /path_to_magento_dir/vendor/magento/framework/Exception/InputException.php:91)”} [] 2. I figured out that the Temando_shipping extension causes this issue. So I disabled it by these commands: bin/magento module:disable Temando_Shipping bin/magento setup:upgrade bin/magento setup:di:compile bin/magento indexer:reindex … Read more

Fix M2 issue when using the same DB with WordPress

The problem Error message when running setup:upgrade: “Cannot process definition to array for type tinytext” Or: “Types char is not declared” The problem is Magento 2 doesn’t support some data types, it doesn’t allow them in its DB: enum time mediumint tinytext char My suggestion: Don’t ever use the same database with WordPress!!! How to … Read more

Query to get the top buyers in Magento 2

SELECT `sales_order`.`customer_id`, `email`, `firstname`, `lastname`, `telephone`, `street`, `city`, `region`, `company`, SUM(subtotal_invoiced) FROM (`sales_order` LEFT JOIN `sales_order_address` ON `sales_order`.`entity_id` = `sales_order_address`.`parent_id` AND `sales_order_address`.`address_type` = "billing") WHERE state = "complete" AND store_id = 1 GROUP BY customer_email ORDER BY SUM(subtotal_invoiced) DESC LIMIT 100   Note: Guest users have customer_id NULL.

Standalone function get increment_id using order id

private static function getIncrementIDfromOrderID($orderID) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager $resource = $objectManager->get('Magento\Framework\App\ResourceConnection'); $connection = $resource->getConnection(); $tableName = $resource->getTableName('sales_order'); //gives table name with prefix //Select Data from table $result = $connection->fetchAll("SELECT increment_id FROM " . $tableName . " WHERE entity_id = " . $orderID); if (count($result)) { return $result[0]['increment_id']; } return 0; … Read more