This question already has an answer here:

this is my query now i want to get brand from this collection

$products = Mage::getModel('catalog/product')
                ->addFieldToFilter('attribute_set_id', $attributeSetId);

marked as duplicate by Rakesh Jesadiya, Jaimin Sutariya, Siarhey Uchukhlebau, Keyul Shah, brentwpeterson Apr 12 '17 at 12:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @Sheenu Your answer is for Magento 2, but question is about Magento 1.9 – Siarhey Uchukhlebau Apr 12 '17 at 11:05

If you want to get collection by brand then use following code.

$products = Mage::getModel('catalog/product')
                    ->addAttributeToFilter('brand', $attributeSetId);

Make ajax call

var reloadurl = '". $this->getUrl('adminhtml/test/test') . "ref/' + selectElement.value;
new Ajax.Request(reloadurl, {
                method: 'get',
                onLoading: function (stateform) {
                onComplete: function(stateform) {
  • $selectField = $fieldset->addField('attribute_set_id', 'select', array( 'label' => Mage::helper('warranty')->__('Select Type'), 'title' => Mage::helper('warranty')->__('Select Type'), 'name' => 'warranty[attribute_set_id]', 'required' => true, 'options' => $attributeSets, 'onchange' => 'onchangeStyleShow()', )); i create this button and i want to pass the value of this button onchange in php function which is also here in this file how i can do this – safra Apr 12 '17 at 5:34
  • 'onchange' => 'onchangeStyleShow(this.value)' this will pass value to function. or use prototype $('//youridhere).getValue() – Qaisar Satti Apr 12 '17 at 5:38
  • how pass in php – safra Apr 12 '17 at 5:56
  • hpw pass in php funciton – safra Apr 12 '17 at 5:57
  • @safra can you give me complete information what are you trying to do? – Qaisar Satti Apr 12 '17 at 5:58

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