We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
Here Is What You Should know about Magento 2 Enhanced Product Grid
Magento is a powerful ecommerce platform which is loaded with numerous high-quality features that are ready to uplift your experience of doing business. Today if you look around you will find that the entire ecommerce market is flooded by the abundance of things in your store? And consequently it became a daunting task for customers to find their desired items quickly.
And in this connection Magento 2 SKU Search Magento 2 Enhanced Product Grid is unquestionably a best solution for them, particularly wholesale customers. Managing thousands of products is also a difficult task. For Magento 2 Settings, administrators must manage each product.
Finding the correct ones, configuring them, and reviewing their statuses may be a nightmare for store managers because it is not only time-consuming but also repetitive. The instructions below provide a simple yet efficient solution for Magento 2 SKU setting of Search. We did some research and discovered some interesting facts about SKUs.
This article will help you to understand a straightforward method for properly configuring Magento 2 Product Grid Search and increasing sales for your online stores.
Let us get started! But before understand
What exactly is SKU in Magento 2?
In Magento 2 Settings, SKU stands for Stock Keeping Unit. It is the inventory's smallest product section. An SKU is a machine-readable product label code that typically consists of 8-12 characters.
These labels are used by shop administrators for easy search, identifying product groups, monitoring stock status, and inventory management. Magento 2 enhanced product grid Magento extension is a perfect tool for both admins and customers.
Whereas, SKU is the most important factor in differentiating products in a store, each SKU must be specified uniquely. Although few buyers look for products by SKU, it is extremely useful for wholesale customers, for example. As a result, Magento 2 Enhanced Product Grid stand out from the mass of products on the market.
Some suggestions for naming SKUs in Magento 2 SKU Configuration:
- Make them distinct and memorable.
- Letters in SKUs should be arranged in the order of classification importance. For example, the product category should come before the product colour: Jeans-RSH-S-blue.
- Avoid using characters that are difficult to pronounce and take a long time to type, such as é è or á, as well as spaces or symbols such as @ percent or |.
- It is advised to use dashes "-" or underscores "_" to help distinguish between product features.
How to Filter by Multiple SKU on the Admin Product Grid in Magento 2:
Step 1:
In your extension app code Vendor Extension etc, create a di.xml file. di.xml
Now, add the following code:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider" type="Vendor\Extension\Model\ProductDataProvider" />
</config>
Step 2:
Create the Product Data Provider. PHP file in the app code Vendor Extension Model Product Data Provider. php directory.
Then enter the code as shown below.
<?php
namespace Vendor\Extension\Model;
class ProductDataProvider extends \Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider
{
/**
* @inheritdoc
*/
public function addFilter(\Magento\Framework\Api\Filter $filter)
{
if (isset($this->addFilterStrategies[$filter->getField()]))
{
$this->addFilterStrategies[$filter->getField()]
->addFilter(
$this->getCollection(),
$filter->getField(),
[$filter->getConditionType() => $filter->getValue()]
);
}
elseif ($filter->getField() == "sku" && count(explode(",",str_replace("%","",$filter->getValue()))) > 1)
{
$withComma = explode(",",str_replace("%","",$filter->getValue()));
$attrs = array();
foreach ($withComma as $cItem)
{
$attrs[] = ['attribute' => $filter->getField(), $filter->getConditionType() => '%'.trim($cItem).'%'];
}
$this->getCollection()->addAttributeToFilter($attrs);
}
else
{
parent::addFilter($filter);
}
}
}
Let us get started! But before understand
Conclusion:
This post will assist you in understanding what SKU is in Magento 2 and how to best filter numerous SKUs on the admin product grid in Magento 2.