Page 53 of 69

Magento 2 – How to Check Current URL is Homepage

In this post I am going to explain How to check IsHomePage in Magento 2. Add below code snippet in Block class. protected $_logo; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Theme\Block\Html\Header\Logo $logo, array $data = [] ) { $this->_logo = $logo; parent::__construct($context, $data); } public function isHomePage() { return $this->_logo->isHomePage(); }   Add below code snippet…

Magento 2 – How to Get Module, Controller, Action and Route Name

In this post I am going to explain how to get module, controller, action and route name in Magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_request; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Request\Http $request, array $data = [] ) { $this->_request = $request; parent::__construct($context, $data); } public function getModuleName()…

Magento 2 – How to get Logo Height, Width, Image URL and Alt Text

In this post I am going to explain how to get logo height, width, image url and alt text in Magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_logo; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Theme\Block\Html\Header\Logo $logo, array $data = [] ) { $this->_logo = $logo; parent::__construct($context, $data); } //…

Magento 2 – How to Get List of Current Store Categories

In this post I am going to explain how to get list of store categories in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_storeManager; protected $_categoryCollection; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollection, array $data = [] ) { $this->_storeManager = $storeManager; $this->_categoryCollection = $categoryCollection; parent::__construct($context,…

Magento 2 – How to Get All Categories of Specific Product

In this post I am going to explain how to get all categories of specific product in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_categoryCollectionFactory; protected $_productRepository; public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory, \Magento\Catalog\Model\ProductRepository $productRepository, array $data = [] ) { $this->_categoryCollectionFactory = $categoryCollectionFactory; $this->_productRepository = $productRepository;…

Magento 2 – How to Get All Active Payment Methods

In this post I am going to explain how to get all active payment methods in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_paymentConfig; protected $_scopeConfigInterface; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Payment\Model\Config $paymentConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfigInterface, array $data = [] ) { $this->_paymentConfig = $paymentConfig; $this->_scopeConfigInterface = $scopeConfigInterface; parent::__construct($context,…

Magento 2 – How to Get All Payment Methods

In this post I am going to explain how to get all payment methods in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_paymentHelper; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Payment\Helper\Data $paymentHelper, array $data = [] ) { $this->_paymentHelper = $paymentHelper; parent::__construct($context, $data); } public function getAllPaymentMethods() { $paymentMethods =…

Magento 2 – How to Get Customer Group Collection

In this post I am going to explain how to get customer group collection. 1. Using Dependency Injection Add below code snippet in Block class. protected $_customerGroupCollection; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Customer\Model\ResourceModel\Group\Collection $customerGroupCollection, array $data = [] ) { $this->_customerGroupCollection = $customerGroupCollection; parent::__construct($context, $data); } public function getCustomerGroupCollection() { $customerGroupsCollection = $this->_customerGroupCollection->toOptionArray(); return $customerGroupsCollection;…

Magento 2 – How to get Product Attribute Id, Name, Options from Attribute Code

In this post I am going to explain how to get the attribute information from attribute code in magento 2. 1. Using Dependency Injection Add below code snippet in Block class. protected $_entityAttribute; protected $_attributeOptionCollection; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Eav\Model\Entity\Attribute $entityAttribute, \Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\Collection $attributeOptionCollection, array $data = [] ) { $this->_entityAttribute = $entityAttribute; $this->_attributeOptionCollection =…

Top 5 Free Fashion & Apparel Prestashop Themes for 2019

Wants to create Fashion & Apparel store? You are at the right place. Here we presenting a FREE Prestashop Themes that perfectly designed for the Fashion & Apparel store. Here’s they are! Following are the Best Free Fashion & Apparel Responsive PrestaShop 1.7 themes. 1.Etrend Lite – Free PrestaShop Theme Free Download Get Hosting Let’s…

« Older posts Newer posts »