Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento Ajax Based Attributes Filters

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.

like image 424
Asif Avatar asked Feb 11 '14 05:02

Asif


1 Answers

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/

like image 153
Bharat M. Avatar answered Oct 15 '22 19:10

Bharat M.