Magento: How to search or filter by multiselect attribute in admin grid?

Suppose you have a multi select attribute and you have displayed it in admin grid. You have displayed the multi select attribute options as selection list. Now, you want to filter/search the grid by the multiselect attribute. The problem here is that the multiselect attribute value is store as comma separated value in database. When … Read more

Magento: How to get / filter all products by attribute value?

Here, I will show you how you can filter or fetch products related to any particular attribute and value. A simple scenario will be filtering products by manufacturer/brand. Suppose, I want to get all products under ‘Samsung’ manufacturer/brand. For this, you need the attribute code and attribute value ID for which you are fetching products. … Read more

Magento: Join, filter, select and sort attributes, fields and tables

In my previous article (Magento: Very Useful Collection Functions), I had written about database interaction functions present in class Varien_Data_Collection_Db. Here, I am going to explain some database interaction functions present in the class Mage_Eav_Model_Entity_Collection_Abstract. These collection functions are very useful to select data from Magento database. We need them almost all the time for … Read more

Magento: Adding category attributes

Here, I will be showing you how you can add attributes for your categories in Magento. From the admin panel, you can only add attributes to product. To add attributes to category, you need to write sql query in your phpmyadmin or a better way would be creating a new custom module and adding attributes … Read more

Magento: Get manufacturer name and id from product

Suppose, you have the product data, i.e. you have a loaded product information stored in a variable named ‘$_product‘. Now, when you type $_product->getManufacturer() , you will get the manufacturer ID. To get the manufacturer name, you have to use the following: $_product->getAttributeText(‘manufacturer’). Below is the complete code: Get Manufacturer Name and ID from Product … Read more

Magento: Adding attribute from MySql setup file

You can add attribute from Admin Panel -> Catalog -> Attributes -> Manage Attributes. You can also add attributes from mysql setup file of your module. MySql setup file is present inside “YourModule/sql/yourmodule_setup” directory. In the following example, the version of my module is 0.1.0.  I have added attribute for product. I have added a … Read more

Magento: How to get attribute name and value?

Attribute in Magento is like a property. All Products, Categories, Orders, Customers, etc. have attributes. For example, the attribute of a product is its name, sku, description, image, etc. This article will show you how to get attribute name and value for any product. Get attribute’s name, value, type, and other parameters The attribute code … Read more

Magento: How to delete System Attribute?

Suppose, you want to delete an attribute. But there is no delete option while you edit the attribute. This means that the attribute is system attribute. System attributes cannot be deleted. Only user defined attributes can be deleted. To delete the attribute, you have to make it user defined. – Go to phpmyadmin – Go … Read more