I am working on a SilverStripe project. In my project, I am trying to implement a create a way to override the ModelAdmin export the CSV function to add custom fields with the custom query that are displayed on the summary list table. There is a getExportFields() method that I can specify the custom fields. But that problem is that it is just not enough for me. Following is my scenario.
I overrode the getList() method of the custom ModelAdmin class using some custom queries based on the filter. What I need to do is that I need to export all the data that are on the list with some custom additional fields using custom queries. How can I do that?
Related
I'm currently experimenting with EasyAdminBundle:
I want to add a menu item that calls a custom controller and renders a view. The view is not based on an entity but should rather display the results of a csv import.
What I have done so far is:
create Controller and render the results into a new twig template.
add the menu item to config and call my Controller with the option
'route'
The twig template is pretty basic for now. It extends from "EasyAdminBundle:default:layout.html.twig" and overwrites the block "main" in order to display the import results.
Now my problem is that it does not seem to find the css for the layout twig?
My results show a plain html page without any formatting :(
Any hints or suggestions how I can render the view with all the styles from the default views?
Also note: I don't want to overwrite the default layout template for the whole backend and I also don't have a specific entity where I could assign a special layout file. Thanks for your help.
found the problem. So the setup as described was ok except that we had some internal project config (that I was not aware of), that would make the response to be returned as json instead of html.
I have a Woocommerce shop and I'm using the Woocommerce REST API to list products etc. on another site and it works fine. There are some functionality that I'm missing though, and I'm wondering if it is possible to extend the API with custom calls?
I was able to figure out how to this by reading the source code for Woocommerce.
First I had to create a class that extends WC_API_Resource and add my routes in the register_routes method of this class. Then I had to make sure that Woocommerce adds this class to the API by adding the class to the class-array in the woocommerce_api_classes filter.
I have created a page template for my custom dexterity type.
The default view automatically shows all the fields, rather than my custom template which shows no fields.
I'd like to start my template by copying the default template. I have tried pasting in a copy of plone.app.dexterity.browser/item.pt however that gives me
LocationError: (<my.types.resource.ResourceView object at 0xb4d18bcc>, 'widgets')
I am not sure why.
I guess that using this template might not even be the best solution, if I need to change the way individual fields render. In that case I am wondering how I can start with a template which contains the fields in my type (in the past I used ArchGenXML). Is there an equivalent process for dexterity?
Derive your view class from dexterity.DisplayForm.
This may make your copy/pasted template work immediately by giving it the view methods and properties it needs. It will also make available variable like view.widgets, which contains a list of display widgets in schema order.
See http://developer.plone.org/reference_manuals/external/plone.app.dexterity/custom-views.html#display-forms for details.
Woocommerce has change the file structure sine version 2 onwards. Now the list of custom fields are placed inside WC_Admin_Profile class. I want to access these custom fields within another plugin.
We can inlcude the WC_Admin_Profile class as it duplicates the fields on admin section. Is there a way to get custom fields or call WC_Admin_Profile functions directly.
Why don't you simply call get_user_meta() for custom user fields or get_post_meta() for custom order fields (I am not sure what exactly you are referring to)?
I am able to create custom pages for a base type, but not for any of its derived types.
I have a Product class and derived types LightPipe and CardGuide. I created a custom page under CustomPages/Products/List.aspx. This work fine; Dynamic Data uses the custom page when displaying base Product entities.
However, when I create a custom page for LightPipe under CustomPages/LightPipes/List.aspx, Dynamic Data still uses the standard page template under PageTemplages/List.aspx rather than my custom template.
Is this a limitation of Dynamic Data?
Thank you for your time.
EDIT: Added clarification.