Home » Archive

Articles tagged with: product

PHP »

[17 Oct 2017 | No Comment]

This article shows how you can use MailChimp API v3.0 with PHP and CURL to add ecommerce data to your MailChimp campaign. When purchases happen in your shop then you can add your purchase order data to MailChimp to track purchases from your MailChimp Campaign. A MailChimp campaign is associated to any particular MailChimp list.
To add order data into MailChimp you need to follow the below steps sequentially:

Magento »

[2 May 2017 | No Comment]

This article shows how you can add new columns to product grid (Catalog -> Manage Products) in Magento 1.x admin.
For this, you need to rewrite/override the Adminhtml’s catalog_product_grid block class.

Magento, Magento 2 »

[16 Jan 2017 | No Comment]

This article shows how you can get attribute name or label, id, entity_type, etc. by attribute code in Magento 2.
If you would like get attribute name and value in Magento 1 then you may refer to this article: Magento: How to get attribute name and value?

Magento, Magento 2 »

[26 Sep 2016 | 3 Comments]

This article shows how to get custom option values of products/items added to cart or products of any order in Magento 2.
I will simply be using ObjectManager for this example.

Magento, Magento 2 »

[19 Sep 2016 | 4 Comments]

This article shows how we can get list of all categories from current product or any particular product as well.
Both ways (Dependency Injection & Object Manager way) are shown below:

Magento, Magento 2 »

[23 Jun 2016 | One Comment]

This article shows how get height and width of the media images in Magento 2.
In this example, we will load product by id or sku and then fetch and display height and width of product small image.
To load the product, we will be using Magento 2’s Service Layer for this task. Use of Service Layer is highly encouraged by Magento.

Magento, Magento 2 »

[16 Jun 2016 | No Comment]

This article shows how to resize product image in Magento 2. In this example, we will be loading a product by id or sku and then resizing its image. We will also be injecting the object of Catalog Helper Image class for image resize purpose.
To load the product, we will be using Magento 2’s Service Layer for this task. Use of Service Layer is highly encouraged by Magento.

Miscellaneous »

[10 Jun 2016 | 2 Comments]

This article shows how to load product by it’s ID and then get all attributes associated with that product in Magento 2. We print the attribute code, attribute name, and attribute value of all the attributes related to any particular product.
We will be using Magento 2’s Service Layer for this task. Use of Service Layer is highly encouraged by Magento.

Magento, Magento 2 »

[6 Jun 2016 | 7 Comments]

This article shows how to get stock quantity (qty) of a product in Magento 2. We can also fetch other stock information like minimum quantity (min_qty), minimum sale quantity (min_sale_qty), maximum sale quantity (max_sale_qty), see if a product is in stock (is_in_stock), etc.
We will be using Magento 2’s Service Layer for this task. Use of Service Layer is highly encouraged by Magento.

Magento, Magento 2 »

[1 Jun 2016 | 2 Comments]

This article shows how to load product by id and sku in Magento 2.
We will be using Magento 2’s Service Layer for this task. Use of Service Layer is highly encouraged by Magento.
Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of \Magento\Catalog\Model\ProductRepository class in the constructor of my module’s block class.

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 »

[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 »

[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, Magento 2 »

[4 Mar 2016 | 4 Comments]

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 | 5 Comments]

This article shows how we can get all products of a particular category in Magento 2.
Both Dependency Injection and Object Manager way of coding is shown below.
Using Dependency Injection (DI)