2013-06-01 29 views
0

我希望在单独的页面上显示所有带分页的产品。该页面应该在主菜单中有一个“产品”的自定义链接。我不想显示opencart的内置菜单。我想要我自己的链接,如家,产品,特别优惠,关于我们。我一直在四处搜寻,但仍未找到合理的解决方案。我对opencart很陌生。谢谢如何使用opencart中的自定义链接显示所有产品

+0

所有产品和categoryes你已经尝试了什么?向我们展示代码。我们会帮你 –

+0

感谢您的及时回复。其实我不知道该怎么办。无论是添加一个自定义页面,还是只是玩弄现有的页面。 –

+0

我过去两天一直在使用Google搜索。没有有用的发现。给我简单介绍一下我如何做到这一点。 –

回答

1

有几种方法可以做到这一点,最简单的方法是创建一个所有产品所属的主要类别'产品'。获取的“产品”类别中的ID和使用在通用/头CONTROLER生成链接

例如产品类别编号为100

$this->data['all'] = $this->url->link('product/category'.'&category_id=100'); 

然后回响在游览头鉴于此链接

+0

谢谢,我已经知道这个解决方案,但我不想使用这种技术。因为使用这种技术,所有的侧边栏将显示它们中的嵌套类别。有更好的解决方案 –

+1

在您的模型中:目录/类别创建自定义函数以从所有类别获取所有产品,然后创建自定义控制器产品/所有类型将与pproduct/category控制器非常相似,但将使用您的类别模型中的自定义函数获取所有产品节省时间,您可以使用与产品/类别相同的视图。 – Mieszko

7

文件:目录/控制器/产品/ category.php

1)更换

if ($category_info) { 

if (($category_info) OR ($category_id==0)) { 

2),然后装

$this->document->setTitle($category_info['name']); 
$this->document->setDescription($category_info['meta_description']); 
$this->document->setKeywords($category_info['meta_keyword']); 
$this->data['heading_title'] = $category_info['name']; 

if ($category_id==0) { 
    $this->document->setTitle('all products'); 
    $this->document->setDescription('all products'); 
    $this->document->setKeywords('all products'); 
    $this->data['heading_title'] ='all products'; 
    $category_info['description']=''; 
    $category_info['image']=''; 
} else { 
    $this->document->setTitle($category_info['name']); 
    $this->document->setDescription($category_info['meta_description']); 
    $this->document->setKeywords($category_info['meta_keyword']); 
    $this->data['heading_title'] = $category_info['name'];` 
} 

您可以查看链接http://opencart.example.com/index.php?route=product/category&path=0

+0

优秀的解决方案,因为它为我工作 – 2014-05-11 11:37:43

相关问题