Home » Archive

Articles in the Magento Category

Magento, Magento 2 »

[5 May 2016 | No Comment]

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 object of StoreManagerInterface in the constructor of my module’s block class.

Magento, Magento 2 »

[28 Apr 2016 | No Comment]

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.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of StoreManagerInterface & Currency in the constructor of my module’s block class.

Magento »

[18 Apr 2016 | No Comment]

This article shows how to add configurable products to wishlist along with their options value. By default, you don’t need to select any configurable product option when you want to add the configurable product to wishlist. But, you will have to select the configurable option while adding the product to cart.
So, you might be in need to make the “Add to Wishlist” behave exactly like “Add to Cart”. The other benefit of doing so (asking user to choose configurable options while adding to wishlist) is that when you move the …

Magento, Magento 2 »

[14 Apr 2016 | No Comment]

Magento 2 uses Symfony’s Console Component for its command-line interface or tool (CLI) where we can execute different commands for different tasks related to installation and configuration.
Through the Command Line Interface (CLI) tool in Magento 2, you can perform different tasks like:

Magento »

[11 Apr 2016 | No Comment]

This article shows how to get / filter products based on it’s attribute id, or the attribute’s options id.
Get all products by a single attribute option id

Magento, Magento 2 »

[7 Apr 2016 | No Comment]

This article shows how you can create a simple Hello World module / extension in Magento 2. The necessary files are listed with the code.
This module just calls a block function in template file to print Hello World text.

Magento »

[29 Mar 2016 | No Comment]

This article shows how you can filter child products associated with a configurable product by the child product’s attribute value.
Suppose, we have a configurable product with two attributes (‘size‘ and ‘color‘) and we want to select only those child products with certain size and/or certain color. Let’s say, we want to select only those products that have color as ‘Red‘.

Magento, Magento 2 »

[28 Mar 2016 | No Comment]

This article shows how we can check if a module is installed / enabled or active in Magento 2.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Framework\Module\Manager class in the constructor of my module’s block class.
app/code/Chapagain/HelloWorld/Block/HelloWorld.php

Magento, Magento 2 »

[24 Mar 2016 | No Comment]

In Magento 1.x, you could call/print any module’s template block in any other template (phtml) file with the following code:

Magento, Magento 2 »

[21 Mar 2016 | No Comment]

In Magento 1.x, you could call/print the CMS Static Block in template file with the following code:

Magento »

[17 Mar 2016 | No Comment]

To display/show product price including tax amount, you need to do some configuration settings.
1. Create Tax Rule
You need to create tax rules (Sales -> Tax -> Manage Tax Rules). For this, you can refer to different tutorials available over the internet on creating Tax rules.

Magento »

[10 Mar 2016 | No Comment]

This article shows how to use AJAX on Magento with Prototype Javascript Library.
Scenario
I had one scenario where I had to check whether a customer is already registered or not via AJAX.

Magento, Magento 2 »

[4 Mar 2016 | No Comment]

This article shows how we can get parent category, children categories and total number of products in a category in Magento 2.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Catalog\Model\CategoryFactory class in the constructor of my module’s block class.

Magento, Magento 2 »

[1 Mar 2016 | 2 Comments]

This article shows how we can get all products of a particular category in Magento 2.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Catalog\Model\CategoryFactory class in the constructor of my module’s block class.
app/code/Chapagain/HelloWorld/Block/HelloWorld.php

Magento, Magento 2 »

[28 Feb 2016 | No Comment]

This article shows how we can get product collection in Magento 2.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory class in the constructor of my module’s block class.
app/code/Chapagain/HelloWorld/Block/HelloWorld.php