在Magento类别列表页面中获取多选属性选项

在Magento类别列表页面中获取多选属性选项,magento,multi-select,Magento,Multi Select,我有以下代码: <?php $multiSelectArray = $this->getProduct()->getAttributeText('color'); $lastItem = end($multiSelectArray); foreach($multiSelectArray as $multiSelectItem){ echo $multiSelectItem; if($multiSelectItem != $lastItem) ech

我有以下代码:

<?php
  $multiSelectArray = $this->getProduct()->getAttributeText('color');
  $lastItem = end($multiSelectArray);

  foreach($multiSelectArray as $multiSelectItem){
    echo $multiSelectItem;
    if($multiSelectItem != $lastItem) echo ", ";
  }
?>

要获取多个属性选项,请在“类别列表”页面中选择属性选项

我的问题是,如果multi-select中只有一个选项,则它不会显示属性


救命啊

问题解决了,因为只有一个选项是字符串,我已经测试过,如果(是字符串)。。。。。。。。显示第一个选项;)

可能与此相关,我遇到了类似的问题,最终修改了显示多选项值的渲染器。另一方面,为什么不使用内爆()?