Php Magento编程:获取所有制造商的列表和相应的制造商ID

Php Magento编程:获取所有制造商的列表和相应的制造商ID,php,magento,Php,Magento,我需要一些编码方面的帮助。我需要一份所有制造商的名单,以及他们相应的magento ID。这可能吗?请帮忙。谢谢我尝试了一些MOD,但只得到一个或另一个。如果可能的话,请帮我做最后一件事。我先谢谢你 $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'manufacturer'); foreach ( $attribute->getSource()->getAllOptions

我需要一些编码方面的帮助。我需要一份所有制造商的名单,以及他们相应的magento ID。这可能吗?请帮忙。谢谢我尝试了一些MOD,但只得到一个或另一个。如果可能的话,请帮我做最后一件事。我先谢谢你

$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'manufacturer');

foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){
     $attributeArray[$option['value']] = $option['label'];
     }  

foreach($attributeArray as $key=>$val){
echo $val;

}

不确定具体需要什么格式,但以下示例应说明如何获取所需的值:

$attribute = Mage::getModel('eav/entity_attribute')
                ->loadByCode('catalog_product', 'manufacturer');

$valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
            ->setAttributeFilter($attribute->getData('attribute_id'))
            ->setStoreFilter(0, false);

$preparedManufacturers = array();            
foreach($valuesCollection as $value) {
    $preparedManufacturers[$value->getOptionId()] = $value->getValue();
}   


if (count($preparedManufacturers)) {
    echo "<h2>Manufacturers</h2><ul>";
    foreach($preparedManufacturers as $optionId => $value) {
        echo "<li>" . $value . " - (" . $optionId . ")</li>";
    }
    echo "</ul>";
}
$attribute=Mage::getModel('eav/entity\u attribute')
->loadByCode(“目录产品”、“制造商”);
$valuescolection=Mage::getResourceModel('eav/实体\属性\选项\集合')
->setAttributeFilter($attribute->getData('attribute_id'))
->设置存储过滤器(0,假);
$preparedManufacturers=array();
foreach($valuesCollection作为$value){
$preparedManufacturers[$value->getOptionId()]=$value->getValue();
}   
if(计数($preparedManufacturers)){
echo“制造商
    ”; foreach($optionId=>$value的预制制造商){ 回显“
  • ”$value。”-(“$optionId”)
  • ”; } 回声“
”; }
我认为这是另一个问题的延伸: