This following customization will overcome the missing functionality on Export feature in websites that generated by PHPMaker. Please note that this modification below should be applied to PHPMaker <= 9.2.0, since I found it in the last two versions; 9.1.0 and 9.2.0. It seems that after searching for the certain records and then doing the certain Export to... feature (for example: Expot to Excel), it only works properly on the first page, but doesn't work properly in the second, third page, and so forth of the search results page. The exported records are always came from the first page of the search results page.
Updated on June 17, 2013: This customization below has been handled by using MasinoFixedWidthSite extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.
This is the steps how to reproduce the problem:
- Download the project demo files from: http://www.hkvstore.com/phpmaker/demo.asp.
- Run demo9.pmp file using PHPMaker, adjust to your database settings at sufficiently.
- Go to PHP -> List/View Page Options (Global) -> Export -> Export type, choose: Current page.
- Generate all the script files using PHPMaker as always.
- Open your generated web application, and then login using Username: admin and Password: master. Click on the orders link menu, and it will open Table: orders page, and you are on the first page now.
- Click on the Export to Excel link (on the first page), it works properly. All records in the first page are exported to Excel file.
- Go to the next page. You should now on the second page, afterwards, click on Export to Excel link, it works properly. All records in the second page are exported to Excel file.
- Now on the search textbox, input this keyword: 110 and then press Search (*) button. You should now see there are 129 records found, and you are on the first page.
- Click on the Export to Excel link (remember, you are on the first page after do searching, right?), it works properly, all the records in the first page are exported to Excel file.
- Go to the next page. You should now on the second page of the search results, aftewards, click on Export to Excel link, it works, BUT, UNFORTUNATELY, all the exported records in the Excel file are came from the first page of the search results page. It should come from the second page from the search results page.
- It also occured for another Export to... features, such as Printer Friendly, Export to HTML, etc.
God bless the day I found the issue, and also there is a simple solution to overcome the issue from PHPMaker developer/support, even it's a temporary solution by customizing the template. I hope this will be included in the next release of PHPMaker.
-
Open your \Script\list-script.php file, and find this code (if you don't find the code, then it has been fixed by the PHPMaker developers, so just ignore this step):
// Save search criteria if ($this->Command == "search") {then replace it with the following code:
// Save search criteria if ($this->Command == "search" && $this->Export == "") { - Re-generate your script files using PHPMaker as always.
I reported the issue completely to PHPMaker Discussion forum as you can see it in this thread.
Leave a Reply
You must be logged in to post a comment.