简体   繁体   English

重用Magento产品列表块-自定义集合

[英]Reuse Magento product list block - custom collection

I want to use the default magento product list block and template but use it with my own custom product collection. 我想使用默认的magento产品列表块和模板,但将其与我自己的自定义产品集合一起使用。

The collection is not part of a category, but a collection that is being created by my own module. 该集合不是类别的一部分,而是由我自己的模块创建的集合。

how do i tie the two up? 我如何将两者捆绑在一起?

You need to create your own block class, inheriting from Mage_Catalog_Block_Product_List , and to override at least its _getProductCollection() method, to make it load your collection. 您需要创建自己的块类(继承自Mage_Catalog_Block_Product_List ,并至少覆盖其_getProductCollection()方法,以使其加载您的集合。

And regarding the template, you can assign the default one to your block in your layout definition. 对于模板,您可以在布局定义中为模块分配默认模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Magento,定制产品清单 - Magento, custom product list Magento 2:如何在状态可见 => 是的自定义模块块文件中获取产品属性集合? - Magento 2 : How to get product attributes collection in custom module block file whose status is visible =>yes? Magento产品列表,带有自定义productCollection - Magento product list with custom productCollection Magento扩展:在产品视图中添加自定义模块 - Magento Extensions: Adding a custom block to the product view Magento 2 - 过滤集合,用于多选定制产品属性 - Magento 2 - Filter collection for a multiselect custom product attribute Magento产品集合分页与自定义排序 - Magento product collection pagination with custom sort 添加自定义属性以过滤magento产品集合中的内容 - Add custom attribute to filter in product collection in magento Magento 2-在列表视图中获取产品详细信息,使用插件添加自定义模块 - Magento 2 - Get product details in list view adding custom block using plugin Magento模块自定义模块在产品详细信息页面中有效,但在列表和网格页面中无效? - Magento module custom block working in product details page but not working in list and grid page? Magento在产品详细信息页面上的自定义模块块中获取产品ID - Magento get product ID in custom module block on product detail page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM