我需要放置相互连接的下拉菜单,例如卡车品牌、卡车型号、型号年份。
因此,品牌将会有一个下拉列表。其中包含卡车品牌的所有属性选项。选择品牌后,将出现另一个下拉列表,其中包含卡车型号的属性选项,但针对该特定品牌进行了筛选。选择型号后,将出现年份下拉列表,其中包含该品牌和型号的筛选年份。我是 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。
最佳答案
嗨,伙计,您可以根据您的要求使用以下代码。
$tableName = Mage::getSingleton('core/resource')->getTableName('bharat_sliders/categories'); $slides->getSelect() ->join(数组(‘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/
关于jquery - 基于 Magento Ajax 的属性过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21694129/