Questions tagged [category-attribute]

Denotes questions related to attributes of categories.

Filter by
Sorted by
Tagged with
4
votes
6answers
6k views

create category programmatically if not exist - magento 2

I have one custom table, that table have a column name category which contains the events category like entertainment, national events. Now I need to create category from the table? note: create ...
5
votes
3answers
8k views

Magento 2 create category attribute thumbnail and upload image using File Uploader Component

I've created a custom module to display category thumbnail image. I've read magento dev doc It is displayed in my category section using category_form.xml <?xml version="1.0" encoding="UTF-8"?&...
11
votes
8answers
27k views

Magento 2 Get category id using category title

I would like get category id by only using category title by using this kind of function. ->load($categoryTitle, 'title') ->getId(); Use case: Get category id by title and put id data to array ...
11
votes
7answers
40k views

Magento2 - Get category URL by ID

I'm trying to get the URL key of any given category with the ID. I have this; $categoryId = 3; $_objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $object_manager = $_objectManager-...
4
votes
1answer
3k views

How do I change the default value of the “position” category attribute?

I would like to update the default position value that products are assigned when they are added to a category. When you update a category from the categories editor, new products are saved with a ...
2
votes
1answer
2k views

Magento 2.1: how to create category attrbute programmatically?

The custom extension in which I am working is working correctly till 2.0.7, but not in 2.1. So my question is, how to create category attribute programmatically? Below code was working in 2.0.7, but ...
1
vote
3answers
13k views

Magento 2 How to get custom category attribute on frontend

I have created a new category attribute using a setup script and now it is showing on the backend and assigned values (it is just a boolean attribute). the attribute name on EAV entity table is ...
3
votes
0answers
367 views

No Way to Clear/delete a Selected Image using Media Browser on category edit page

With reference to this Q&A there's another question. How do I clear the image selected using the Media Browser on category edit page in the admin Panel? Here's what I tried: in app/code/...
1
vote
1answer
973 views

Magento2: Category custom textarea with wysiwyg editor attribute value blank issue

I have created two custom category attribute with wysiwyg editor and my attributes also shows in categories. But my issue is if i'm adding content in one attribute using wysiwyg editor then another ...
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('...
1
vote
4answers
11k views

How add category programmatically magento 2 [duplicate]

How create a category programatically. With the attributes name, url key, image, path, parent id, is active, description. And How to insert data for a new attribute added by InstallDate a category. ...
1
vote
3answers
7k views

How to completely delete EAV attribute and all its data from the database?

What is the correct way to completely remove category attributes from the database? Attributes were added this way using setup script: $setup->addAttribute('catalog_category', 'seo_text', array( ...
7
votes
1answer
2k views

How to add serializable attribute to category?

I tried this $installer->addAttribute( 'catalog_category', 'ser_attr', array( 'input_renderer' => 'namespace_module/block', 'backend' => 'adminhtml/...
2
votes
1answer
2k views

Add color picker to category attribute

Does anyone know how to add a custom color picker attribute to categories? I've tried the following code in an upgrade-script, unhappily without success. $this->startSetup(); $this->...
1
vote
1answer
4k views

How to use “button” in UI component form - Magento 2?

I've written a custom module which adds a new tab to admin category edit page, using UI component form ([Vendor] \ [Module]\view\adminhtml\ui_component\category_form.xml). Everything works fine from ...
1
vote
3answers
3k views

Create Custom category Yes/No attribute magento2

Is it possible to create the custom attribute for a category called is_featuted category as 'Yes/No' attribute? I am looking for code how to create the custom attribute for category and get all the ...
0
votes
1answer
2k views

Magento2: Category Select Attribute Not Saving?

I've registered a custom select option to my categories using the files below in my module. The select option appears in the backend with my custom options however it doesn't save the selected option ...
0
votes
2answers
920 views

MAGENTO 2 How to Get Current page layout

How do I get current category "page_layout" value? e.g "1 column" or "2 column" and so on. The values from Layout screen shoot bellow.
2
votes
1answer
1k views

Issues with adding image attribute to category - Magento 2

I've added attribute to my category following this guide (https://belvg.com/blog/how-to-add-image-attribute-to-a-category-in-magento-2.html). Looks like I am on right way, but when I try to upload ...
2
votes
2answers
808 views

Magento 2 product attribute filter url rewrite?

I have override url-rewrite router in my custom module,and add my custom rewrite code in override router file. after filter url created like below : http://domainname.com/services.html?manufacturer=...
2
votes
2answers
1k views

Magento 2 : Add Search by Category in Advanced search

I tried the code of @Nitesh here Add search by category by Nitesh and I got this error: Notice: Undefined property: Magento\CatalogSearch\Model\Advanced::$_objectManager in /opt/lampp/htdocs/...
2
votes
1answer
340 views

How to validate custom category attribute

How to validate a new custom category attribute in Magento, so that no more than 300 words can be written in that new field? Is that possible? How could I achieve this? Thanks for your contributions.
2
votes
2answers
14k views

Magento 1.9: Remove Category Filter in Layered Nav

After a few minutes of search, I found the solution that I'm looking for, and it's here: How can I disable filter "category" from Sidebar I followed this method by editing the catalog.xml ...
1
vote
2answers
689 views

Magento 2: Custom category attribute is missing scope

In Magento 2.2.7 I have created a custom attribute (textarea, wysiwyg) for categories. This is my InstallData namespace MyVendor\Mods\Setup; use Magento\Framework\Setup\InstallDataInterface; use ...
1
vote
2answers
2k views

Custom category attribute

It seem's that after upgrading to the latest mage 2 build, the category admin layout has changed slightly (unless i'm missing something) and I'm unable to see my custom category attributes....
0
votes
2answers
116 views

Magento 2 showing category in homepage with products using enable/disable attributes

How to get the all custom category on homepage with products. I want to create these types, Please check screens-short:- https://prnt.sc/r5b2q5 Showing this category:- Above category showing this ...
0
votes
1answer
162 views

Adding Category option : cannot read get

I'm trying to add a category option and by doing so appearently broke some things. This is my code : namespace/module/Setup/InstallData.php <?php use Magento\Framework\Setup\...