How to add custom attributes to a specific category in Magento - magento

I need to add some custom attributes to a category in Magento. I only want to use for a special category, not all.
Thanks

Do you mean that you want products in category A have a set of attributes while products in category B have another set of attributes?
If so, you should create a new attribute set in Catalog->Attributes->Manage Attribute Sets, and add all attributes you need for the specific category. And when you create products for this category, just choose the new attribute set.
Well if it is not what you mean, please give more detailed explanation.
Hope it helps

Related

How we can add attributes for old product in Magento?

I have Magento portal and I want to filter option through the attributes. So is there any possibility to add the attributes for old product which already in portal?
Yes, sure can add attributes for existing attributes.
go to catalog > Manage attributes > create new attribute and than go for Attribute set and drag the new attribute to attribute set.
than you can give attribute values for each products manually or for all products once using "update attributes" option.
than you can display the attributes under layered navigation.
feel free to ask any doubts
For the older product I have added the attributes and include in the default attribute set. So it will be by default add for all the products only you have to select for each product.
Please find the relevant image:

In magento admin how to create a custom field in add products page

In my Magento admin add products page, I need to create a custom input field as subtitle for the product name. While adding products in Magento, we already have fields such as Name, Description, Short Description and so on. Among this I need to create a new field as Title to get the simple name of products. How do I create this custom field in admin?
You have to create custom attribute for that .Follow this tutorial it may help you to create custom attribute. please have a look at a
http://www.magentocommerce.com/knowledge-base/entry/how-do-attributes-work-in-magento
and
http://www.magentocommerce.com/knowledge-base/entry/tutorial-creating-attributes-custom-fields
Find manage attributes, then add a new attribute. You can select its type. And then you can add this attribute to your attribute set. The attribute set which you are using, it may be default or any custom created. After adding you will find that attribute in your add Product page.

Magento List Products based by attribute in CMS page, how to?

how can I list only porducts with some attribute on CMS page?
For example I want to list only all the products across the categories with attribute color=red
How can I achive this?
So far I was able to achive listing products with Special prices based on this
http://phpmysqltalk.com/937-magento-how-to-create-a-special-price-page-with-new-products-first.html
HoweverI am unable to modify it to any other attribute. Any help, how can I achieve displaying only products which have specific value of some attribute /from the Root category for the store or also from specific categories/
Thanks a lot.
check out this tutorial for creating a simple custom module which should do exactly what you need:
https://www.atwix.com/magento/products-list-cms/

Display products against attributes in magento

I am working on custom module in magento.
I create two new attributes (combo box) make and location. After that I add values for these attributes using custom code against specific product. Like I add make "Sony" and location is "Australia" against product 1 (1 is id for product).
Now on admin side i want to display this product with attributes values like make is Sony and location is Australia and product is 1.
I found some tables where these values are linked like (catalog_product_entity_int,eav_attribute,eav_attribute_option,eav_attribute_option_value), but I am unable to query such records. The page where I want to display data I have attribute id and attribute code.
Can anyone knows how I can figure it out?
Very simple Dude.
inside your _prepareCollection() method of your custom module grid
Load the product collection and select these two attribute... If there is a need to filter it by these two attributes then do it.

magento - product model and product_collection items have different properties in flat catalog mode

i just know that if i have a product_collection (for example the collection generated in catalog pages)
//event catalog_product_collecion_after_load
$productCollection = $observer->getEvent()->getCollection();
if i take an item from this collection and i compare it with the relative model
$_product = Mage::getModel('catalog/product')->load($item->getEntityId());
this 2 instace of the same entity have different properties!
I'm working in flat catalog mode.
Why the collection's items are not the same of product models?
I would to know if this is the right behaviour and if is it how to have same properties in both object!
sorry, but magento is very dark :(
Because Mage::getModel('catalog/product')->load($item->getEntityId()); loads all attributes for the product and the collection loads only specified attributes different from situation. You may find (CTRL+F) at app/code/core/Mage/Catalog/etc/config.xml something like attributes then you will see the list of all default loaded attributes for product collection. Also you able to change them in your module or directly in Catalog config.xml. But it's not the best idea to change something at app/code/core/Mage/Catalog/etc/config.xml except for debug
For the catalog_product_collection with flat_mode is more complicated add an attribute to the item's collection.
The attributes that are in product items are the join between catalog_product_flat table and the EAV attribute for product entity.
So, in product model from:
collection we have the attributes joined between catalog_product_flat table and the EAV attribute
getModel('catalog/product') we have all EAV attributes
Over these attributes we will certainly have other attributes, i think added in other point.
Now, which attributes are in catalog_product_flat?
Simple are the attributes you checked as "Used in Product Listing" in magento manage attributes! :)
But in some attributes you can't change this option, depends by kind of type you have select. Atribute type Image hasn't "Used in Product Listing" flag, so you have to modify catalog_eav_attribute if you want the new image in product listing.
Well, i spent 2 days to know this, i hope it will useful for other unlucky magento developer. :)
Magento version 1.5

Resources