答案 0 :(得分:0)
这是我用于属性为下拉式属性的客户端的代码的快速剪切/粘贴。
您的属性代码必须是“平台”才能生效。
<?
$product = Mage::getModel('catalog/product');
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'platform');
$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
$_platforms = $attribute->getSource()->getAllOptions(false);
?>
<select onchange="location.href='<?php echo $this->getUrl('catalogsearch/advanced/result') . '?platform[]='; ?>'+this.value;">
<option selected><?php echo $this->__('Search by platform') ?></option>
<?php foreach($_platforms as $_platform) : ?>
<option value="<?php echo $_platform['value']; ?>"><?php echo $_platform['label']; ?></option>
<?php endforeach; ?>
</select>