基于Magento Ajax的属性过滤器

时间:2014-02-11 05:48:59

标签: jquery ajax magento zend-framework mage

我需要放下相互连接的下拉菜单,例如Truck Brand,Truck Model,Model Years。

所以Brand会有一个下拉菜单。其中包含Truck Brands的所有属性选项。选择品牌后,将显示另一个下拉列表,其中包含卡车模型的属性选项,但针对该特定品牌进行过滤。选择模型后,年份下拉列表将包含该品牌和型号的过滤年份。我是Magento的新手,我可以通过php使用

获取属性及其选项
  $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();

但我没有在第一个属性上获得过滤的属性选项。并且特意使用ajax。

1 个答案:

答案 0 :(得分:0)

您好伙计可以根据您的要求使用以下代码。

$ 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()); 返回$幻灯片;

或者也尝试

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