64 Json $serializer =
null,
67 $this->_productOptionFactory = $productOptionFactory;
70 $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
71 $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class);
72 parent::__construct($context);
91 $itemOption =
$item->getOptionByCode(
'option_' .
$option->getId());
95 ->setConfigurationItem(
$item)
96 ->setConfigurationItemOption($itemOption);
98 if (
'file' ==
$option->getType()) {
99 $downloadParams =
$item->getFileDownloadParams();
100 if ($downloadParams) {
101 $url = $downloadParams->getUrl();
105 $urlParams = $downloadParams->getUrlParams();
107 $group->setCustomOptionUrlParams($urlParams);
113 'label' =>
$option->getTitle(),
114 'value' =>
$group->getFormattedOptionValue($itemOption->getValue()),
115 'print_value' =>
$group->getPrintableOptionValue($itemOption->getValue()),
116 'option_id' =>
$option->getId(),
117 'option_type' =>
$option->getType(),
118 'custom_view' =>
$group->isCustomizedView(),
124 $addOptions =
$item->getOptionByCode(
'additional_options');
126 $options = array_merge(
$options, $this->serializer->unserialize($addOptions->getValue()));
140 return $this->getCustomOptions(
$item);
175 $maxLength = isset(
$params[
'max_length']) ?
$params[
'max_length'] :
null;
176 $cutReplacer = isset(
$params[
'cut_replacer']) ?
$params[
'cut_replacer'] :
'...';
185 if (isset($optionInfo[
'value'])) {
186 $optionValue = $this->escaper->escapeHtml($optionInfo[
'value']);
194 if (isset($optionInfo[
'custom_view']) && $optionInfo[
'custom_view']) {
196 if (isset($optionInfo[
'option_type'])) {
198 $group = $this->_productOptionFactory->create()->groupFactory($optionInfo[
'option_type']);
199 return [
'value' =>
$group->getCustomizedView($optionInfo)];
210 $truncatedValue = nl2br($truncatedValue);
211 return [
'value' => $truncatedValue];
214 $truncatedValue = $this->filter->truncate(
$optionValue, [
'length' => $maxLength,
'etc' =>
'']);
218 $truncatedValue = nl2br($truncatedValue);
221 $result = [
'value' => $truncatedValue];
223 if ($maxLength && $this->string->strlen(
$optionValue) > $maxLength) {
getFormattedOptionValue($optionValue, $params=null)
getOptions(\Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item)
elseif(isset( $params[ 'redirect_parent']))
__construct(\Magento\Framework\App\Helper\Context $context, \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory, \Magento\Framework\Filter\FilterManager $filter, \Magento\Framework\Stdlib\StringUtils $string, Json $serializer=null, Escaper $escaper=null)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]