original_string: public function getList(array $options = array())
      {
          $result = null;
          $this->hook->attach('sku.list.before', $options, $result, $this);
  
          if (isset($result)) {
              return $result;
          }
  
          $sql = 'SELECT ps.*, p.title, p.currency';
  
          if (!empty($options['count'])) {
              $sql = 'SELECT COUNT(ps.product_sku_id)';
          }
  
          $sql .= ' FROM product_sku ps LEFT JOIN product p ON(ps.product_id = p.product_id)';
  
          $conditions = array();
  
          if (isset($options['product_sku_id'])) {
              $sql .= ' WHERE ps.product_sku_id = ?';
              $conditions[] = $options['product_sku_id'];
          } else {
              $sql .= ' WHERE ps.product_sku_id IS NOT NULL';
          }
  
          if (isset($options['sku'])) {
              $sql .= ' AND ps.sku=?';
              $conditions[] = $options['sku'];
          }
  
          if (isset($options['store_id'])) {
              $sql .= ' AND p.store_id=?';
              $conditions[] = $options['store_id'];
          }
  
          if (isset($options['title_sku'])) {
              $sql .= ' AND (p.title LIKE ? OR ps.sku LIKE ?)';
              $conditions[] = "%{$options['title_sku']}%";
              $conditions[] = "%{$options['title_sku']}%";
          }
  
          if (isset($options['product_id'])) {
              $sql .= ' AND ps.product_id=?';
              $conditions[] = $options['product_id'];
          }
  
          if (isset($options['combination_id'])) {
              $sql .= ' AND ps.combination_id=?';
              $conditions[] = $options['combination_id'];
          }
  
          if (isset($options['status'])) {
              $sql .= ' AND ps.status=?';
              $conditions[] = (int) $options['status'];
          }
  
          $sql .= " ORDER BY ps.sku ASC";
  
          if (!empty($options['limit'])) {
              $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
          }
  
          if (empty($options['count'])) {
              $list = $this->db->fetchAll($sql, $conditions, array('index' => 'product_sku_id'));
              $result = $this->prepareList($list);
          } else {
              $result = (int) $this->db->fetchColumn($sql, $conditions);
          }
  
          $this->hook->attach('sku.list.after', $options, $result, $this);
          return $result;
      }
code: public function getList(array $options = array())
      {
          $result = null;
          $this->hook->attach('sku.list.before', $options, $result, $this);
  
          if (isset($result)) {
              return $result;
          }
  
          $sql = 'SELECT ps.*, p.title, p.currency';
  
          if (!empty($options['count'])) {
              $sql = 'SELECT COUNT(ps.product_sku_id)';
          }
  
          $sql .= ' FROM product_sku ps LEFT JOIN product p ON(ps.product_id = p.product_id)';
  
          $conditions = array();
  
          if (isset($options['product_sku_id'])) {
              $sql .= ' WHERE ps.product_sku_id = ?';
              $conditions[] = $options['product_sku_id'];
          } else {
              $sql .= ' WHERE ps.product_sku_id IS NOT NULL';
          }
  
          if (isset($options['sku'])) {
              $sql .= ' AND ps.sku=?';
              $conditions[] = $options['sku'];
          }
  
          if (isset($options['store_id'])) {
              $sql .= ' AND p.store_id=?';
              $conditions[] = $options['store_id'];
          }
  
          if (isset($options['title_sku'])) {
              $sql .= ' AND (p.title LIKE ? OR ps.sku LIKE ?)';
              $conditions[] = "%{$options['title_sku']}%";
              $conditions[] = "%{$options['title_sku']}%";
          }
  
          if (isset($options['product_id'])) {
              $sql .= ' AND ps.product_id=?';
              $conditions[] = $options['product_id'];
          }
  
          if (isset($options['combination_id'])) {
              $sql .= ' AND ps.combination_id=?';
              $conditions[] = $options['combination_id'];
          }
  
          if (isset($options['status'])) {
              $sql .= ' AND ps.status=?';
              $conditions[] = (int) $options['status'];
          }
  
          $sql .= " ORDER BY ps.sku ASC";
  
          if (!empty($options['limit'])) {
              $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
          }
  
          if (empty($options['count'])) {
              $list = $this->db->fetchAll($sql, $conditions, array('index' => 'product_sku_id'));
              $result = $this->prepareList($list);
          } else {
              $result = (int) $this->db->fetchColumn($sql, $conditions);
          }
  
          $this->hook->attach('sku.list.after', $options, $result, $this);
          return $result;
      }
code_tokens: public function getList ( array $ options = array ( ) ) { $ result = null ; $ this -> hook -> attach ( 'sku.list.before' , $ options , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ sql = 'SELECT ps.*, p.title, p.currency' ; if ( ! empty ( $ options [ 'count' ] ) ) { $ sql = 'SELECT COUNT(ps.product_sku_id)' ; } $ sql .= ' FROM product_sku ps LEFT JOIN product p ON(ps.product_id = p.product_id)' ; $ conditions = array ( ) ; if ( isset ( $ options [ 'product_sku_id' ] ) ) { $ sql .= ' WHERE ps.product_sku_id = ?' ; $ conditions [ ] = $ options [ 'product_sku_id' ] ; } else { $ sql .= ' WHERE ps.product_sku_id IS NOT NULL' ; } if ( isset ( $ options [ 'sku' ] ) ) { $ sql .= ' AND ps.sku=?' ; $ conditions [ ] = $ options [ 'sku' ] ; } if ( isset ( $ options [ 'store_id' ] ) ) { $ sql .= ' AND p.store_id=?' ; $ conditions [ ] = $ options [ 'store_id' ] ; } if ( isset ( $ options [ 'title_sku' ] ) ) { $ sql .= ' AND (p.title LIKE ? OR ps.sku LIKE ?)' ; $ conditions [ ] = "%{$options['title_sku']}%" ; $ conditions [ ] = "%{$options['title_sku']}%" ; } if ( isset ( $ options [ 'product_id' ] ) ) { $ sql .= ' AND ps.product_id=?' ; $ conditions [ ] = $ options [ 'product_id' ] ; } if ( isset ( $ options [ 'combination_id' ] ) ) { $ sql .= ' AND ps.combination_id=?' ; $ conditions [ ] = $ options [ 'combination_id' ] ; } if ( isset ( $ options [ 'status' ] ) ) { $ sql .= ' AND ps.status=?' ; $ conditions [ ] = ( int ) $ options [ 'status' ] ; } $ sql .= " ORDER BY ps.sku ASC" ; if ( ! empty ( $ options [ 'limit' ] ) ) { $ sql .= ' LIMIT ' . implode ( ',' , array_map ( 'intval' , $ options [ 'limit' ] ) ) ; } if ( empty ( $ options [ 'count' ] ) ) { $ list = $ this -> db -> fetchAll ( $ sql , $ conditions , array ( 'index' => 'product_sku_id' ) ) ; $ result = $ this -> prepareList ( $ list ) ; } else { $ result = ( int ) $ this -> db -> fetchColumn ( $ sql , $ conditions ) ; } $ this -> hook -> attach ( 'sku.list.after' , $ options , $ result , $ this ) ; return $ result ; }
docstring: Returns an array of SKUs or counts them
  @param array $options
  @return array|integer
docstring_tokens: Returns an array of SKUs or counts them