Magento 2 product image in new order email

Today we discuss about display product image in new order email.Sometimes you want to add an image of the product in the mail send after a place order. You will need add some code into this file :- File : vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml Override 1:- Override above core file into theme app/design/frontend/[VENDOR]/[TEMPLATE]/Magento_Sales/templates/email/items/order/default.phtml Override 2:- Override above core […]

Magento 2 rtrim() expects parameter 1 to be string

Error : rtrim() expects parameter 1 to be string, bool given#0 ./vendor/magento/framework/Encryption/Adapter/Mcrypt.php(171): rtrim() Solution 1:- I just installed it on my server using apt install php7.4-mcrypt Restert apache server :- service apache2 restart Check php installed extention php -m Solution 2:- Run below command rm -rf var/cache/ generation/ chmod 777 -R var/ pub/ generated/ Related […]

Magento 2 success and error message

Today, we describe success and error messages in Magento 2. messageManagerDisplay success and error messages with the help of the messageManager object . protected messageManager; public function __construct( ——— \Magento\Framework\Message\ManagerInterface $messageManager, ——— ){ $this->messageManager = $messageManager; } public function myFucntion(){ $message =$this->messageManager->addError(__(“Error message”)); $message =$this->messageManager->addWarning(__(“Warning message”)); $message =$this->messageManager->addNotice(__(“Notice message”)); $message =$this->messageManager->addSuccess(__(“Success message”)); return $message; } […]

Create a pie chart using JavaScript.

Today, We learn to create a pie chart without any library. This post will take you through how to do that using JavaScript, HTML Canvas, and CSS. Pre-Requirements HTML CSS JavaScript Create a pie chart full code: <!DOCTYPE html> <html> <head> <title>canvas test</title> <style type=”text/css”> .pie_container{ width: 100%; height: 100vh; display: flex; justify-content: center; align-items: […]

magento2 get category image

Today we will learn about magento2 get category image in phtml file. I have Used This code to get Category images in my code Please look at these. I am using this module Myvendor/Mymodule. Solution 1 File: app/code/Myvendor/Mymodule/Block/Home/Category.php namespace Myvendor\Mymodule\Block\Home; use Magento\Framework\View\Element\Template\Context; use Magento\Catalog\ViewModel\Category\Image; class Category extends \Magento\Framework\View\Element\Template { public $image; public function __construct( Context […]

Back To Top