2016-08-23 106 views
0

如何讓Prestashop通過標籤或標題展示特色產品? 我不想手動添加很多產品,我想通過標籤或標題來製作。Prestashop - 特色產品標籤

+0

哪個版本的prestashop? – sarcom

+0

你的問題很困惑,你能更好地解釋你想要什麼?因爲你說'展示',但是在你說'手動添加很多產品'之後,這兩件事情是不同的:) – sarcom

+0

@sarcom這是1.6.0.9版本。當您轉到「產品編輯」和「關聯」時,您會看到它下面的「默認類別」和「附件」。我想在每個產品頁面中填寫「附件」,但不是手動填寫。我想通過產品標籤或標題來填充汽車。你明白嗎? – ZAM666

回答

0

我建議你拿起一個模塊,在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