Ive been trying to extend ProductCatalogAdmin, because thats the ModelAdmin that holds the Products I want to export. The code below works fine when added to core code (Which I don't want to do), but fails to do anything when added as an Extension.
PHP
<?php
class ProductCatalogAdminExtension extends DataExtension {
public function getExportFields() {
return array(
'ID' => 'ID',
'InternalItemID' => 'InternalItemID',
'Model' => 'Model',
'Content' => 'Content',
'CostPrice' => 'CostPrice',
'BasePrice' => 'BasePrice',
'Weight' => 'Weight',
'Height' => 'Height',
'Width' => 'Width',
'Depth' => 'Depth',
'Featured' => 'Featured',
'AllowPurchase' => 'AllowPurchase',
'Popularity' => 'Popularity',
'PromoActive' => 'PromoActive',
'PromoDisplay' => 'PromoDisplay',
'PromoType' => 'PromoType',
'PromoAmount' => 'PromoAmount',
'PromoPercent' => 'PromoPercent',
'PromoStartDate' => 'PromoStartDate',
'PromoEndDate' => 'PromoEndDate',
'Image.URL' => 'Image',
'WholesalePrice' => 'WholesalePrice',
'ParentID' => 'ParentID',
'ProductCategory.ID' => 'AdditionalCategories'
);
}
}
YML
---
Name: mysite
After:
- 'framework/*'
- 'cms/*'
---
# YAML configuration for SilverStripe
# See http://doc.silverstripe.org/framework/en/topics/configuration
# Caution: Indentation through two spaces, not tabs
SSViewer:
theme: 'simple'
SiteConfig:
extensions:
- SiteConfigExtension
ProductCatalogAdmin:
extensions:
- ProductCatalogAdminExtension
I've been told, ModelAdmin's getExportFields() doesn't have an extend() call, so I'll have to use inheritance rather than an Extension. However doing it under inheritance for ModelAdmin seems to do nothing also. Interestingly I get no error messages, it doesn't really fail.