Node.js – Convert PDF base64 to PNG base64 on Lambda

I recently developed an application running on Lambda Node.js 14.x, lost lots of time on this part. So I think this post may help someone to save their time. Don’t hesitate to leave a comment below if you found this post is hard to understand or if you have any questions. 1. NPM package I … Read more

How to get Salesforce Sfdx Auth Url

1. Install SFDX Refs: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm The easiest way is to install via npm: npm install sfdx-cli –global To check if the sfdx is installed or not: sfdx –version 2. Authorize an org with the OAuth 2.0 webserver In this step, you will need to login via a web browser to authorize the CLI application. sfdx … Read more

Magento 2 log rotation with logrotate

Why? Log rotation is an automated process to remove or archive old and big log files. More information here. Magento 2 log files get bigger every day, it may take too much space and slow down your server. In fact, you can backup and delete Magento log files, but it’s better if there’s an automated … 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

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