Reputation: 4357
I am having very hard time getting list of products to be displayed in the landing page using a plugin. The documentation found insufficient in this regard.
I got stuck here:
$controller = $args->get('subject');
$view = $controller->View();
$view->addTemplateDir(
__DIR__ . '/Views'
);
Upvotes: 0
Views: 1733
Reputation: 26
maybe this will help you in the approach to the issue
//get current article Id
$articleId = $view->sArticle['articleID'];
$query = $this->container->get('dbal_connection')->createQueryBuilder();
$query->select('s_articles.name')
->from('s_articles')
->where('s_articles.id = :id')
->setParameter('id', $articleId);
$single = $query->execute()->fetchColumn();
$view->assign('article_name', $single);
$view->assign('article_cat', '<a href="'.$view->sArticle['linkDetailsRewrited'].'">'.$view->sArticle['linkDetails'].'</a>' );
/**
* Add template to the directory plugin
*/
$view->addTemplateDir($this->container->getParameter('gwen_cinema.plugin_dir') . '/Resources/Views');
Upvotes: 1