Ejemplo n.º 1
0
 /**
  * @param FilterItem $subject
  * @param \Closure $proceed
  * @return string
  * @throws \Magento\Framework\Exception\LocalizedException
  *
  * @see \Magento\Catalog\Model\Layer\Filter\Item::getUrl()
  */
 public function aroundGetUrl(FilterItem $subject, \Closure $proceed)
 {
     $this->filter = $subject->getFilter();
     $this->eavAttribute = $this->filter->getAttributeModel();
     if ($this->canBeSubstituted()) {
         $result = $this->urlHelper->getOptionUrl($this->eavAttribute, $subject->getValue());
     } else {
         $result = $proceed();
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * @param FilterItem $filterItem
  * @param Option $swatchOption
  * @return array
  */
 protected function getOptionViewData(FilterItem $filterItem, Option $swatchOption)
 {
     $customStyle = '';
     $linkToOption = $this->buildUrl($this->eavAttribute->getAttributeCode(), $filterItem->getValue());
     if ($this->isOptionDisabled($filterItem)) {
         $customStyle = 'disabled';
         $linkToOption = 'javascript:void();';
     }
     return ['label' => $swatchOption->getLabel(), 'link' => $linkToOption, 'custom_style' => $customStyle];
 }