简体   繁体   English

列出所有产品,并将每个类别网格与opencart中的类别框链接

[英]list all products and link each category grid with category box in opencart

I want to load all categories grids on one page and want all products to be available on scroll down. 我想在一页上加载所有类别网格,并希望所有产品在向下滚动时都可用。 currently I need to click on each category and the page refreshes for each category. 当前,我需要单击每个类别,并且每个类别的页面都会刷新。 This is the site I am working on(ahmad.esy.es). 这是我正在工作的网站(ahmad.esy.es)。 I want this type of functionality upon clicking the category( http://www.just-eat.co.uk/restaurants-hertsplaice-en11/menu#2254 ). 单击类别后,我想要这种类型的功能( http://www.just-eat.co.uk/restaurants-hertsplaice-en11/menu#2254 )。 kindly suggest me what changes should I make in view files (product.tpl, category.tpl) or controller files(product.php, category.php). 请建议我应该对视图文件(product.tpl,category.tpl)或控制器文件(product.php,category.php)进行哪些更改。 how can I load all the grids of categories in one page 如何在一页中加载所有类别的网格

I didn't look at the site you have posted above - if you cannot describe your issue by words or by submitting a code or image it should be improved. 我没有看过您上面发布的网站-如果您不能用文字或提交代码或图像来描述问题,则应加以改进。

From what I understand you just want an infinite scroll to display all the products you have in your eshop. 据我了解,您只需要一个无限的滚动条来显示您在eshop中拥有的所有产品。 It is not mentioned whether you want to preserve the default functionality (category tree with products attached to certain categories) or whether you want only this one listing - basically it does not matter - so I will describe in short how to add such new functionality. 没有提及您是否要保留默认功能(产品树附有某些类别的类别树),还是只需要一个清单(基本上没有关系),因此我将简要说明如何添加这种新功能。

  1. The model 该模型
    • you do not need to touch any model - you can reuse the method ModelCatalogProduct::getProducts() 您不需要接触任何模型-您可以重用ModelCatalogProduct::getProducts()
    • this will give you the possibility to sort or filter the products except you will have to omit the filter_category_id to load all the products 这将使您可以对产品进行排序或过滤,但您必须省略filter_category_id才能加载所有产品
  2. The controller 控制器
    • feel free to create a new controller (eg ControllerProductInfinite ) or just to reuse one of the already existing - either ControllerProductCategory or ControllerProductProduct 随时创建一个新的控制器(例如ControllerProductInfinite )或仅重用已经存在的ControllerProductCategoryControllerProductProduct
    • all you need is basically the same as in ControllerProductCategory::index() except adding filter_category_id into a array passed when calling ModelCatalogProduct::getProducts() and a new template for rendering 除了将filter_category_id添加到调用ModelCatalogProduct::getProducts()和新的呈现模板时所传递的数组中,您所需要的基本上与ControllerProductCategory::index()相同
  3. The template 模板
    • create a new template that will meet your expectations and infinite scroll requirements 创建一个可以满足您的期望和无限滚动要求的新模板
    • stick to any infinite scroll plugin/implementation you like (may Google be with you) 坚持使用您喜欢的任何无限滚动插件/实现(Google可能会与您同在)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM