How to Work with Product Collection Magento 2

Get All Products of a category

——————— Visibility Filter  

Status Filter —————–

—————————————— Add Product Price To Collection

————————————— Add Website ID to the collection  

————————————— Filter Current Store Products

—————————— Filter Current Website Products

  —————————— Add SEO Product URL

———————— Add Category Ids […]

Read More

How to Update a Column in a Table from Another Table’s Column

Some time you want to update a column in a table from another table’s column and in magento 2 you can use “updateFromSelect” function to do it. This is an example in resouce model

And this is the query after the code is render

Hope it helpful for you. The steps I mention […]

Read More

How to Create CMS Pages by Source Code in Magento 2

  In magento you can create and CMS pages in admin->CMS->Page. Additionally, you can also create it by setup or upgrade module. In this topic, you can know how to insert CMS page into Magento 2 by setup script through specific steps: Step 1: Create UpgradeData.php File Step 2: Setup the module version Step 3: […]

Read More

How to Add Custom Attribute to Customer Programmatically?

  We have known about how to add custom attribute to product in a lession before, now I will show you how to add custom attribute for customer. Firstly, you need create file InstallData.php in your Setup folder:

After all of that, you need open SSH and run command: php magento setup:upgrade Then clear […]

Read More

How to Fix Issue “No Region Found within the Locale…” in Magento 2

In magento 2 we usually use \Magento\Framework\CurrencyInterface class to calculate or convert price displaying. Sometimes it doesn’t work, an error displays: No region found within the locale “de” (or other locale code) but sometimes we don’t get this issue. In this topic we will give you a solution for this issue. How to get this […]

Read More

How to Loader Widget in Magento 2

Hello everyone. Loader is very useful for you when you make some Ajax request. It is very important when you develop a website. In Magento 2, it provide you a Loader widget Javascript. So you can call it for your purpose. You can define ‘mage/loader’ in your js to call the widget. The loader widget […]

Read More

Magento 2 – Debug in Command Line Mode

When use command line in magento 2, in file bin/magento with some code ex: setup, cache, indexer,… Some time you can get error but nothing to debug. Let try command follow: php -d display_errors bin/magento >log.txt Example: when I run sudo php bin/magento setup:upgrade, I get an error: “There are no commands defined in the […]

Read More

The Relationship between Order, Shipment and Package in Magento 2

Hi everyone, today I’m going to talk about some important definitions in Magento world. Today I’m going to talk about some important definitions in Magento world. They are ORDER, SHIPMENT and PACKAGE. In short, one ORDER can have multiple SHIPMENTS, and one SHIPMENT can have multiple PACKAGES. As we already know, ORDER is the thing […]

Read More

How to Add Top Link in Magento 2

In this topic we will show you How to Add Top Link in Magento 2 through 2 steps: Step 1: Create/ custom default.xml file Step 2: Create Link.php file Top links section in Magento is the default block generally used to create a personal area like My Account, My Wishlist, Log in etc. In this post, […]

Read More