Exemplo n.º 1
0
 public static function getQuantityDiscount($id_product, $id_shop, $id_currency, $id_country, $id_group, $quantity, $id_product_attribute = null, $id_customer = 0)
 {
     $query_extra = self::computeExtraConditions($id_product, $id_product_attribute, $id_customer, null);
     return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
         SELECT *,
                 ' . AphCustomPrice::_getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer) . '
         FROM `' . _DB_PREFIX_ . 'custom_price`
         WHERE
                 `id_shop` ' . self::formatIntInQuery(0, $id_shop) . ' AND
                 `id_currency` ' . self::formatIntInQuery(0, $id_currency) . ' AND
                 `id_country` ' . self::formatIntInQuery(0, $id_country) . ' AND
                 `id_group` ' . self::formatIntInQuery(0, $id_group) . ' AND
                 `from_quantity` >= ' . (int) $quantity . ' ' . $query_extra . '
                 ORDER BY `from_quantity` DESC, `score` DESC, `to` DESC, `from` DESC
     ');
 }