2016-08-23 6 views
0

Prestashopをタグまたはタイトルで注目商品を表示するにはどうすればいいですか? 多くの製品を手動で追加したくないので、タグやタイトルで作成したいと思います。Prestashop - タグによる注目商品

+0

どのprestashopのバージョンですか? – sarcom

+0

あなたの質問は混乱しています。あなたは何をしたいのですか?あなたは「表示する」と言っているが、「たくさんの製品を手動で追加する」と言うと、この2つのことは異なる。 – sarcom

+0

@sarcomこれはバージョン1.6.0.9です。 「Product edit」と「Associations」に行くと、その下に「Default category」と「Accessories」が表示されます。私はすべての製品ページに「アクセサリー」を記入したいが、手動ではしない。私はそれが製品のタグやタイトルで自動充填したい。わかりますか? – ZAM666

答えて

0

モジュールを手に取ることをお勧めします。Related Products by Product’s TagsをPrestaShopの公式アドオン市場で検索してください。

特定のタグを持つ商品を取得するには、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それ以上のことはできません。 [documentation](http://doc.prestashop.com/display/PS16/Creating+a+PrestaShop+Module)に従ってください!新しいモジュールを作る;)。乾杯;) – sarcom

関連する問題