original_string: protected function setBundledProducts(array $order, array $data)
      {
          $update = false;
          foreach ($data['cart']['items'] as $item) {
  
              if (empty($item['product']['bundled_products'])) {
                  continue;
              }
  
              foreach ($item['product']['bundled_products'] as $product) {
  
                  $cart = array(
                      'sku' => $product['sku'],
                      'user_id' => $data['user_id'],
                      'quantity' => $item['quantity'],
                      'store_id' => $data['store_id'],
                      'order_id' => $order['order_id'],
                      'product_id' => $product['product_id'],
                  );
  
                  $this->cart->add($cart);
  
                  $update = true;
                  $order['data']['components']['cart']['items'][$product['sku']]['price'] = 0;
              }
          }
  
          if ($update) {
              $this->order->update($order['order_id'], array('data' => $order['data']));
          }
      }
code: protected function setBundledProducts(array $order, array $data)
      {
          $update = false;
          foreach ($data['cart']['items'] as $item) {
  
              if (empty($item['product']['bundled_products'])) {
                  continue;
              }
  
              foreach ($item['product']['bundled_products'] as $product) {
  
                  $cart = array(
                      'sku' => $product['sku'],
                      'user_id' => $data['user_id'],
                      'quantity' => $item['quantity'],
                      'store_id' => $data['store_id'],
                      'order_id' => $order['order_id'],
                      'product_id' => $product['product_id'],
                  );
  
                  $this->cart->add($cart);
  
                  $update = true;
                  $order['data']['components']['cart']['items'][$product['sku']]['price'] = 0;
              }
          }
  
          if ($update) {
              $this->order->update($order['order_id'], array('data' => $order['data']));
          }
      }
code_tokens: protected function setBundledProducts ( array $ order , array $ data ) { $ update = false ; foreach ( $ data [ 'cart' ] [ 'items' ] as $ item ) { if ( empty ( $ item [ 'product' ] [ 'bundled_products' ] ) ) { continue ; } foreach ( $ item [ 'product' ] [ 'bundled_products' ] as $ product ) { $ cart = array ( 'sku' => $ product [ 'sku' ] , 'user_id' => $ data [ 'user_id' ] , 'quantity' => $ item [ 'quantity' ] , 'store_id' => $ data [ 'store_id' ] , 'order_id' => $ order [ 'order_id' ] , 'product_id' => $ product [ 'product_id' ] , ) ; $ this -> cart -> add ( $ cart ) ; $ update = true ; $ order [ 'data' ] [ 'components' ] [ 'cart' ] [ 'items' ] [ $ product [ 'sku' ] ] [ 'price' ] = 0 ; } } if ( $ update ) { $ this -> order -> update ( $ order [ 'order_id' ] , array ( 'data' => $ order [ 'data' ] ) ) ; } }
docstring: Adds bundled products
  @param array $order
  @param array $data
docstring_tokens: Adds bundled products