0
Ich verstehe nicht genau warum, aber wenn ich diese Funktion schreibe, funktioniert die Schleife für doesn '.Berechnung innerhalb einer Schleife macht nicht Ergebnis
Haben Sie eine Idee?
danke
$qty
ist von einem Kunden
$id
machen: id des
$products_price
Preis des Produkts
public function getProductsNewPriceByDiscountQuantity($id, $qty, $products_price) {
$OSCOM_Db = Registry::get('Db');
$OSCOM_Customer = Registry::get('Customer');
$QprodutsQuantityDiscount= $OSCOM_Db->prepare('select discount_quantity,
discount_customer
from :table_products_discount_quantity
where products_id = :products_id
and customers_group_id = :customers_group_id
and discount_quantity <> 0
');
$QprodutsQuantityDiscount->bindInt(':products_id', $id);
$QprodutsQuantityDiscount->bindInt(':customers_group_id', $OSCOM_Customer->getCustomersGroupID());
$QprodutsQuantityDiscount->execute();
while ($QprodutsQuantityDiscount->fetch()) {
$discount_quantity[] = $QprodutsQuantityDiscount->valueInt('discount_quantity');
$discount_customer[] = $QprodutsQuantityDiscount->valueDecimal('discount_customer');
}
$nb_discount = count($discount_quantity); //
$n = $nb_discount -1; // 0,1,2 for the table indice
// Schleife am wichtigsten weniger Produkt wichtig
$ new_price wird auf jeder Schleifeniterationslatenzzeit überschrieben. – nogad
Welche Datenbank ist das und welche Datenbank-API verwenden Sie? – RiggsFolly
Wenn dies die MYSQL PDO API ist, würde ich sagen, dass die Abfrage fehlschlagen sollte. Testen Sie das Ergebnis der Vorbereitung und die Ausführung – RiggsFolly