public function getAvailableColumns(Category $category, $specField = false) { $availableColumns = parent::getAvailableColumns(); // specField columns if ($specField) { $fields = $category->getSpecificationFieldSet(Category::INCLUDE_PARENT); foreach ($fields as $field) { $fieldArray = $field->toArray(); $availableColumns['specField.' . $field->getID()] = array('name' => $fieldArray['name_lang'], 'type' => $field->isSimpleNumbers() ? 'numeric' : 'text'); } } $availableColumns['ProductImage.url'] = array('name' => $this->translate('ProductImage.url'), 'type' => 'text'); $availableColumns['ShippingClass.name'] = array('name' => $this->translate('Product.shippingClass'), 'type' => 'text'); $availableColumns['TaxClass.name'] = array('name' => $this->translate('Product.taxClass'), 'type' => 'text'); unset($availableColumns['Product.categoryIntervalCache']); unset($availableColumns['Product.childSettings']); unset($availableColumns['Product.ratingSum']); unset($availableColumns['Product.salesRank']); return $availableColumns; }
/** * Count specification fields in this category * * @param Category $category Category active record * @return integer */ private function getSpecFieldCount(Category $category) { return $category->getSpecificationFieldSet()->getTotalRecordCount(); }