Prestashop - 特色产品标签

问题描述:

如何让Prestashop通过标签或标题展示特色产品? 我不想手动添加很多产品,我想通过标签或标题来制作。Prestashop - 特色产品标签

+0

哪个版本的prestashop? – sarcom

+0

你的问题很困惑,你能更好地解释你想要什么?因为你说'展示',但是在你说'手动添加很多产品'之后,这两件事情是不同的:) – sarcom

+0

@sarcom这是1.6.0.9版本。当您转到“产品编辑”和“关联”时,您会看到它下面的“默认类别”和“附件”。我想在每个产品页面中填写“附件”,但不是手动填写。我想通过产品标签或标题来填充汽车。你明白吗? – ZAM666

我建议你拿起一个模块,在PrestaShop的官方插件市场上搜索Related Products by Product’s Tags

要获得具有特定标签的产品,您可以使用Search类,例如在你的模块中你有钩子displayFooterProduct

public function hookDisplayFooterProduct($params){ 
    $tags = $this->context->controller->product->tags; 
    $id_lang = $this->context->language->id; 
    if(is_array($tags) AND count($tags)>1){ 
     foreach($tags as $tag) 
      $products_related = array_merge($products_related, Search::searchTag($id_lang, $tag); 
     // I guess here you have to check duplicates and also remove the product that you're viewing 
    } else { 
     $products_related = Search::searchTag($this->context->language->id, $tags[0]) 
    } 
    // After you have to display results, with a tpl 
    $this->smarty->assign(array(
     'products_related' => $products_related 
    )); 
    return $this->display(__FILE__, 'views/templates/hook/footerproduct.tpl'); 
} 
+0

有没有像编辑一些文件没有钱选项? – ZAM666

+0

@ ZAM666我认为35美元(43加币)包含更多价值1天或2天(在最好的情况下)花费在编辑更多的“一些”文件或组成模块:),因为是正确的方式,使模块:)。如果你愿意,我可以写一段代码来检索产品的标签,但所有的模块结构,这是你的责任:) – sarcom

+0

@ ZAM666更多的,我不能做。按照[文档](http://doc.prestashop.com/display/PS16/Creating+a+PrestaShop+Module)!做一个新的模块;)。干杯;) – sarcom