Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [attributes]

Magento Entity Attributes

62
votes
3answers
62k views

Adding custom attribute to Customer

We need a simple way to add an attribute to a customer record that is not editable by the customer or admin, only programatically. Essentially, we have an ExpressionEngine site coupled with Magento. ...
28
votes
3answers
30k views

Delete custom EAV attributes from the database

I want to remove unused EAV attributes directly from the database before I move my store live. Attributes can be found in eav_attribute table, can I delete attributes from this table? Is it safe? Or ...
27
votes
4answers
40k views

Upgrade script - Create new select attribute with options

I would like to create a new product attribute with some predefined options using an upgrade script. I have an upgrade script working, so the only thing i dont know how to do is to add the drop down ...
23
votes
3answers
29k views

How to Get A List Of All Attributes

How can I fetch a list (array) of all defined product attributes? (basically I need the code and label). edit: The attributes I need this to dynamically generate ACLs for all product attributes ...
21
votes
2answers
24k views

product attribute to quote item and order item

What is the correct way in magento to have a product attribute be automatically persisted to quote item and then finally to order item? Is it as simple as a little config xml or is it a manual ...
21
votes
2answers
7k views

Attribute backend_type = static?

Can someone explain the importance/relevance of the backend_type static for an attribute? I am having some problems with an attribute not being loaded and I'm wondering whether this backend_type has ...
20
votes
2answers
8k views

What is the difference of addAttributeToFilter() Vs addFieldToFilter()?

I'm bit of confused what is the difference of addAttributeToFilter() and addFieldToFilter() functions. I checked the core files in magento. But I could not figured out a clear idea. Because for some ...
20
votes
2answers
15k views

How to add a customer custom-attribute in the customer address edit form?

I added a customer custom attribute as customer_address type and it runs correctly in the admin and in onepagecheckout as well as in shipping & billing address. I created: my_namespace/my_module/...
19
votes
1answer
23k views

How to disable “Add to Cart” on specific products, and instead display “View Details” button in category list view?

I was wondering how to disable Add to Cart button on a few specific products, and I found an abandoned guide on how to do this, which worked, but it was somewhat incomplete, as it only was just a ...
18
votes
2answers
71k views

How to get attribute “option label/attribute text” having “attribute value” (option_id)?

Suppose I have an attribute that is a collection of option (dropdown/multiselect). I can retrieve the attribute value for a given product: $store_id = [something]; $productId = [something]; // this ...
17
votes
5answers
13k views

Get product attribute in cart in Magento2

I'm trying to grab a product attribute in the cart template. But I just does not work! The attribute is set to Visible on Catalog Pages on Storefront = yes and Used in Product Listing = yes I use a ...
16
votes
3answers
26k views

Filtering results using LIKE

Consider these three "haystack" strings: a) foo bar b) welcome to foo bar industries c) foo barer And now my "needle": foo bar (Heh) I would like my filter to match my needle with haystack ...
15
votes
2answers
14k views

How to Programmatically set a Product's Multi-Select Attribute by Labels

If have a multiselect attribute and want to set the selection on a product. $selectedOptions = "red,green,blue"; $product->..... // # what to do? How can I do that?
15
votes
4answers
4k views

Adding multiple items with different attributes to cart programmatically

I'm making a bulk add to cart system. Please note : i want it to works for simple products with with custom options -> Where custom option are like color(red , green , blue) or Size(Xl, M , S) ...
14
votes
6answers
10k views

How Magento2 add attribute option programmatically (not in setup)

I try to add options for size and color attributes in my importer modul but I don't how...: private function addOption($attributeCode, $value) { $ob = $this->_objectManager; /* @var $...
13
votes
1answer
18k views

How to get all options for all store views for a single attribute?

I am trying to retrieve all options for all store views for a single attribute e.g. color. For the attribute color I have created two options blue and white. I have tried the following code that is ...
12
votes
6answers
34k views

Magento 2 - How to get attribute of product?

How to get attribute of product?
12
votes
3answers
9k 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
6answers
35k views

Efficient way to get product URL and image

While building an addition to a Magento webshop, I stumbled upon a couple of problems. In my pursuit to create code which is as fast as possible, I found myself unable to figure out two things. My (...
12
votes
2answers
22k views

Select more than one item in layered navigation (multiple select/checkboxes)

How do you convert the standard layered navigation to use checkboxes or multiple select inputs for attributes of type dropdown or multiselect? For example if a user selects blue and red for the ...
12
votes
4answers
21k views

Get selected multiselect attribute values for one product

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 ...
12
votes
2answers
1k views

how to save image custom attribute in magento 2

I need to display few images of product in frontend based on condition: use for virtual mirror should be checked. <?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for ...
11
votes
2answers
17k views

How to save value for a Specific[custom] Product Attribute from Product Model

How to save value for a Specific[custom] Product Attribute from Product Model ? I have found the below script from here : $product = Mage::getModel('catalog/product')->load(1); $product->...
11
votes
5answers
20k views

Magento 2: How to display custom attribute in catalog?

I’ve created a new textfield attribute, with the following settings set to yes: Visible on Catalog Pages on Storefront Used in Product Listing The attribute is assigned to an attribute set and it ...
11
votes
3answers
45k views

Get Option Value by Id of Attribute in Magento

How can Magento find an attribute value by a given attribute label or a given attribute id?
11
votes
1answer
435 views

Magento 2 Show customer attribute in ui_component form

I've created ui_component form. Where I need to show customer details, Same as Customer Edit. But, I can able to show their data from customer_entity table. DataProvider.php public function ...
10
votes
2answers
15k 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(); //...
10
votes
2answers
36k 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(); /** @...
10
votes
4answers
14k views

Hide Attributes and Other Fields in Product Edit Backend

To make editing of products (and maybe also categories) for the shop owner easier, we would like to hide some unnecessary tabs and fields from some users in the admin backend. This means: Hiding some ...
10
votes
2answers
7k views

Magento 2 How to uninstall attributes added by custom module?

So far I know that when uninstalling a custom module, it is possible to remove custom tables or columns added by custom module by using uninstall.php which extends \Magento\Framework\Setup\...
10
votes
1answer
6k views

set attributes to 'use default value' for a list of products

I want to set the images to 'use default value' for a list of product, and for a list of store view. I know how to do it individually for each product : setData(attributeName,false), and so i can do a ...
10
votes
2answers
3k views

Magento 2 :- Add select attribute to category

I want to add a select/dropdown attribute to a category and display it in the backend to let the store owner select it. After some research I found out the following to do: Create an attribute via ...
9
votes
2answers
6k views

Magento 2 how to save custom field added in the form of customer group?

I've added some custom fields to the form of customer group by using upgradeSchema.php. After that I found that the original fields like customer group code and tax id are saved by using setter ...
9
votes
5answers
9k views

Configurable product attribute sort order in Dropdown 2.12

The order of the dropdown is not consistent with the order of the attribute itself. Within the attribute size I have it ordered Newborn 0-3 mo and in the dropdown it shows up as 0-3 Newborn the ...
9
votes
2answers
3k views

Magento 2: what is the catalog_attributes.xml file?

I noticed that Magento 2 contains several catalog_attributes.xml files in the following folders: app/code/Magento/Bundle/etc app/code/Magento/Catalog/etc app/code/Magento/CatalogSearch/etc app/code/...
9
votes
5answers
24k 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(...
9
votes
4answers
4k views

Why do attribute codes have a maximum length?

When trying to create attributes, I've discovered that the maximum length of an attribute code is 30 characters. Turns out though, that this is NOT actually some sort of real restriction - it is a ...
9
votes
2answers
1k 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....
9
votes
2answers
1k views

Filter Product Collection by Child product attribute

I have situation like 2 attribute which is assign to child product 1) person_height_from and 2) person_height_to which has DropDown type attribute which is only assign in child product but not ...
8
votes
2answers
14k views

Collections - Filtering multiple multi-select attribute values

That's not a typo. I am aware that I need to use 'finset' to filter my multi-select attributes; however, I am trying to filter multiple values at once and getting: Incorrect parameter count in the ...
8
votes
6answers
9k views

Update is_required for Existing Attribute Code

I am thinking to update is_required data to "1" for existing "Region" attribute code. select * From eav_attribute where attribute_id = '28' However, I am wondering what is the practice here. Is it ...
8
votes
1answer
6k views

Remove category attribute

I inserted 2 category attributes using a module with the file mysql4-install-0.1.0.php in a sql folder: $installer = $this; $installer->startSetup(); $installer->addAttribute('...
8
votes
2answers
27k views

Adding custom attribute to customer registration form

I needed to create two new customer attributes. I have followed the guide from: http://www.fontis.com.au/blog/magento/know-more-about-your-customers-adding-custom-signup-attributes to create these ...
8
votes
1answer
17k views

Changing the Attribute Set for a Simple Product

Basically the subject. I have a simple product created with a particular attribute set. Is there a way to change the attribute set associated with this product without having to create a new one?
8
votes
1answer
4k views

Whats the best way to check if a custom attribute exists in Magento2

In being careful, I want to check if my custom attribute exists before I attempt to utilize it in any way. I need to check against all attributes collection, not just the product collection. My ...
8
votes
2answers
2k views

Custom non-attribute based layered navigation. Is this the only way to do it?

Today I have been knocking up a layered navigation option that is not based on an attribute. It is for ratings so the front end can show nice shiny stars. To do this I have: Created a module ...
8
votes
1answer
4k views

Magento 2.2.0 upgrade, error attribute type is not allowed

I was able to upgrade a Magento store from 2.1.6 to 2.2.0. The backend is working very good, but I am encountering an exception on the front office. The exception message says: Element '...
8
votes
4answers
2k views

Magento 2 API: Filter orders by extension attribute

I have an extension with an attribute assigned to order items called warehouse. I can see this attribute under the property "extension_attributes". I need to filter orders based on this attribute. I ...
7
votes
2answers
6k views

layered navigation isn't populated by collection attributes — CMS page

I'm attempting to add layered navigation to a CMS page containing a widget that contains a custom product collection (products that are 'new'). Within this widget are fuctions that, given the correct ...
7
votes
3answers
9k views

Programmatically create new attribute set while inheriting from another

I am programmatically creating attributes and attribute sets. The attributes work like they should, but with the attribute sets I have a problem. When I create an attribute set, I can not let it ...