0

I'm new to magento, Can any one told me Where "celebrity" & "base_color" values stored in DB ?

1-

$collection = Mage::getModel('catalog/product')->getCollection()
                        ->addAttributeToSort('created_at', 'DESC')
                        ->addAttributeToSelect('*')
                        ->addAttributeToFilter('visibility', 4)
                        ->addAttributeToFilter('celebrity', array('neq' => 'no_selection'))

2- URL Parameters .../?filter=Black&code=base_color

$collection= Mage::getModel('catalog/product')->getCollection()
                           ->addAttributeToSelect('*')
                           ->addFieldToFilter($_GET['code'],array('eq' => Mage::getResourceModel('catalog/product')
                           ->getAttribute($_GET['code'])
                           ->getSource()
                           ->getOptionId($_GET['filter']))); 
                        ->load();
1

1 Answer 1

2

I think there are some things you still have yet to learn about Magento.

One of those is how EAV works. Magento's EAV system stores values for attributes (like in your case, "Celebrity" and "base_color") in multiple tables depending on the type of data being stored.

However, all of these values are in tables with a prefix of: catalog_product_entity

in our prefix + _int integer values are stored. in our prefix + _varchar varchar values are stored.

It can get pretty complicated so I would just look at it and check it out as well as do some more research.

You can see all of the available attributes listed in the table: eav_attribute

As for your second question:

To get the parameters from a url you need to be working in a controller and then run this code:

$this->getRequest()->getParam('my_param')

Not the answer you're looking for? Browse other questions tagged or ask your own question.