Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Help with basic table - managed via modelAdmin - with display limit & multiple page results


Reply


36 Posts   2680 Views

Avatar
UncleCheese

Forum Moderator, 4096 Posts

29 August 2010 at 6:30am

Well, that's a separate issue. We're talking about javascript behaviours now, and you can handle that anyway you want, really, but the old "onclick" attributes are not really a good practice anymore. They were 3 or 4 years ago, but it's not really compliant with the MVC framework to mix Javascript and HTML anymore. Attach that event handler unobtrusively with a framework like jQuery.

Or, the "inline label" plugin for jQuery does it automatically for you, actually.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

29 August 2010 at 6:31am

Glad it's working for you, by the way. Do you mind if I post this tutorial on my blog? It actually came out pretty nice and concise!

Avatar
CHD

Community Member, 218 Posts

29 August 2010 at 6:36am

sure go ahead!
can you leave out the website URL though? (its a client site so better if it doesn't end up in tutorials!)

also, when you create the tutorial, can you improve some of the field names?
for example, you labelled the search input field "s" which is fine, but if you elaborated on names, it helps me see the links better between different pieces of code :-) just a suggestion.

Avatar
CHD

Community Member, 218 Posts

29 August 2010 at 6:44am

P.S - im in the process of working with the latest trunk of eCommerce (0.6) that Jedateach and co. are improving.
do you have any experience with it?

its all working pretty well so far, but theres a few issues im having and could do with some expert advice!

Avatar
UncleCheese

Forum Moderator, 4096 Posts

29 August 2010 at 6:48am

Nope, I wouldn't touch that module. Sorry. There are far too many solid thirdparty solutions out there to be tinkering with the native SS ecomm module, IMO.

Avatar
CHD

Community Member, 218 Posts

29 August 2010 at 6:50am

hmmm this is true... but how easily are the other solutions integrated with SS?
or do you mean just dont use SS at all for ecommerce sites?

Avatar
CHD

Community Member, 218 Posts

29 August 2010 at 10:42pm

Hi again, so my client requested that seraching by part number too was actualy required.
so i've returned to your earlier post about multiple search fields, here's the code i've updated. all seems to work fine:

public function doProductSearch($data, $form) {
if(isset($data['s'])) {
$filters = array();
foreach(Product::$searchable_fields as $field) {
$filters[] = "$field LIKE '%".Convert::raw2sql($data['s'])."%'";
}
$filter = implode(" OR ", $filters);
}
return array (
'ProductList' => $this->ProductList($filter)
);
}

the only thing not great now, is when your search returns no results, nothing happens. it just shows the default list. how easy is it to display an "your search returned no results" message?
also, is there a way we can include the search query in the result page? just to clearly show that it worked.
even if the search term remained in the search field would be better than what it currently does.
if the search is quite generic, you might not even notice that it worked as the list doesnt change much and there is no success message... does that make sense?

Avatar
CHD

Community Member, 218 Posts

29 August 2010 at 11:00pm

P.S - I've already got my catalogue.ss template configured (i think)
with:

<% if ProductList %>
$ProductList.sort(Title)
<% control ProductList %>

TABLE HERE

<% end_control %>
</table>
<% else %>
    <p>Sorry, your search query did not return any results.</p>
<% end_if %>

so having no ProductList returned will show the error message that i want. but how do i make the function return nothing if no matches are found?