10

I need to place dropdowns which will be connected to each other e.g Truck Brand, Truck Model, Model Years.

So There will be one drop down for Brand. which contains all the attribute options of Truck Brands. Once Selected Brand, another dropdown will appear which contains the attribute options of Truck Model but filtered for that specific brand. Once Model is selected, the years dropdown will apear containing the filtered years for that brand and model. I am new to Magento, and I can get attributes and its options through php using

  $attributeId = Mage::getResourceModel('eav/entity_attribute')
 ->getIdByCode('catalog_product','attribute_code_here');
  $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
  $attributeOptions = $attribute ->getSource()->getAllOptions();

But I dont get filtered Attribute Options fitlered on first attribute. and speaicly using ajax.

Asif
  • 258
  • 1
  • 6
  • 19
  • 1
    do you required "dependent attributes magento"..?? or just next option should appear after selecting one option..?? – Pankaj Feb 17 '14 at 09:59
  • well attributes are not dependent. but I need filtered attributes. e.g there are 10 options of one attribute, and 10 for next attribute. But after selecting 1st attribute, the second attrutes limits to 10 due to fitlered products based on first attribute. – Asif Feb 18 '14 at 11:27
  • from dependent attribute.. I meant value of second attribute in filters will depend on what is selected on first attribute.. – Pankaj Feb 18 '14 at 12:11
  • so you have 3 seprate table for brand,model& year respectively. right – Shivam Feb 21 '14 at 11:53

1 Answers1

1

Hi buddy you can use below code as per your requirement.

$tableName = Mage::getSingleton(‘core/resource’)->getTableName(‘bharat_sliders/categories’); $slides->getSelect() ->join( array(‘sc’=>$tableName), ‘main_table.slider_id = sc.slider_id’, array(‘sc.*’)) ->where(‘sc.category_id = ?’, $this->getCategoryId()); return $slides;

or also try

http://bmagento.wordpress.com/2014/04/13/join-two-table/
http://bmagento.wordpress.com/2014/04/08/join-two-table-in-magento/

Bharat M.
  • 334
  • 2
  • 12