shopware AG Partner
Shopware Guru
aikanet hat geschrieben:Hallo zusammen,
ich habe ein neues Anliegen. Aktuell werden mir bei Artikeln mit Staffelpreisen in der Listenansicht ein zu hoher "ab"-Preis ausgegeben. Genauer gesagt der Preis ab 1 Stück. Die Artikel werden bei Staffelpreisen natürlich immer günstiger. Somit sollte in der Kategorieauflistung auch der günstigste Preis erscheinen.
Gibt es eine Lösung hierzu?
Danke und Grüße,
Rafael Kutscha
{foreach from=$sArticle.sBlockPrices item=row key=key name="counter"}
{if $smarty.foreach.counter.last}{$row.price|currency} {s name="Star" namespace="frontend/listing/box_article"}{/s}
{/if}
{/foreach}
shopware AG Partner

{$sArticle.sBlockPrices|@count}
Shopware Guru
public static function onListingPostDispatch(Enlight_Event_EventArgs $args)
{
$request = $args->getSubject()->Request();
$response = $args->getSubject()->Response();
$view = $args->getSubject()->View();
$articles = $view->sArticles;
if(!$request->isDispatched()||$response->isException()||$request->getModuleName()!='frontend'){
return;
}
$i = 0;
foreach($articles as $article) {
if ($articles[$i]['articleDetailsID']) {
$sql = "SELECT `from` AS valFrom,`to` AS valTo, price, pseudoprice FROM s_articles_prices WHERE articledetailsID={$articles[$i]['articleDetailsID']}
AND (pricegroup='EK')
ORDER BY id ASC
";
$getBlockPricings = Shopware()->Db()->fetchAll($sql);
}
// If more then one row, there are block-prices
if (count($getBlockPricings)>1){
foreach ($getBlockPricings as $blockPriceKey => $blockPriceValue){
$getBlockPricings[$blockPriceKey]["from"] = $blockPriceValue["valFrom"];
$getBlockPricings[$blockPriceKey]["to"] = $blockPriceValue["valTo"];
$getBlockPricings[$blockPriceKey]["price"] = Shopware()->Modules()->Articles()->sCalculatingPrice($blockPriceValue["price"],19,$articles[$i]);
$getBlockPricings[$blockPriceKey]["pseudoprice"] = Shopware()->Modules()->Articles()->sCalculatingPrice($blockPriceValue["pseudoprice"],19,$articles[$i]);
}
$articles[$i]['sBlockPrices'] = $getBlockPricings;
} // block pricing
else {
$articles[$i]['sBlockPrices'] = array();
}
$i++;
}
$view->sArticles = $articles;
}
shopware AG Partner