public function set($product_id, array $products)
    {
        $this->delete(array('product_id' => $product_id));

        $added = $count = 0;
        foreach ($products as $product) {

            $count++;

            $data = array(
                'product_id' => $product_id,
                'item_product_id' => $product['product_id']
            );

            if ($this->add($data)) {
                $added++;
            }
        }

        return $count && $added == $count;
    }
public function set($product_id, array $products)
    {
        $this->delete(array('product_id' => $product_id));

        $added = $count = 0;
        foreach ($products as $product) {

            $count++;

            $data = array(
                'product_id' => $product_id,
                'item_product_id' => $product['product_id']
            );

            if ($this->add($data)) {
                $added++;
            }
        }

        return $count && $added == $count;
    }
public function set ( $ product_id , array $ products ) { $ this -> delete ( array ( 'product_id' => $ product_id ) ) ; $ added = $ count = 0 ; foreach ( $ products as $ product ) { $ count ++ ; $ data = array ( 'product_id' => $ product_id , 'item_product_id' => $ product [ 'product_id' ] ) ; if ( $ this -> add ( $ data ) ) { $ added ++ ; } } return $ count && $ added == $ count ; }
Delete old and add new bundled items for the product
@param int $product_id
@param array $products
@return bool
Delete old and add new bundled items for the product