Magento:如何在产品页面中获取制造商名称?

akt*_*akt 12 magento

我想在product/view.phtml中显示制造商名称.我已经使用了所有类似的功能

<?php echo $_product->getAttributeText('manufacturer');?>
<?php echo $this->htmlEscape($_product->getData('manufacturer'));
<?php echo $_product->getData('manufacturer'); ?>
Run Code Online (Sandbox Code Playgroud)

但他们都没有帮助.所以如何在产品视图页面中获取制造商名称.

And*_*rew 23

如上所述,您需要执行以下几个步骤:

1)转到属性集,并确保将"manufacturer"分配给您正在使用的属性集.

2)确保已在属性选项中添加了一些制造商.

3)为产品指定其中一个选项.

根据您的magento版本,这应该工作:

<?php echo $_product->getAttributeText('manufacturer') ?>
Run Code Online (Sandbox Code Playgroud)

我可以看到你得到的错误:

gives error Call to a member function getManufacturer() on a non-object in 
Run Code Online (Sandbox Code Playgroud)

您确定要在此行之后放置此代码:

<?php $_product = $this->getProduct(); ?>
Run Code Online (Sandbox Code Playgroud)