我有一个名为manufacturer
的属性,其中包含我的产品品牌。类似:Apple Co
并且我的品牌图像存储在:CCD_ 3中。名称类似:apple_co
现在我想在产品页面上展示我的品牌形象。我希望主题是可点击的,并引导我到一个页面上所有这些品牌的产品。
我把底部代码放入:template/catalog/product/view.phtml
<?php $_product = $this->getProduct();
$manufacturerName = $_product->getAttributeText('manufacturer');
$manufacturerId = $_product->getManufacturer();
echo '<a href="/catalogsearch/advanced/result/?manufacturer[]='.$manufacturerId.'">' ?>
<img src="../media/wysiwyg/queldorei/shopper/brands/<?php echo str_replace(' ', '_',$manufacturerName); ?>.png" alt="<?php echo $manufacturerName; ?>" /></a>
它在产品页面上显示了品牌,但当我点击它时,我会遇到这个错误:
The requested URL /catalogsearch/advanced/result/ was not found on this server.
具有品牌而非制造商的属性,应该有效。
<?php if($_product->getBrand()):
$brandName = $_product->getAttributeText('brand');
$brandImg = strtolower(str_replace("&","",$_product->getAttributeText('brand')));
$brandImg = str_replace(" ","-",$brandImg);
$brandImg = str_replace("--","-",$brandImg);
?>
<a href="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'brands/?brand=' . urlencode($brandName) ?>">
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'image/route/' . $brandImg . '.jpg' ?>" alt="View more" title="View more">
</a>
<?php endif; ?>