Exemplo n.º 1
0
 /**
  * score generation for quantity discount
  */
 protected static function _getScoreQuery($id_product, $id_shop, $id_currency, $id_country, $id_group, $id_customer)
 {
     $select = '(';
     $priority = AphCustomPrice::getPriority($id_product);
     foreach (array_reverse($priority) as $k => $field) {
         if (!empty($field)) {
             $select .= ' IF (`' . bqSQL($field) . '` = ' . (int) ${$field} . ', ' . pow(2, $k + 1) . ', 0) + ';
         }
     }
     return rtrim($select, ' +') . ') AS `score`';
 }