나는 오늘 아침 문제점과 같은 이상한 것은 내가의 드롭 다운 메뉴와 다른 다중 선택 메뉴를 표시하는 속성이 같은 특성 (드롭 다운)하지만 하나 있다고했다 고급 검색.
다른 설정으로 테스트를했는데 고급 검색에서 목록 (드롭 다운 및 다중 선택) 인 모든 속성이 2 개 이상의 옵션이 다중 선택으로 표시된다는 사실이 밝혀졌습니다.
나는 /app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php에 저장된 Mage_CatalogSearch_Block_Advanced_Form을보고이 조건 2가 확인 된 곳을 보았습니다. magento 핵심 팀은 '예'또는 부울 목록이 드롭 다운으로 표시되도록하기 위해 이렇게 만들었습니다. 당신이 5 번과 마지막 줄에 두 번째를 변경하는 경우,
public function getAttributeSelectElement($attribute)
{
$extra = '';
$options = $attribute->getSource()->getAllOptions(false);
$name = $attribute->getAttributeCode();
// 2 - avoid yes/no selects to be multiselects
if (is_array($options) && count($options)>2) {
. . .
:
위에서 언급 한 파일에서
는 (마 젠토의 현재 버전에) 라인 173에서 시작하면 다음과 같은 코드 고급 검색은 옵션이 6 개 미만인 모든 속성에 드롭 다운 메뉴를 표시합니다. 나 자신은 내가 다음과 같습니다 새로운 방법, getAttributeDropDownElement(), 울부 짖는 소리 getAttributeSelectElement()를 추가를 위해 무슨 짓을
는 :
public function getAttributeDropDownElement($attribute)
{
$extra = '';
$options = $attribute->getSource()->getAllOptions(false);
$name = $attribute->getAttributeCode();
// The condition check bellow is what will make sure that every
// attribute will be displayed as dropdown
if (is_array($options)) {
array_unshift($options, array('value'=>'', 'label'=>Mage::helper('catalogsearch')->__('All')));
}
return $this->_getSelectBlock()
->setName($name)
->setId($attribute->getAttributeCode())
->setTitle($this->getAttributeLabel($attribute))
->setExtraParams($extra)
->setValue($this->getAttributeValue($attribute))
->setOptions($options)
->setClass('multiselect')
->getHtml();
}
당신이해야 할 다음 일은 작은 경우, 내 문 속성의 이름을 검사하고 getAttributeSelectElement() 또는 새 메소드 getAttributeDropDownElement()를 호출하는 양식의 스위치 (아래 참조)를 사용하십시오. 나는이 일을 너에게 맡긴다 :
case 'select': ?>
<div class="input-box"> <?php echo $this->getAttributeSelectElement($_attribute) ?> </div>
<?php endswitch; ?>
희망이 있었다.
P. 제 모국어가 아닌 나쁜 영어를 사과하십시오!
으로
를 대체? –
template/catalogsearch/advanced/form.phtml – Jason