Antwort #321 am: 19. Juni 2022, 23:42:53
Ich habe heute nochmal an diesem Problem rumgetüftelt und musste feststellen, dass die von noRiddle zuletzt vorgeschlagene Abwandlung der Funktion GetOptionPrice nicht mehr funktioniert. Ich vermute mal das hat alles einwandfrei funktioniert aber durch ein Shop Update an anderer Stelle nicht mehr. Jedenfalls landete das Produkt bei mir wieder mit falschem Preis im Warenkorb. Ich hab das auf folgende Art gefixt. Vielleicht hilft das ja jemandem.
function GetOptionPrice($dataArr, $attribute_data, $pID, $option, $value, $qty) {
if($dataArr['weight_prefix'] == '=') {$dataArr['weight'] = ($attribute_data['products_weight'] * -1) + $attribute_data['options_values_weight'];} //substract products weight, will be added later in other modules
if($dataArr['price_prefix'] == '=') {
global $xtPrice;
$CalculateCurr = (($attribute_data['products_tax_class_id'] == 0) ? true : false);
$attprice = $xtPrice->xtcFormat($attribute_data['options_values_price'], false, $attribute_data['products_tax_class_id'], $CalculateCurr);
//BOC respect special price if applicable, noRiddle
if($specPrice = $xtPrice->xtcCheckSpecial($pID)) {
// Ergänzung: Prozentuale Rabattberechnung anhand des special Preises und des alten Basispreises
$oldprice = $xtPrice->getPprice($pID);
$temp_pprice = $specPrice;
$prozent = $specPrice/$oldprice;
} else {
$temp_pprice = $attribute_data['products_price'];
// kein Rabatt errechnen
$prozent = 1;
}
$pprice = $xtPrice->xtcFormat($temp_pprice, false, $attribute_data['products_tax_class_id'], $CalculateCurr);
//EOC respect special price if applicable, noRiddle
$price = ($pprice * -1) + $attprice*$prozent; //substract products price, will be added again later in other modules - added *$prozent
$dataArr['price'] = $price;
}
return $dataArr;
}