首页 > 其他分享 >magento 高级搜索 brand实例 Magento ‘Shop By Brand’ in SideBar

magento 高级搜索 brand实例 Magento ‘Shop By Brand’ in SideBar

时间:2023-04-03 23:35:26浏览次数:38  
标签:Shop product code attribute brand getResource phtml Magento productbrand


高级搜索地址一般为: /catalogsearch/advanced/

 

First create the template file and name it productbrand.phtml place it in catalog/product folder

copy the code given below and paster it in you productbrand.phtml

 

Note: Please chnage ‘yourdomain.com’ with your site domain name

<h4><span>Product Brands</span></h4>
	<div style="padding-left:8px;">
		<?php
		$product = Mage::getModel('catalog/product');
		$attributes = Mage::getResourceModel('eav/entity_attribute_collection')->setEntityTypeFilter($product->getResource()->getTypeId())->addFieldToFilter('attribute_code', 'manufacturer');
		$attribute = $attributes->getFirstItem()->setEntity($product->getResource());
		$manufacturers = $attribute->getSource()->getAllOptions(false);
		?>
		<ul id="manufacturer_list">
			<?php foreach ($manufacturers as $manufacturer): ?>
			<li><a href="http://www.yourdomain.com/catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li>
			<?php endforeach; ?>   
		</ul>
	</div>

 

标签:Shop,product,code,attribute,brand,getResource,phtml,Magento,productbrand
From: https://blog.51cto.com/u_8895844/6167718

相关文章

  • magento 问题解答 FQA
    1.IsthereawaybymysqltosetALLproductvisibilitytocatalog,search? 批量修改产品可见 openuptheeav_attributetableandfindtherowwhereattribute_code=visibility.Takenoteoftheattribute_id,mostlikelyitwillbe85.Alsotakenotetha......
  • 深入理解Magento – 第七章 – 自定义Magento系统配置
    深入理解Magento作者:AlanStorm翻译:HailongZhang第七章–自定义Magento系统配置Magento拥有十分强大的后台管理系统。作为一名开发人员,这套后台管理系统可以让你的用户简单直接的配置Magento系统或者你创建的模块。和Magento的其他功能一样,你第一次使用这套管理系统的时候可......
  • 虾皮shopee商品详情接口,虾皮商品详情接口代码教程
    业务场景:作为全球最大的B2C电子商务平台之一,shopee平台提供了丰富的商品资源,吸引了大量的全球买家和卖家。为了方便开发者接入拼多多平台,shopee平台提供了丰富的API接口,其中商品详情接口是非常重要的一部分。大家有探讨稳定采集shopee整站实时商品详情数据接口,通过该接口开......
  • 创业应用ShopLocket:随时随地卖任何东西
    一款新应用ShopLocket将为那些想卖东西又不想建实体店面的用户提供绝好机会。创始人KatherineHague自己也是该应用的用户,刚开始她想在博客或网站上卖T恤,但她不想不想建立一......
  • Magento getModel getSingleton等常用函数说明
    Mage::getModel在通常的PHP初始化类对象的时候,使用以下方式进行生成。$modelSales=newModelSales();但是在magento中初始化模型对象时候,使用以下的方式进行生成模......
  • Magento Helper简介
    正如许多其他的PHPMVC系统一样,Magento也有帮助类(HelperClasses)。这些类用来提供一些不适合放在模型,视图或者控制器中的功能。Magento的帮助类也是采用分组类名的机制。也......
  • magento block 程序中获取各种url及绝对路径的方法
    magentoblock程序中获取各种url的方法 Mage::getBaseUrl('media')//可获得media带http的url地址。//同理也可以获得skin和js目录的地址:Mage::g......
  • shopee商品列表接口,关键词搜索shopee商品数据接口代码教程
    业务场景:作为全球最大的B2C电子商务平台之一,Shopee平台提供了丰富的商品资源,吸引了大量的全球买家和卖家。为了方便开发者接入Shopee平台,Shopee平台提供了丰富的API......
  • Magento模块开发之数据库SQL操作方法说明
    今天主要来看Magento中的Mysql4/Resource(资源)如何对数据库进行操作,来执行更为复杂的sql语句。在Magento中Model通常都会继承Mage_Core_Model_Abstract,而这个Abst......
  • Download Magento Extension
    Entertheextensionkeyfrommagentoconnecttodownloadtheextensionarchivefileinlatestversion,withoutPEAR. A"readytopaste"versionisgenerated,j......