/** * Retrieve formatted item options view * * @param \Magento\Quote\Api\Data\CartItemInterface $item * @return string */ private function getFormattedOptionValue($item) { $optionsData = []; /* @var $helper \Magento\Catalog\Helper\Product\Configuration */ $helper = $this->configurationPool->getByProductType('default'); $options = $this->configurationPool->getByProductType($item->getProductType())->getOptions($item); foreach ($options as $index => $optionValue) { $params = ['max_length' => 55, 'cut_replacer' => ' <a href="#" class="dots tooltip toggle" onclick="return false">...</a>']; $option = $helper->getFormattedOptionValue($optionValue, $params); $optionsData[$index] = $option; $optionsData[$index]['label'] = $optionValue['label']; } return \Zend_Json::encode($optionsData); }
/** * Get list of all options for product * * @return array * @codeCoverageIgnore */ protected function getOptionList() { return $this->configurationPool->getByProductType($this->item->getProductType())->getOptions($this->item); }
/** * @dataProvider getByProductTypeDataProvider * @param string $productType * @param string $expectedResult */ public function testGetByProductType($productType, $expectedResult) { $this->assertEquals($expectedResult, $this->model->getByProductType($productType)); }