`id_shop` IN(0, ' . (int) $id_shop . ') AND `id_currency` IN(0, ' . (int) $id_currency . ') AND `id_country` IN(0, ' . (int) $id_country . ') AND `id_group` IN(0, ' . (int) $id_group . ') AND `id_customer` IN(0, ' . (int) $id_customer . ') AND ( (`from` = \'0000-00-00 00:00:00\' OR \'' . $now . '\' >= `from`) AND (`to` = \'0000-00-00 00:00:00\' OR \'' . $now . '\' <= `to`) ) ORDER BY `from_quantity` ASC, `id_specific_price_rule` ASC, `score` DESC '); $targeted_prices = array(); $last_quantity = array(); foreach ($res as $specific_price) { if (!isset($last_quantity[(int) $specific_price['id_product_attribute']])) { $last_quantity[(int) $specific_price['id_product_attribute']] = $specific_price['from_quantity']; } elseif ($last_quantity[(int) $specific_price['id_product_attribute']] == $specific_price['from_quantity']) { continue; } $last_quantity[(int) $specific_price['id_product_attribute']] = $specific_price['from_quantity']; if ($specific_price['from_quantity'] > PP::getSpecificPriceFromQty((int) $id_product)) { $targeted_prices[] = $specific_price; } } return $targeted_prices; } } SpecificPrice::ppInit();