Magento - > I want the product grid in admin to be displayed in frontend
I want the grid in admin to be displayed in frontend. The grid that shows the list 开发者_开发知识库of products in admin-> catalog->manage products.
I want to show this on the frontend for each category?
What would be ideal approach to get this done?
Extending admin block classes in your module and copy widgets template files from adminhtml allowing adminhtml display in frontend, but you need to load required javascripts and CSS to allow grid works and you'd be pay attention to conflicts. Probably it's more easy to using a thirdy part ajax grid in frontend.
You need to rewrite blocks
Mage_Adminhtml_Block_Catalog_Product_Grid
Mage_Adminhtml_Block_Widget_Container
to your own, because in this classes we have logic for editing, adding products.
also you need to redefine
adminhtml/default/default/template/catalog/product.phtml
adminhtml/default/default/template/widget/grid.phtml
and add templates to the frontend scope with your customizations.
add to the frontend catalog.xml blocks declaration for catalog_category_default node it might be like this:
<catalog_category_default>
<reference name="content">
<block name="module_name/catalog_product_grid" template="module_name/catalog_product_grid.phtml" output="toHtml />
</reference>
</catalog_category_default>
I agree with emalstyle.
You can get the data from a collection, convert collection data to js object and implement a widget like:
https://plugins.jquery.com/tag/datagrid/
精彩评论