Magento Adding classification properties

Source: Internet
Author: User

Adding custom attributes to a product in Magento is easy to implement in the background and can be easily added, but not for categorization, Magento itself is not provided to the category to add custom attributes. In the actual use of the process we want to add attributes to cagegory we have to find a way. Tell me how I added it here.

Idea: By creating a product attribute, change this property to the Cagegory property by using the database

Operation: 1. Create a Product properties website backstage->catalog->attribute->manage Attribute here to create the properties you want.

2. Through Sql:select attribute_id from ' Eav_attribute ' where attribute_code= ' cus_category_description ' here Attribute_code This value is the property you just created, code gets attribute_id.

3. Through Sql:select entity_type_id from ' Eav_entity_type ' where entity_type_code= ' catalog_category '; Find entity_type_id.

3. Through sql:update ' Eav_attribute ' Set entity_type_id= (3rd step obtained entity_type_id) where attribute_id= (2nd step obtained attribute_id). This has already changed the first step of the new product property to the attribute of the classification, this step is done after the background you still do not see the property you just added, but also need a step is to eav_entity_attribute this table to add a record.

4. Through sql:insert into ' eav_entity_attribute ' (entity_type_id,attribute_set_id,attribute_group_id,attribute_id,sort_ Order) VALUES (3rd entity_type_id,attribute_set_id (refer to step 5th), attribute_group_id (see step 5th), attribute_id (2nd step), Sort_ Order (write a value in the order in which you want to display it)).

5. How to get attribute_set_id and attribute_group_id: to the site management of the background of the page by Firefox or Google browser to view the function of the element can be found to fill in the classification keyword that attribute code value such as Name= "general[ Meta_keywords], this meta_keywords value is the attribute code of the categorical keyword. Through the 2nd step, you can find meta_keywords this code attribute_id. By this attribute_id in the table Eav_entity_attribute can be found in the corresponding attribute_set_id and attribute_group_id.

6. Refresh the site cache OK on the Category Management page you can see the property you just added.

7. Get categorical Custom attributes:

<?php
$cat _attr = $_category->getattributes ();
if (array_key_exists (' cus_category_id ', $cat _attr)):
$_shortdescription= $cat _attr[' cus_category_id ']->getfrontend ()->getvalue ($_category);
Echo $_shortdescription;
endif
?>

Magento Adding classification properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.