public function addData($storeId, array $indexData)
    {
        $priceData = $this->resourceModel->loadPriceData($storeId, array_keys($indexData));

        foreach ($priceData as $priceDataRow) {
            $productId     = (int) $priceDataRow['entity_id'];
            $productTypeId = $indexData[$productId]['type_id'];
            $priceModifier = $this->getPriceDataReader($productTypeId);

            $originalPrice = $priceModifier->getOriginalPrice($priceDataRow);
            $price         = $priceModifier->getPrice($priceDataRow);

            $indexData[$productId]['price'][] = [
                'price'             => $price,
                'original_price'    => $originalPrice,
                'is_discount'       => $price < $originalPrice,
                'customer_group_id' => $priceDataRow['customer_group_id'],
            ];

            if (!isset($indexData[$productId]['indexed_attributes'])) {
                $indexData[$productId]['indexed_attributes'] = ['price'];
            } elseif (!in_array('price', $indexData[$productId]['indexed_attributes'])) {
                // Add price only one time.
                $indexData[$productId]['indexed_attributes'][] = 'price';
            }
        }

        return $indexData;
    }
public function addData($storeId, array $indexData)
    {
        $priceData = $this->resourceModel->loadPriceData($storeId, array_keys($indexData));

        foreach ($priceData as $priceDataRow) {
            $productId     = (int) $priceDataRow['entity_id'];
            $productTypeId = $indexData[$productId]['type_id'];
            $priceModifier = $this->getPriceDataReader($productTypeId);

            $originalPrice = $priceModifier->getOriginalPrice($priceDataRow);
            $price         = $priceModifier->getPrice($priceDataRow);

            $indexData[$productId]['price'][] = [
                'price'             => $price,
                'original_price'    => $originalPrice,
                'is_discount'       => $price < $originalPrice,
                'customer_group_id' => $priceDataRow['customer_group_id'],
            ];

            if (!isset($indexData[$productId]['indexed_attributes'])) {
                $indexData[$productId]['indexed_attributes'] = ['price'];
            } elseif (!in_array('price', $indexData[$productId]['indexed_attributes'])) {
                // Add price only one time.
                $indexData[$productId]['indexed_attributes'][] = 'price';
            }
        }

        return $indexData;
    }
public function addData ( $ storeId , array $ indexData ) { $ priceData = $ this -> resourceModel -> loadPriceData ( $ storeId , array_keys ( $ indexData ) ) ; foreach ( $ priceData as $ priceDataRow ) { $ productId = ( int ) $ priceDataRow [ 'entity_id' ] ; $ productTypeId = $ indexData [ $ productId ] [ 'type_id' ] ; $ priceModifier = $ this -> getPriceDataReader ( $ productTypeId ) ; $ originalPrice = $ priceModifier -> getOriginalPrice ( $ priceDataRow ) ; $ price = $ priceModifier -> getPrice ( $ priceDataRow ) ; $ indexData [ $ productId ] [ 'price' ] [ ] = [ 'price' => $ price , 'original_price' => $ originalPrice , 'is_discount' => $ price < $ originalPrice , 'customer_group_id' => $ priceDataRow [ 'customer_group_id' ] , ] ; if ( ! isset ( $ indexData [ $ productId ] [ 'indexed_attributes' ] ) ) { $ indexData [ $ productId ] [ 'indexed_attributes' ] = [ 'price' ] ; } elseif ( ! in_array ( 'price' , $ indexData [ $ productId ] [ 'indexed_attributes' ] ) ) { // Add price only one time. $ indexData [ $ productId ] [ 'indexed_attributes' ] [ ] = 'price' ; } } return $ indexData ; }
Add price data to the index data.

{@inheritdoc}
Add price data to the index data .