/** * Retrieve formatted bundle selections * * @param string $optionValues * @param SelectionCollection $selections * @return string */ protected function getFormattedBundleSelections($optionValues, SelectionCollection $selections) { $bundleData = ''; $selections->addAttributeToSort('position'); foreach ($selections as $selection) { $selectionData = ['sku' => $selection->getSku(), 'price' => $selection->getSelectionPriceValue(), 'default' => $selection->getIsDefault(), 'default_qty' => $selection->getSelectionQty(), 'price_type' => $this->getPriceTypeValue($selection->getSelectionPriceType())]; $bundleData .= $optionValues . ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR . implode(ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, array_map(function ($value, $key) { return $key . ImportProductModel::PAIR_NAME_VALUE_SEPARATOR . $value; }, $selectionData, array_keys($selectionData))) . ImportProductModel::PSEUDO_MULTI_LINE_SEPARATOR; } return $bundleData; }