Hallo Shopware Forum,
Ich habe erneut eine Frage.
Ich versuche gerade einen SELECT-Datensatz im Frontend anzeigen zu lassen.
Das wollte ich mit der DBAL Extension umsetzen, da diese laut der Shopware Dokumentation unterstützt und implementiert ist. [1]
Wenn ich jedoch die fetchColumn()-Methode der DBAL Documentation [2] entnehme kommt bei mir folgender Fehler:
Fatal error : Call to undefined method Enlight_Components_Db_Adapter_Pdo_Mysql::fetchColumn() in
Vielleicht liegt es auch nicht an der Syntax des Codes sondern an der Struktur meines Codes.
Ausschnitt aus meiner Bootstrap.php :
public function onPostDispatchDetail(\Enlight_Controller_ActionEventArgs $args)
{
$this->findSupplier();
/** @var \Enlight_Controller_Action $controller */
$controller = $args->get('subject');
$view = $controller->View();
$view->addTemplateDir(
__DIR__. '/Views'
);
$view->assign('supplier', $this->findSupplier());
}
public function findSupplier()
{
//Get the Supplier of the Article
$supplier_select = Shopware()->Db()->fetchColumn('SELECT supplierID FROM s_articles WHERE id = 2', array(1), 0);
return $supplier_select;
}
Ausschnitt aus der /detail/tabs/description.tpl :
{extends file="parent:frontend/detail/tabs/description.tpl"}
{block name="frontend_detail_description_links_list"}
{$supplier}
{/block}
Ich hoffe, dass mir hier jemand weiterhelfen kann.
Beste Grüße,
Max Konrad
[1] Best practices of Shopware plugin development
Edit: Dokumentationsverweis hinzugefügt