Exemplo n.º 1
0
 /**
  * Retrieve Product Attribute Value
  *
  * @param Product $product
  * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
  * @return \Magento\Framework\Phrase|string
  */
 public function getProductAttributeValue($product, $attribute)
 {
     if (!$product->hasData($attribute->getAttributeCode())) {
         return __('N/A');
     }
     if ($attribute->getSourceModel() || in_array($attribute->getFrontendInput(), ['select', 'boolean', 'multiselect'])) {
         //$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
         $value = $attribute->getFrontend()->getValue($product);
     } else {
         $value = $product->getData($attribute->getAttributeCode());
     }
     return (string) $value == '' ? __('No') : $value;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getFrontend()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getFrontend');
     if (!$pluginInfo) {
         return parent::getFrontend();
     } else {
         return $this->___callPlugins('getFrontend', func_get_args(), $pluginInfo);
     }
 }