示例#1
0
 public function getFields()
 {
     $this->loadLanguageFile('backend/Product');
     $fields['Product.ID'] = $this->translate('Product.ID');
     $productController = new ProductController($this->application);
     foreach ($productController->getAvailableColumns(Category::getInstanceByID($this->application->getRequest()->get('category'), true), true) as $key => $data) {
         $fields[$key] = $this->translate($data['name']);
     }
     unset($fields['Product.reviewCount']);
     unset($fields['ShippingClass.name']);
     unset($fields['TaxClass.name']);
     unset($fields['hiddenType']);
     unset($fields['ProductImage.url']);
     $groupedFields = array();
     foreach ($fields as $field => $fieldName) {
         list($class, $field) = explode('.', $field, 2);
         $groupedFields[$class][$class . '.' . $field] = $fieldName;
     }
     $groupedFields['Product']['Product.shippingClass'] = $this->translate('Product.shippingClass');
     $groupedFields['Product']['Product.taxClass'] = $this->translate('Product.taxClass');
     $groupedFields['ProductOption']['ProductOption.options'] = $this->translate('ProductOption.options');
     // do not show manufacturer field in a separate group
     $groupedFields['Product'] = array_merge($groupedFields['Product'], $groupedFields['Manufacturer']);
     unset($groupedFields['Manufacturer']);
     // variations
     $groupedFields['ProductVariation']['Product.parentID'] = $this->translate('Product.parentID');
     $groupedFields['ProductVariation']['Parent.parentSKU'] = $this->translate('Product.parentSKU');
     for ($k = 1; $k <= 5; $k++) {
         $groupedFields['ProductVariation']['ProductVariation.' . $k] = $this->maketext('_variation_name', $k);
     }
     // image fields
     $groupedFields['ProductImage']['ProductImage.mainurl'] = $this->translate('_main_image_location');
     for ($k = 1; $k <= 3; $k++) {
         $groupedFields['ProductImage']['ProductAdditionalImage.' . $k] = $this->maketext('_additional_image_location', $k);
     }
     $groupedFields['ProductImage']['ProductImage.Images'] = $this->translate('_images');
     // category fields
     $groupedFields['Category']['Category.ID'] = $this->translate('Category.ID');
     for ($k = 1; $k <= 10; $k++) {
         $groupedFields['Category']['Category.' . $k] = $this->maketext('_category_x', $k);
     }
     $groupedFields['Category']['Categories.Categories'] = $this->translate('_categories');
     $groupedFields['Category']['Categories.ExtraCategories'] = $this->translate('_extra_categories');
     $groupedFields['Category']['Categories.categoryIDs'] = $this->translate('_categoryIDs');
     // price fields
     $groupedFields['ProductPrice']['ProductPrice.listPrice'] = $this->translate('_list_price');
     for ($k = 1; $k <= 5; $k++) {
         $groupedFields['ProductPrice']['ProductPrice.' . $k] = $this->maketext('_quantity_level_x', $k);
     }
     return $groupedFields;
 }