Magento 2: Get Controller, Module, Action & Route Name

This article shows how we can get name of the current module, controller name, action name and route name in Magento 2. Using Dependency Injection (DI) Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Framework\App\Request\Http class in the constructor of my module’s block class. app/code/Chapagain/HelloWorld/Block/HelloWorld.php <?php namespace Chapagain\HelloWorld\Block; … Read more

Magento 2: Check if Current URL is Homepage

This article shows how we can check if the current page URL is homepage URL in Magento 2. Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of Logo block class in the constructor of my module’s block class. app/code/Chapagain/HelloWorld/Block/HelloWorld.php <?php namespace Chapagain\HelloWorld\Block; class HelloWorld extends \Magento\Framework\View\Element\Template { protected $_logo; … Read more

Magento 2: Check if Current URL & Frontend URL are Secure (https)

This article shows how we can check if current URL and frontend URl are secure (https) or not in Magento 2. Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of StoreManagerInterface in the constructor of my module’s block class. app/code/Chapagain/HelloWorld/Block/HelloWorld.php <?php namespace Chapagain\HelloWorld\Block; class HelloWorld extends \Magento\Framework\View\Element\Template { protected … Read more

Magento 2: Get Store Information (Store ID, Code, Name, URL, Website ID)

This article shows how we can get store information in Magento 2. We will be fetching store id, store code, store name, store url, and store’s website id. We also write a function which checks if the store is active or not. Below is a block class of my custom module (Chapagain_HelloWorld). I have injected … Read more

Recommender System using Python & python-recsys

python-recsys is a Python Library for implementing a Recommender System. Currently, python-recsys supports two Recommender Algorithms: Singular Value Decomposition (SVD) and Neighborhood SVD. Here is a QuickStart tutorial on using python-recsys for Recommender Systems. It takes movielens’s movie ratings dataset and shows examples about computing similarity between movie items and recommending movies to users. Here, … Read more

Magento 2: Get Currency Code, Currency Symbol & Currency Rate

This article shows how we can get our store’s currency code, currency symbol, and currency rate in Magento 2. We will be fetching all base, default and current currency code. We will also be fetching available currency codes and allowed currency codes. Using Dependency Injection (DI) Below is a block class of my custom module … Read more

Recommender System using JAVA & LibRec

LibRec is a promising JAVA library for Recommender Systems. It implements a lot of Recommender Algorithms. It consists of three major components: Generic Interfaces, Data Structures and Recommendation Algorithms. Here are some useful resources for LibRec: LibRec Tutorial LibRec Examples on Real Data Sets & comparison with other recommendation libraries A Collection of Recommendation Data … Read more