Tuesday, 16 March 2010

Apex 4.0: SQL in Plugins and seeing Stars.....

This is my first post in a few weeks as I've been a little busy with work recently, which is just criminal as I really just want to play with Apex 4 EA2.  Oh well, bills have to be paid and children fed I suppose.

Anyway, let's cut to the chase.  There is a nice feature of Apex 4 plugins (which I'm pretty sure wasn't working correctly in EA1) where you can create a custom attribute of type 'SQL Query'.  I've added this to the Range Slider plugin I use on my Online Store demo for the min and max default range values, as you can see below:

Anyone using the plugin can write SQL statements for these attributes, and the good part is that they will be parsed when the changes are saved.  You can see in the screenshot below that I have set the Default Range Min Value to the mimimum selling price and the Default Range Max Value to maximum selling price.  I should, of course, set the Minimum Value and Maximum Value to also be 'SQL Query' attribute types and set them to be slightly smaller and large that the min/max selling prices, but I haven't got around to that yet.  Sorry.  The plugin can be found here.

And what does he mean by '....seeing Stars' in the Blog post title, I hear you ask?  Well let me explain.

You may have noticed that I have used a Star Rating on my application, which is taken from Patrick Wolf's excellent sample Plugin application which can be found via this blog post.  I have taken that Star Rating plugin and used some jQuery magic to dynamically update the list of products in a similar manner to the Range Slider and Categories in the Refine Search region.   Click on a star and it will displ;ay products that have at least that rating as a minimum.  So clicking on star 3 will display all products with ratings of 3, 4 or 5 stars.  You can also click on the reset button to the left to set it so that all products are displayed including those without a rating.  If you want to know how to do this in more detail, then please let me know and I try and find the time to explain.

At some point I promise I really, really, really am going to smarten the demo up.   Bye for now.

No comments: