7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Help with basic table - managed via modelAdmin - with display limit & multiple page results
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 1811 Views |
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 6:04am
Make sure you've turned PHP error reporting on, so you can get an error and not just a blank screen.
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 6:08am
How do i do that please?
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 8:12am
You can usually do it in .htaccess..
php_value display_errors On
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 11:11am
you're fast becoming my hero!
so, i did that, and it threw out this error:
Parse error: syntax error, unexpected ';', expecting ')' in /home/vhosts/worldaircraftsolutions.com.sg/httpdocs/mysite/code/Catalogue.php on line 23so on closer inspection, looks like there was an non-required ; at the end of line 23. i took that out and the site loaded up fine.
new part of that code is:
return array (
'ProductList' => $this->ProductList($filter)
);but now...when i try and use the search box, it loads this URL:
http://www.worldaircraftsolutions.com.sg/catalogue/ProductSearchForm
which loads "page does not exist"
do i need to make more templates for this??thanks again for all your help!
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 11:24am
is there no way i can edit the contents of this file: httpdocs/sapphire/search/SearchForm.php
in particular, this part:/**
* Classes to search
*/
protected $classesToSearch = array(
"SiteTree", "File"
);to somehow include my product catalogue?
also... if i can get this all to work, how will the results be displayed? because as the products aren't within a page per say, (they only appear in the table) what will the search results page display?? im a little worried we will get this up and running and the end result will be useless!ideally, it should do something helpful to the customer, such as load & highlight the product(s) within the table. (like it does in the modelAdmin backend when you search)
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 11:44am
Absolutely not. You're barking up the wrong tree. The site search form is not going to help you with this.
I think you're getting a page not found error because you haven't added ProductSearchForm to your $allowed_actions.
In the controller that contains the ProductSearchForm() function, add:
static $allowed_actions = array (
'ProductSearchForm'
); -
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

27 August 2010 at 11:25pm
OK i dropped it into the Catalogue.php controller section:
class Catalogue_Controller extends Page_Controller {
static $allowed_actions = array (
'ProductSearchForm'
);}
now when i try and search i get:
Website Error
There has been an errorThe website server has not been able to respond to your request.
here's what my full catalogue.php file now looks like:
<?php
class Catalogue extends Page {
public function ProductList ($filter = null){
if(!isset($_REQUEST['start'])) $_REQUEST['start'] = 0;
$limit = $_REQUEST['start'].",25";
return DataObject::get('Product', $filter, null, null, $limit);
}public function ProductSearchForm() {
return new Form (
$this,
"ProductSearchForm",
new FieldSet(new TextField('s','')),
new FieldSet(new FormAction('doProductSearch','Search'))
);
}public function doProductSearch($data, $form) {
if(isset($data['s'])) {
$filter = "SomeField LIKE '%".Convert::raw2sql($data['s'])."%'";
}
return array (
'ProductList' => $this->ProductList($filter)
);
}}
class Catalogue_Controller extends Page_Controller {
static $allowed_actions = array (
'ProductSearchForm'
);}
?>
-
Re: Help with basic table - managed via modelAdmin - with display limit & multiple page results

28 August 2010 at 2:47am
You need to put your site into dev mode. You shouldn't be running in live mode until you're in production.
Director::set_environment_type('dev');
That will allow you to see descriptive errors.
And did you notice that the query I gave you was just using placeholders for your fields? e.g. "SomeField".. make sure you go through and customise it as needed. I'm sure that's throwing a database error.
| 1811 Views | ||
| Go to Top | Next > |

