public function getList(array $options = array())
    {
        $options += array('index' => 'product_bundle_id');

        $result = &gplcart_static(gplcart_array_hash(array('product.bundle.list' => $options)));

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('product.bundle.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $conditions = array();

        $sql = 'SELECT pb.*, p.store_id
                FROM product_bundle pb
                LEFT JOIN product p ON(pb.product_id = p.product_id)
                LEFT JOIN product p2 ON(pb.item_product_id = p2.product_id)';

        if (isset($options['product_bundle_id'])) {
            $sql .= ' WHERE pb.product_bundle_id = ?';
            $conditions[] = $options['product_bundle_id'];
        } else {
            $sql .= ' WHERE pb.product_bundle_id IS NOT NULL';
        }

        if (isset($options['store_id'])) {
            $sql .= ' AND p.store_id = ? AND p2.store_id = ?';
            $conditions[] = $options['store_id'];
            $conditions[] = $options['store_id'];
        }

        if (isset($options['status'])) {
            $sql .= ' AND p.status = ? AND p2.status = ?';
            $conditions[] = (int) $options['status'];
            $conditions[] = (int) $options['status'];
        }

        if (isset($options['product_id'])) {
            $sql .= ' AND pb.product_id = ?';
            $conditions[] = $options['product_id'];
        }

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        $result = $this->db->fetchAll($sql, $conditions, array('index' => $options['index']));
        $this->hook->attach('product.bundle.list.after', $options, $result, $this);
        return $result;
    }
public function getList(array $options = array())
    {
        $options += array('index' => 'product_bundle_id');

        $result = &gplcart_static(gplcart_array_hash(array('product.bundle.list' => $options)));

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('product.bundle.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $conditions = array();

        $sql = 'SELECT pb.*, p.store_id
                FROM product_bundle pb
                LEFT JOIN product p ON(pb.product_id = p.product_id)
                LEFT JOIN product p2 ON(pb.item_product_id = p2.product_id)';

        if (isset($options['product_bundle_id'])) {
            $sql .= ' WHERE pb.product_bundle_id = ?';
            $conditions[] = $options['product_bundle_id'];
        } else {
            $sql .= ' WHERE pb.product_bundle_id IS NOT NULL';
        }

        if (isset($options['store_id'])) {
            $sql .= ' AND p.store_id = ? AND p2.store_id = ?';
            $conditions[] = $options['store_id'];
            $conditions[] = $options['store_id'];
        }

        if (isset($options['status'])) {
            $sql .= ' AND p.status = ? AND p2.status = ?';
            $conditions[] = (int) $options['status'];
            $conditions[] = (int) $options['status'];
        }

        if (isset($options['product_id'])) {
            $sql .= ' AND pb.product_id = ?';
            $conditions[] = $options['product_id'];
        }

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        $result = $this->db->fetchAll($sql, $conditions, array('index' => $options['index']));
        $this->hook->attach('product.bundle.list.after', $options, $result, $this);
        return $result;
    }
public function getList ( array $ options = array ( ) ) { $ options += array ( 'index' => 'product_bundle_id' ) ; $ result = & gplcart_static ( gplcart_array_hash ( array ( 'product.bundle.list' => $ options ) ) ) ; if ( isset ( $ result ) ) { return $ result ; } $ this -> hook -> attach ( 'product.bundle.list.before' , $ options , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ conditions = array ( ) ; $ sql = 'SELECT pb.*, p.store_id
                FROM product_bundle pb
                LEFT JOIN product p ON(pb.product_id = p.product_id)
                LEFT JOIN product p2 ON(pb.item_product_id = p2.product_id)' ; if ( isset ( $ options [ 'product_bundle_id' ] ) ) { $ sql .= ' WHERE pb.product_bundle_id = ?' ; $ conditions [ ] = $ options [ 'product_bundle_id' ] ; } else { $ sql .= ' WHERE pb.product_bundle_id IS NOT NULL' ; } if ( isset ( $ options [ 'store_id' ] ) ) { $ sql .= ' AND p.store_id = ? AND p2.store_id = ?' ; $ conditions [ ] = $ options [ 'store_id' ] ; $ conditions [ ] = $ options [ 'store_id' ] ; } if ( isset ( $ options [ 'status' ] ) ) { $ sql .= ' AND p.status = ? AND p2.status = ?' ; $ conditions [ ] = ( int ) $ options [ 'status' ] ; $ conditions [ ] = ( int ) $ options [ 'status' ] ; } if ( isset ( $ options [ 'product_id' ] ) ) { $ sql .= ' AND pb.product_id = ?' ; $ conditions [ ] = $ options [ 'product_id' ] ; } if ( ! empty ( $ options [ 'limit' ] ) ) { $ sql .= ' LIMIT ' . implode ( ',' , array_map ( 'intval' , $ options [ 'limit' ] ) ) ; } $ result = $ this -> db -> fetchAll ( $ sql , $ conditions , array ( 'index' => $ options [ 'index' ] ) ) ; $ this -> hook -> attach ( 'product.bundle.list.after' , $ options , $ result , $ this ) ; return $ result ; }
Returns an array of bundled products
@param array $options
@return array
Returns an array of bundled products