Exemplo n.º 1
0
 /**
  * Get attributes list
  *
  * @param boolean $countOnly Return items list or only its size OPTIONAL
  *
  * @return array|integer
  */
 protected function getAttributesList($countOnly = false)
 {
     $data = parent::getAttributesList($countOnly);
     if ($countOnly) {
         $result = $data;
     } else {
         $result = array();
         foreach ($data as $attribute) {
             $result[$attribute->getId()] = array('name' => $this->getWidget($this->getAttributeNameWidgetParams($attribute), '\\XLite\\View\\FormField\\Inline\\Input\\Text'), 'value' => $this->getWidget($this->getAttributeValueWidgetParams($attribute), $attribute::getWidgetClass($attribute->getType())));
         }
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Postprocess attributes
  *
  * @param array $attributes Attributes
  *
  * @return array
  */
 protected function postprocessAttributes(array $attributes)
 {
     $attributes = parent::postprocessAttributes($attributes);
     $product = $this->getProduct();
     if ($product && !\XLite::isAdminZone()) {
         foreach ($attributes as $i => $attribute) {
             $value = $attribute->getAttributeValue($product);
             if ($value && $value instanceof \XLite\Model\AttributeValue\AttributeValueText && $value->getEditable()) {
                 unset($attributes[$i]);
             }
         }
         $attributes = array_values($attributes);
     }
     return $attributes;
 }