displaying sortable table for a custom query in an AdminTab instance - prestashop

I recently had to deal with a custom module written for prestashop 1.4, I have to display the
results in a std prestashop table (sortable, with filters) like the one for displaying orders
for example. I find that the official doc realy lacks a complete example for this case.
Any suggestion on how to proceed ?

The best way to use list in your module controller is to use HelperList class and is generateList function.
See blockreinsurance for sample
Best regards.

Related

How to pass variable value to feature title in karate summary report?

I wrote a feature and a reusable feature, and this is the result in karate summary report below.
enter image description here
However, I want to pass variable value to the report sub-title and makes it more readable. Below is what I want to get.
enter image description here
Is there any way we can customize the report in this way?
I have read the question on passing variable to karate feature line and scenario name. However it doesnt work on reusable feature, because for reusable feature it wont show as a normal scenario in karate report....
Thanks a lots!
Yes, in Karate we recommend that re-use is done only for "utilities" and not the main domain flows in your test.
Do consider using a Scenario Outline to loop like this, because it will appear in the report as a "normal" Scenario.
An enhancement released in 1.3.0.RC2 may give you what you are looking for: https://github.com/karatelabs/karate/issues/1905
Else please assume this is not supported, but open-source code contributions are welcome.

IntelliJ Idea: How to create a custom inspection rule

I'm looking for the way to create inspection to warn about large non-javadoc comments in code. I didn't found any suitable common inspection to do this. It looks like I should create a custom inspection rule. Does anybody know how to do it?
As far as I know, there are two ways to create your own code inspection in IntelliJ IDEA:
(simple but limited way) Creating custom inspection based on "search templates".
(more complex and more powerfull way) Developing an IDEA-plugin (here are the guidlines) using your own InspectionToolProvider implementation as "application-component". Also you may use sources of my inspections-plugin as the starting point.
See http://confluence.jetbrains.com/display/IDEADEV/Developing+Custom+Language+Plugins+for+IntelliJ+IDEA#DevelopingCustomLanguagePluginsforIntelliJIDEA-CodeInspectionsandIntentions. You can look at Open API and Plugin Development forum for assistance.

Dynamic Magento Grid built with database query

This is my first time asking a question here so, be nice;p .. I'm working with Magento (and Zend Framework) for the first time and I'm trying to build a custom grid that will populate based off of a manually written query. I'm trying to extend the Mage_Core_Model_Mysql4_Collection_Abstract to allow a query to be loaded into it and then parse the select fields in the extended Grid class to make it dynamic... Is this even possible or am I beating a dead horse? I've been at it for a week now and I'm not getting anywhere. The problem seems to be that inside the __Model_mysql4_Collection class has to be initialized with a resource model using _init() in the constuct
As a learning exercise use the module creator to make an admin grid page and see how that is done. Or even modify it's output to get what you need.
There will be a grid container block, a grid block (with _prepareCollection and _prepareColumns methods), a model, a resource model (representing a single record) and a collection resource model (representing several records).
Providing your own _init methods shouldn't be any sort of problem. Perhaps you'd like to post your config.xml and code so far as a pastebin or something.

Lucene numDocs and doqFreq on custom similarity class

im doing an aplication with Lucene (im a noob with it) and im facing some problems.
My aplication uses the Lucene 2.4.0 library with a custom similaraty implementation (the jar is imported)
In my app im calculating doqFreq and numDocs manually (im adding the values of all indexes and then i calculate a global value in order to use it on every query) and i want to use that values on a custom similarity implementation in order to calculate a new IDF.
The problem is that I dont know how to use (or send) the new doqFreq and numDocs values from my app on that new similarty implementation as I dont want to change luceneĀ“s code apart from this extra class.
Any suggestions or examples? I read the docs but i dont now how to aproach this :s
Thanks
You can try extending IndexReader and overriding IndexReader.docFreq() and IndexReader.numDocs(). In this subtype you can supply that you are calculating manually. I'm not sure if there are other Lucene components that are dependent on those values, so you might want to tread carefully here.

Is it possible to access custom properties from QT Designer after converting to python?

I am new to PyQt and Qt Designer and I'm trying to create an easy method for relating qWidgets with the tables and columns in an SQLite database. My idea was to tag each qWidget in designer with two custom properties, one with the table name and one with the column name. Later, I would use the info provided by designer to build my own class which creates a relationship between the qwidets and SQLite database.
Adding the custom properties in Designer seems to work fine however, the code for these custom properties do not get generated when converting the xml of designer into python (using UIC). Has anyone done this successfully? Perhaps there is a better way to do this?
Thanks,
Eric
If you added a property in Designer called "myproperty", fetch it with...
mywidget.property("myproperty")
This works fine in pyqt 4.8.3, perhaps it did not work in previous versions.
Check out this article Eric. Particularly look at the section titled "Producing a Plugin." River Bank Computing has another great PyQt reference.
EDIT:
I've been doing some more reading and I can't find a way to have this done automatically for you. If you are ok with with adding dynamic properties at run-time instead of design time you could accomplish the same end result. Here is an explanation of the setProperty() method in QObject, from which QWidget inherits.
If that doesn't work for you then it seems you might be better off going with a less generic approach. Instead of using a generic QWidget, you might be able to use a custom class derived from QSqlTableModel to keep track of your connection info. Another way would be to just use a QTableView and do the queries yourself to populate the data. Here and here are articles on databases in Qt. You might some inspiration for a new design from one of them.
I have not had great luck with using the Designer tool -- usually I end up doing a few rough layout, using pyuic and then editing and adding other stuff by hand.
It sounds like you could easily accomplish your task by creating your own custom class that inherits from QWidget and has the additional properties that you described. With my experiences trying to use custom widgets in the designer, I think the 'easier' way is to just write the class yourself and then set the layout by hand.
I know this doesn't exactly answer your question, but maybe you will try some of my suggestions.