Questions tagged [custom-attributes]

Denotes questions regarding Magento custom attributes

Filter by
Sorted by
Tagged with
19
votes
2answers
16k 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/...
11
votes
5answers
22k 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 ...
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(); //...
9
votes
2answers
6k views

Magento2 REST Update custom attributes

How can I update the custom attributes such as description? The following code properly update price and product name, but not custom attributes (unchanged). The new product is created properly with ...
7
votes
2answers
776 views

Magento 2: Create customer attributes programatically, without install script

How to create customer attributes magento 2 so it works in running script without install script:- /** * @var \Magento\Eav\Setup\EavSetupFactory */ protected $eavEavSetupFactory; ...
7
votes
1answer
543 views

Magento 2 Customer address attribute not saved while creating new order from admin

I have created one "Customer address" type of attribute name "Suburb", It successfully created. It shows on Checkout, Customer create(admin) and Create New Order address(Admin) section, While It ...
7
votes
1answer
573 views

Magento Too many tables error bulk updating products

This morning while selecting and enabling some one hundred products in magento i got this mysql too many table error Below is the snippet from the log file a:5:{i:0;s:92:"SQLSTATE[HY000]: General ...
6
votes
1answer
5k views

Magento 2 How to add custom product relations?

I am needing to add another related products attribute to associate multiple other products. I have found a solution for Magento 1: http://inchoo.net/magento/how-to-add-custom-product-relations-in-...
6
votes
4answers
1k views

How to add a unique custom attribute for a customer?

I was able to add a custom attribute called 'Username' to the Magento Customer model. The install-function in InstallData.php looks like this: public function install(ModuleDataSetupInterface $setup,...
5
votes
4answers
7k views

Product custom attribute import with CSV Magento 2.2

I am trying to import product with CSV in Magento2. In first case all attributes are default attributes so import works fine. Now In second case I have added some custom attribute in my Magento 2.2 ...
5
votes
2answers
4k views

Customer custom attribute not showing in admin form

I successfully add customer custom attribute for magento 2.2.5 like this: $setup->startSetup(); $insertArray = array( 'profile_picture' => array("type" => "varchar", "label" =&...
5
votes
5answers
5k views

Magento2 : How to update attribute option programmatically?

How to update attribute option (update label for a store) programmatically?
5
votes
2answers
8k views

Magento 2: Set Custom product attribute value programmatically on product save

How to set a product's custom attribute on save? I have used the event/observer way but nothing works.
5
votes
2answers
569 views

Magento 2 : Unable to set custom customer attributes programmatically

I have a cron job that runs once a day, that reads a file uploaded to the server, and registers users from that file. The code works fine, but now I added a custom attribute to the customer (lets call ...
5
votes
2answers
967 views

add values for custom attributes programtically

We are creating product programtically & inserting values for default attributes with help of below code. how i can add values for custom attributes . attribute code : delivery_info , attribute ...
5
votes
2answers
5k views

Magento2.1 - Show custom category attribute on frontend

I added a custom category attribute via a module as this tutorial shows, that's working fine; the field is shown and saved correctly in the backend. But I can't figure out how to show it on the ...
5
votes
2answers
100 views

How to Display Attribute value in magento 2 using getProducts() Method

When I Try to get data using below code,But return null value. $_attributeValue = $block->getProduct()->getResource()->getAttribute('weight_spices')->getFrontend()->getValue($block-&...
5
votes
1answer
2k views

Custom EAV model in magento 2

How we can create custom Eav entity and model in magento2. I want to create a custom module where new attributes/fields can be created by user. I will use it to show the details in the grid in admin ...
5
votes
3answers
1k views

Remove custom attribute from attribute set programatically magento2

I am trying to create a custom attribute and add it to a custom created attribute set. The problem is that it is being added to the Default attribute set. How can I make it only appear in my attribute ...
5
votes
3answers
2k views

Set custom address attribute value programmatically

I'm using Magento v2.1.6 and I have created a custom attribute for customer address like this: $customerEntity = $customerSetup->getEavConfig()->getEntityType('customer_address'); $...
5
votes
1answer
398 views

Magento 2 : Sort by custom attribute numeric value

I create a custom attribute in Magento 2 backend and make it use for sorting listings. The problem is the value is numeric in this attribute EX: (1,4,5,3,7) other attributes with text value sorting ...
4
votes
2answers
1k views

Magento 2 how to get custom attribute value in cart page and mini cart

Magento 2 how to get custom attribute value in cart page and weight in mini cart.
4
votes
2answers
337 views

Magento 2 | Access custom order attribute

I created an custom attribute for orders: UpgradeSchema.php <?php use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\Framework\...
4
votes
3answers
2k views

Magento 2. Add attribute to Catalog Price Rule

Is it possible to add additional (simple string) attribute to the Catalog Price Rule? If it is, please, tell about it in details. Better with working code example. [UPD] I mean add attribute to the ...
4
votes
3answers
1k views

(Zend_Db_Statement_Exception): SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'created_at' in where clause is ambiguous

I added sku, country_code and product name in the order grid. All works fine but when I filter Orders by Created at it throws following error Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[...
4
votes
1answer
5k views

Magento 2 - Save additional data to order

I am trying to build an extension that will check if a specific cookie exists at the time an order is being placed. If the cookie does exist, I would like to save its value to the order in the ...
4
votes
2answers
389 views

Widget/block code in product custom attribute not rendering at front-end magento 2.2.5

I have created custom attribute of Input Type "Text Area" with WYSIWYG option Enable. After that add widget code in that product custom attribute input at store back-end. Its showing same code ...
4
votes
1answer
2k views

Create customer custom attribute with input type checkbox, multiselect, and radio Magento 2

I successfully created custom attribute for customer with input type select/dropdown like this: $code = 'test'; $customerSetup = $this->customerSetupFactory->create(); $customerSetup->...
4
votes
1answer
70 views

How to get custom product attribute

I added new attribute src/app/code/local/PACK/MODUL/sql/pack_modul_setup/mysql4-upgrade-2.1.6-2.1.7.php : <?php $installer = $this; $installer->startSetup(); $installer->addAttribute('...
4
votes
2answers
4k views

How to save custom attribute value in customer entity table using controller

I want to save value in customer entity table in this table. I created one custom field & I want to save value in custom field using controller. But it is not working. How is it possible? ...
4
votes
2answers
4k views

How to create a customer programmatically with custom attributes in Magento 2?

I would like to create a customer account programmatically in Magento 2.0.4. I just have one problem. I don't know how to persist custom attributes. With following code, I got response that my ...
4
votes
1answer
39 views

How to set custom attribute value in m2epro extension once order create in Magento admin Magento2

I am using M2epro for Amazon and eBay. We want to set custom attribute value(static) once order creates in Magento admin. Can anyone have any idea how we can do it?
4
votes
2answers
4k views

Get custom attribute dropdown/multiselect options label and value in Magento 2

I created customer custom attribute with input multiselect like this: $code = 'multiselect_test'; $insertData = array( "type" => "text", "backend" => "", "label" ...
4
votes
3answers
4k views

Magento2 : Custom Category Attribute value Not Saving?

I've create a module to add a custom attribute to my categories, however my code doesn't seem to be creating the attribute in my eav_attribute table, the field shows on my category pages but it doesn'...
4
votes
0answers
71 views

Magento2.3.1 : Shipping address custom attribute value getting wrong format

Ref url - Shipping address custom attribute value not getting in RateRequest object in Carrier Model in magento2.x Above link in working perfect in magento2.2.x but not in magento2.3.1. I checked ...
4
votes
1answer
45 views

custom attribute

I have a custom attribute which is not displayed after the activating use flat directory category, moreover, I did not activate the visible_on_ front, but I still did not get any results.
4
votes
1answer
115 views

many-to-one product attribute

I need to add an attribute that allows multiple values - but not from a set of pre-selected values, not multiple select but multiple text fields. One product, one or more values in the one field. ...
3
votes
5answers
9k views

Set value to created customer custom attribute in magento 2

I have created custom attribute for customer using below code. setup/installData.php class InstallData implements InstallDataInterface { const LEGALITY_DOCUMENT_1 = 'user_legality_document_1'; ...
3
votes
4answers
21k views

Find the table for custom attribute values

I’ve installed magento edition version 1.9.2.0 and added a custom attribute catalog_special_name (text field) and i want to know which table stores the custom attribute values for each product.
3
votes
1answer
2k views

The configuration parameter “formElement” is a required for custom attribute product field

I just add custom attribute to my product like this: <?php namespace Namespace\Module\Setup; use Magento\Customer\Model\Customer; use Magento\Customer\Setup\CustomerSetup; use Magento\Eav\Setup\...
3
votes
2answers
6k views

How to get all children product from parent configurable product in magento2

I need to display some custom attribute from children product in checkout, I study for long time to come out a stupid solution Override Magento\Swatches\Block\Product\Renderer\Configurable Inject ...
3
votes
1answer
3k views

How to add extension attribute Magento 2

I'm trying to add an extension attribute to sales_order (\Magento\Sales\Api\Data\OrderInterface), and I have the following extension_attributes.xml: <config xmlns:xsi="http://www.w3.org/2001/...
3
votes
2answers
57 views

Magento 2: Create new customer attribute in module upgrade

I want to add new customer attribute 'business_type' which would be a selectbox. I want to do it in already created module, so I would need module update script. Can anyone help me on this as I am ...
3
votes
1answer
1k views

What model to use to query customer_entity_varchar table in Magento 2?

I have a custom varchar attribute stored on customers. I've been struggling to find the proper way to query for a specific attribute value without going straight to SQL joins. What is the right way to ...
3
votes
1answer
2k views

Quick Simple Product Creation: Add new Custom Attribute of MultiSelect each time When I Want to Add New Simple Product

I’ve got a moderately specific question. I’d like to add a new field to the Quick simple product creation section, in associated products, when creating configurable products. Here’s why (so if there ...
3
votes
1answer
1k views

Custom Customer Attribute not Saving Magento 2

I have used the following script to add a custom customer attribute. <?php namespace Harrigo\ContractPricing\Setup; use Magento\Customer\Setup\CustomerSetupFactory; use Magento\Customer\Model\...
3
votes
2answers
3k views

Magento 2, add Custom Text Attribute to the Products

I add a Custom TEXT Attribute (more_info) to my Magento 2 Store and I will show the Value to my product.info.main Page. I add mytheme\Magento_Catalog\layout\catalog_product_view.xml <...
3
votes
1answer
1k views

Magento 2.1: Add custom category attribute to topmenu classes

I have created a custom category attribute and it saves correctly in the database. I am now trying to add this attribute's value to the topmenu. So I have created Topmenu.php in my module (...
3
votes
1answer
5k views

Update Custom Attribute Value Programatically

I have created a script that tests importing products programmatically into Magento. Unfortunately, I'm having trouble updating a product's custom attribute value - in this case "manufacturer." When I ...
3
votes
1answer
77 views

Save customer custom address attribute programmatically

I have created new address attribute hide_address with yes no value. Using setup script: if(version_compare($context->getVersion(), '1.0.2', '<')) { $objectManager = \Magento\...