Hallo zusammen,
in meiner bootstrap.php möchte ich alle DB Artikel abfragen.
Dies habe ich wie folgt gelöst - soweit sogut.
Leider scheitere ich daran den SEO Link zur Detailseite jeden Artikels auszugeben.
Zudem bräuchte ich noch den Hersteller Name. Wie komme ich an diese Daten?
Komme hier leider nicht weiter und finde auch nichts passendes im Forum.
$articleRepo = Shopware()->Models()->getRepository("Shopware\Models\Article\Article");
$articles = $articleRepo->createQueryBuilder(array('articles', 'mainDetail', 'prices', 'tax', 'images', 'links', 'linkAttribute', 'imageAttribute', 'articlesAttribute', 'propertyValues'))
->from('Shopware\Models\Article\Article', 'articles')
->leftJoin('articles.mainDetail', 'mainDetail')
->innerJoin('mainDetail.prices', 'prices')
->leftJoin('articles.tax', 'tax')
->leftJoin('articles.images', 'images')
->leftJoin('articles.links', 'links')
->leftJoin('links.attribute', 'linkAttribute')
->leftJoin('images.attribute', 'imageAttribute')
->leftJoin('articles.attribute', 'articlesAttribute')
->leftJoin('articles.propertyValues', 'propertyValues')
->where('articles.active = :active')
->andWhere('articlesAttribute.articleGps IS NOT NULL')
->addOrderBy('mainDetail.releaseDate', 'DESC')
->setMaxResults('1000')
->setParameter('active',1)
->getQuery()
->getArrayResult();
$dbAllArticles = array();
foreach ($articles as $a) {
array_push($dbAllArticles,[
"article_id" => $a[mainDetail][articleId],
"number" => $a[mainDetail][number],
"name" => $a[name],
"description_long" => $a[descriptionLong],
"gps" => $a[attribute][articleGps],
]);
}
$view->assign('_all_db_article_data',$dbAllArticles); // all articles to view