Prestashop - 特色产品标签
答
我建议你拿起一个模块,在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');
}
哪个版本的prestashop? – sarcom
你的问题很困惑,你能更好地解释你想要什么?因为你说'展示',但是在你说'手动添加很多产品'之后,这两件事情是不同的:) – sarcom
@sarcom这是1.6.0.9版本。当您转到“产品编辑”和“关联”时,您会看到它下面的“默认类别”和“附件”。我想在每个产品页面中填写“附件”,但不是手动填写。我想通过产品标签或标题来填充汽车。你明白吗? – ZAM666