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 […]
Magento 2.4 newsletter using ajax
Magento 2.4 newsletter using ajax, Customers subscribe to the newsletter in your store for any reason, they will get message near to newsletter. Steps to AJAX Newsletter in Magento 2: 1 Create di.xml at MyVendor/MyModule/etc folder <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <type name=”Magento\Newsletter\Controller\Subscriber\NewAction”> <plugin name=”custom_Subscriber_NewAction” type=”MyVendor\MyModule\Plugin\Controller\Subscriber\NewAction” sortOrder=”10″ disabled=”false” /> </type> </config> 2. Create NewAction.php at […]
HTTP response status codes
HTTP response status codes indicate whether a specific HTTP request has been successfully completed Common HTTP status codes and reason: 400 Bad Request – This means that client-side input fails validation. 401 Unauthorized – This means the user isn’t not authorized to access a resource. It usually returns when the user isn’t authenticated. 403 Forbidden […]
Section wise scrolling in jQuery
Section wise scrolling in jquery, smoothly snaps to sections. Mouse scroll to scroll and snap to each section. Set the ID for your section to scroll the section. You can change the speed of the scrolling and stay time on the section. Example of section wise scrolling in jQuery <!DOCTYPE html> <html> <head> <meta charset=”utf-8″> […]
Get block attribute value in phtml
Add block in your CMS page or CMS block {{block type=”Myvendor\Mymodule\Block\Index” template=”Myvendor_Mymodule::index.phtml” deskdisplay=”4″ tabletdisplay=”2″ mobiledisplay=”1″}} In Your phtml file get the attribute value. echo $deskDisplay = $block->getData(“deskdisplay”); Related Post : Create enquiry form in Magento 2 Like us on Facebook and Linkedin for more updates.
Access denied for user ‘phpmyadmin’@’localhost’ (using password: YES)
In this blog, we will see how to fix the error “Access denied for user ‘phpmyadmin’@’localhost’ (using password: YES)” following simple steps. Once you follow the below you will be able again to use your phpMyAdmin@localhost database. Below are the steps:- You have to open XAMPP Control Panel ->Click MySql Config->Click my.ini. It will open […]
How to find nearest value in PHP
Today we discuss about the nearest Value in PHP. Suppose that I have nmber like 456 its will become 460. You can get right value using below method. Nearest the value in PHP echo roundToTheNearestAnything(121, 10).'<br>’; echo roundToTheNearestAnything(8, 5).'<br>’; echo roundToTheNearestAnything(1, 2).'<br>’; function roundToTheNearestAnything($value, $roundTo) { $mod = $value%$roundTo; return $value+($mod<($roundTo/2)?-$mod:$roundTo-$mod); } Nearest the value […]
Magento2.4 run from root
We will discuss how to execute the Magento2.4 run from root.Magent2.4.x by default does not load from the root of Magento. 404 Not Found after fresh Magento 2.4 installation It seems now Magento will only load from pub folder. So the best solution for this is to create a virtual host and point it to […]
Magento 2 send custom email programmatically
Hello reader, In this article, we are going to send a custom email template, after creating a form, on submission of that form we will send form information by sending a custom email. This email will use custom email template. Email is a way to communicate with customers and suppliers or vice-versa The below files […]
Magento 2 command list
Hello reader today we share list of the some usfull magento 2 command list. You will find the list of important commands Magento 2. Connect the SSH and go to magento root directory to run/execute the commands MAGENTO 2 USEFUL COMMANDS LIST Elasticsearch entry into Database bin/magento config:set catalog/search/engine elasticsearch7 bin/magento config:set catalog/search/elasticsearch7_server_hostname 191.161.1.11 bin/magento […]
Create enquiry form in Magento 2
Today I am going to explain How to Create Custom enquire Form in Magento 2. Forms are a great way to gather customer information and insert into database or send email to the admin user as per the requirement. With the help of the below code, you can Create Custom Form in Magento 2 Frontend. […]
Magento 2 add custom js file in module
Hey reader today we will disscuss about to add js file in custom module . Please follow below step to done this job. Step 1. Create requirejs-config.js file on below path :- app/code/VendorName/ModuleName/view/frontend/requirejs-config.js var config = { map: { ‘*’: { myjs: ‘VendorName_ModuleName/js/myjs’, } }, deps: [‘jquery’] }; Step 2. Create myjs.js file on below […]