Questions tagged [product-attribute]

Questions about creating, managing and using product attributes

Filter by
Sorted by
Tagged with
30
votes
5answers
73k views

Why Can't I Load a Product by SKU using loadBySku()?

Synopsis I wanted to load a product by SKU there are many articles, blog posts, stack overflow results etc. All I want to know is - why does it have to be so difficult to load a product by a SKU? // ...
25
votes
9answers
66k views

Magento 2: Get product attribute’s select option id,label for configurable product

How to get an option value based on the option id in Magento, or get an option id based on the option code ? Example: how to get the color attribute option id 10 from the label "Red", and get the ...
20
votes
5answers
41k views

How do I get the current product?

I'm trying to retrieve the current product's attributes in a block in Magento 2. I can get a product, like ID 1: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $...
20
votes
2answers
78k views

Magento 2 : Get Custom Attribute Value of Product [duplicate]

I'm trying to get custom attribut from my product. I tried various methods like below, but non of them worked. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); /** @...
16
votes
2answers
20k views

Magento 2 : Add Product Attribute Programmatically

How to create Magento 2 Product Attribute Programmatically with type : Text Area.
15
votes
3answers
20k views

Magento : Fastest way to update a product attribute

I'm looking for the fastest and reliable method for mass attribute update. Below are the methods am aware of but I don't know with which I should go. $store_id = 0; Mage::getSingleton('catalog/...
15
votes
2answers
21k views

How to get the product type?

I'm creating a new module in Magento 2. I try to get product information in the phtml file. I have get successfully entity_id and product name information. but when I get product type information is ...
15
votes
2answers
8k views

Magento failing when trying to save product inside event observer on frontend?

I have a function that is tied to an event observer One of the requirements is that when it loops through the order item data, if a certain product attribute is empty it issues a request to get ...
15
votes
2answers
38k views

How to export all attributes and attribute sets from one magento installation and import to other installation?

I need to export all the product attributes and attribute sets from my current website (Enterprise Edition 1.12.0.0) and import all of them to a new website (CE 1.8). I've gone through these: ...
14
votes
4answers
23k views

Get value of selected multiselect attribute

Take the following "car" product: Volkswagen Golf. It has a multiselect attribute car_options with the following possible options and their ids: Airco (id=123) selected Radio (id=124) selected ...
13
votes
3answers
10k views

Read-Only Product Backend attribute

I would like to create an attribute read only however it look it is not possible. I have tried to pass to addAttribute() 'disabled' =>true or 'readonly' => true with out any success. I have ...
12
votes
5answers
10k views

How to show the drop down attribute value using getData() method in magento 2?

When I try to get data from the material attribute like $_product->getData('material'), it shows the integer value. How can I convert it to the actual front-end value and in which file do I have to ...
12
votes
2answers
10k views

Magento 2 get all product attributes without product id

I want to retrieve all product attributes those are available, then convert it to name & value for my select options field. In Magento 1 I can achieve it like this: public function ...
12
votes
9answers
16k views

How to hide empty attribute in any magento template?

I want to hide the custom attribute in magento template. My magento version is 1.8.1 We have added custom attribute for our product like brand, dimension, product type etc. but sometimes we didn't ...
12
votes
1answer
1k views

Product List Attribute Filter Query

I have added one filter in Method _getProductCollection() of the class Mage_Catalog_Block_Product_List as follows. protected function _getProductCollection() { ... $this->...
11
votes
2answers
23k views

How to get parent product id in magento 2?

How to get a child's parent product id in Magento 2 for the configurable products? I want to get the parent product id of child product in Magento based on child product id.
11
votes
4answers
15k views

Magento Indexer Not Adding Attribute to flat table in custom attribute

Magento Not adding custom Attribute to flat table..... I have a market place extension...which have some attribute but some attributes not adding to flat table...due to my extension not working.... ...
11
votes
5answers
27k views

Default value of 'yes/no' dropdown custom product attribute

I install the attribute with the following script: $installer = $this; $installer->startSetup(); $installer->removeAttribute('catalog_product', 'customizableonly'); $installer->addAttribute(...
11
votes
1answer
6k views

Magento 2 - Product sorting issue on category page using product attribute

I made product attribute and assign it on of attribute set so that it will show in the admin product detail page. Based on this product attribute I sort the product collection on category page. The ...
10
votes
2answers
16k views

Add Custom attributes to Custom attribute set programmatically

Hi Could someone help me with this? I created a custom attribute set and custom attribute as $installer = $this; /* @var $installer Mage_Eav_Model_Entity_Setup */ $installer->startSetup(); //...
9
votes
4answers
11k views

custom attributes in separate coloumn while export? - Magento 2.0.8

short description what I done: create product attribute set (Chennai) create 21 new product attributes assign to Chennai attribute set set value to attribute while create product export (System->...
9
votes
1answer
13k views

Adding custom attributes to product list

I'm very confused with a small issue in my catalog/product/list.phtml file. i'm trying to add the Manufacturer attribute that comes with Magento to my grid listing and have added the following code. ...
9
votes
2answers
2k views

Handling grouped product attributes

I'm working on building a new Magento shop (this is my first with Magento). I'm looking to replicate the look of an existing shop for my product pages, at least in terms of layout: http://www....
8
votes
2answers
14k views

How to create product's custom attribute with 'yes/no' dropdown using install Setup scripts in Magento 2?

I want to Create a product's custom attribute with 'yes/no' drop-down into my custom module. Please suggest any solution.
8
votes
3answers
14k views

Find the attribute_id by attribute_code

I need to find the attribute_id values of the attributes image, small_image and thumbnail. I know them for my database - 85, 86 and 87, but I need to make my query dynamic, instead of with hard-coded ...
8
votes
4answers
21k views

How to get the Description of a Magento\Catalog\Model\Product?

I'm in Magento2 and the getDescription(); does not work. I'm in the file Magento_Catalog/templates/product/list.phtml if that's relevant.
8
votes
2answers
39k views

Adding Custom Tabs in Product Detail Page

I have created an attribute with "Product Details" as Textarea in admin panel. Now I need to make it display as "Product Details" next to description tab in product detail page for each and every ...
8
votes
1answer
1k views

Product page tabs disappeared in admin after trying to add a new product attribute

I just followed instructions in this link, in order to add a new product attribute. After that most of my product tabs disappeared. Here are my final codes: /app/code/local/MyCompany/MultiSlider/...
8
votes
1answer
3k views

Configurable Products into Grouped Product

I want to add Configurable products inside Grouped product. Example like http://www.mitrelinen.com/products/savoy . Here all prodcuts (Duvet cover, fitted sheet etc) are configurable products ...
7
votes
6answers
20k views

How to delete an eav product attribute programmatically

i want to delete a product attribute from eav table pragmatically. I was getting a code which was delete customer attribute. I want just like this code ,which was delete product attribute. <?...
7
votes
6answers
21k views

Magento 2: Delete magento product attributes?

How do you delete created product attributes in Magento 2? I can't get rid of it. I have couple of Magento product attributes which not needed
7
votes
2answers
11k views

Magento 2 - Set custom attribute value on cart page

In Magento 1.x I have created following function in Namespace/Modulename/Model/Observer.php public function salesQuoteItemSetCustomAttribute($observer){ $quoteItem = $observer->...
7
votes
1answer
5k views

Display custom attribute on category page

On our category page I want to echo an custom attribute with attribute code "homepage_description". I tried this, but that does not work: <?php echo $_product->getHomepageDescription() ?> ...
7
votes
1answer
5k views

Set default value to custom attribute for all products

I have created the custom attribute (test) for products as a text field with default value('test') from admin panel And assigned that attribute to default attribute set. Now I can able to see the ...
7
votes
2answers
10k views

Magento 2 create custom swatch attribute programmatically

I would like to create attributes with swatch option programatically in Magento 2.
7
votes
1answer
10k views

How can I use a custom source model for a multiselect product attribute in Magento 2

I've created an attribute in Magento 2 of the type multiselect and now I want to have it populated by a custom source model. Now I remember from Magento 1 that when you want to do this, you had to ...
7
votes
3answers
3k views

Magento 2: “Empty option” for programmatically populated select attribute

I have a product attribute dropdown select box that I populate via a source model. The population works fine, but I want the first option in the list to be "Select one...". I've used the following ...
7
votes
1answer
3k views

How to get attributes by attribute set ID in Magento 2?

How can I retrieve a list of attributes and values by given attribute set ID in Magento 2?
7
votes
1answer
250 views

Magento 2, cannot use all option attributes when creating new configuration product

Using Magento 2.2, Back-end, Catalog-Product. I cannot use all product attributes for a new configuration product. Why can't I use all attributes in Stores -> Configuration? New Product Catalog-...
7
votes
1answer
1k views

Magento 2 - duplicate pricing block to show in 2 places on the product page

I'm new to Magento 2 and would like to see if anybody could help me. I need to show the product price in two different places on the product page. If a configurable product the price should render ...
7
votes
2answers
2k views

Add custom image upload attribute to product

I Have tried to add new image upload attribute to Magento Product using sql upgrade script, but I got the error message like: Invalid backend model specified: catalog/...
7
votes
1answer
1k views

Magento2 : How to get product dimension units (cm/in)?

I need to get the dimension units for width, height and length. There are solution available only to get the value of these attributes like, $product->getTsDimensionsLength(); $product->...
7
votes
2answers
4k views

Magento 2: Import/Export Product Attribute Set & it's Attributes

I refer Magento 2 - Export/Import Product Attributes but no one answered :( I have already created new Attribute Set & it's Attributes. I have checked Magento Default Import/Export for Products. ...
6
votes
2answers
7k views

Detect default attribute set id

There's 'Default' attribute set in the default Magento installation. You have no ability to remove that attribute set using admin gui (Remove button is hidden for this set). I did not found something ...
6
votes
2answers
6k views

Magento2 How to add row pattern/dynamic rows to the custom product attribute

Magento2 How to add row pattern/dynamic rows to the custom product attribute. Here is the sample output
6
votes
2answers
3k views

Set dropdown value using text value

I have a small import script that will import product to Magento 1. It works well but there is something not work.If a product attribute happen to be a select type attribute the value will not save. ...
6
votes
2answers
6k views

Magento 2: On product page HTTP ERROR 500

System: Magento 2.1 Everything was running fine 5 minuts ago. I had 3 Products in my Catalog (all using the same Attribute Set). Then I simply deleted 2 Attributes from my (currently in use) ...
6
votes
3answers
4k views

Add tabs with attribute content on product page 2.2.x

I've read many add tabs post here, but can't seem to get any to work the way I need to work. Attribute is 'sizechart' and is text field added to the default attribute set (but could be dropdown or ...
6
votes
2answers
20k views

How to get a product value attribute from attribute id?

I need to retrieve product attribute value based on the attribute id, here's how I get the id and label for each attribute $attributes= Mage::getResourceModel('catalog/product_attribute_collection')-&...
6
votes
1answer
4k views

Magento 2 Reindex Fail `Unknown column 'entity_value.value'` in 'field list'

I am having this error when running php bin/magento indexer:reindex also failing when loading the product: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'entity_value.value' in 'field list',...

1
2 3 4 5
36