shopware AG Partner
shopware AG Team
shopware AG Partner
shopware AG Team
shopware AG Partner
shopware AG Partner
shopware AG Partner
/**
* Article price consider trade discount
* @param double $price
* @param array $article article data as an array
* @access protected
* @return double $price unformated price
*/
protected function tradediscount($price, $amount, $article) {
if($article["pricegroupActive"] == 0) {
return $price;
}
// Get data for pricegroup
$sql = "SELECT discount, discountstart FROM s_core_pricegroups_discounts WHERE groupID = " . $article["pricegroupID"] . " AND discountstart <= " . (int) $amount;
$aTradeDiscount = $this->sSYSTEM->sDB_CONNECTION->CacheGetRow($this->sSYSTEM->sCONFIG['sCACHEARTICLE'],$sql,false,"tradediscount_".$article["articleID"]);
if(!isset($aTradeDiscount["discount"]) || $aTradeDiscount["discount"] == 0) {
return $price;
}
// Calc discount
$price = $price - ($price / 100 * $aTradeDiscount['discount']);
return $price;
}
$blockPriceValue["price"] = $this->tradediscount($blockPriceValue["price"], $blockPriceValue["valFrom"], $getArticle); $blockPriceValue["pseudoprice"] = $this->tradediscount($blockPriceValue["pseudoprice"], $blockPriceValue["valFrom"], $getArticle);
