Author: IntegerByte

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 […]

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 […]

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 […]

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 […]

Back To Top